Delete IAM policies (Amazon CLI) - Amazon Identity and Access Management
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Delete IAM policies (Amazon CLI)

You can use the Amazon Command Line Interface (Amazon CLI) to delete customer managed policies and inline policies in IAM. The number and size of IAM resources in an Amazon account are limited. For more information, see IAM and Amazon STS quotas.

Note

Deletion of IAM policies is permanent. After the policy is deleted it cannot be recovered.

For more information about IAM policy structure and syntax, see Policies and permissions in Amazon Identity and Access Management and the IAM JSON policy element reference.

For more information about the difference between managed and inline policies, see Managed policies and inline policies.

Prerequisites

Before you delete a policy, you should review its recent service-level activity. This is important because you don't want to remove access from a principal (person or application) who is using it. For more information about viewing last accessed information, see Refine permissions in Amazon using last accessed information.

Deleting customer managed policies (Amazon CLI)

You can delete a customer managed policy from the Amazon Command Line Interface.

To delete a customer managed policy (Amazon CLI)
  1. (Optional) To view information about a policy, run the following commands:

  2. (Optional) To find out about the relationships between the policies and identities, run the following commands:

  3. To delete a customer managed policy, run the following command:

Deleting inline policies (Amazon CLI)

You can delete an inline policy from the Amazon CLI.

To delete an inline policy (Amazon CLI)
  1. (Optional) To list all inline policies that are attached to an identity (user, user group, role), use one of the following commands:

  2. (Optional) To retrieve an inline policy document that is embedded in an identity (user, user group, or role), use one of the following commands:

  3. To delete an inline policy from an identity (user, user group, or role that is not a service-linked role), use one of the following commands: