Menu
AWS Identity and Access Management
User Guide

Editing IAM Policies

A policy is an entity that, when attached to an identity or resource, defines their permissions. Policies are stored in AWS as JSON documents and are attached to principals as identity-based policies in IAM. You can attach an identity-based policy to a principal (or identity), such as an IAM group, user, or role. Identity-based policies include AWS managed policies, customer managed policies, and inline policies. You can edit customer managed policies and inline policies in IAM. AWS cannot be edited. For information about policy size limitations and other quotas, see Limitations on IAM Entities and Objects.

Editing Customer Managed Policies (Console)

You edit customer managed policies to change the permissions that are defined in the policy. A customer managed policy can have up to five versions. This is important because if you make changes to a managed policy beyond five versions, the AWS Management Console prompts you to decide which version to delete. You can also change the default version or delete a version of a policy before you edit it to avoid being prompted. To learn more about versions, see Versioning IAM Policies.

To edit a customer managed policy (console)

  1. Sign in to the AWS Management Console and open the IAM console at https://console.aws.amazon.com/iam/.

  2. In the navigation pane, choose Policies.

  3. In the list of policies, choose the policy name of the policy to edit. You can use the Filter menu and the search box to filter the list of policies.

  4. Choose the Permissions tab, and then choose Edit policy.

  5. Do one of the following:

    • Choose the Visual editor tab to change your policy without understanding JSON syntax. You can make changes to the service, actions, resources, or optional conditions for each permission block in your policy. You can also import a policy to add additional permissions to the bottom of your policy. When you are finished making changes, choose Review policy to continue.

    • Choose the JSON tab to modify your policy by typing or pasting text in the JSON text box. When you are finished making changes, choose Review policy to continue. Policy Validator reports any syntax errors.

    Note

    You can switch between the Visual editor and JSON tabs any time. However, if you make changes or choose Review policy in the Visual editor tab, IAM might restructure your policy to optimize it for the visual editor. For more information, see Policy Restructuring.

  6. On the Review page, complete the following tasks:

    1. To save your changes without affecting the currently attached entities, clear the check box for Save as default version. For more information, see Setting the Default Version of Customer Managed Policies.

    2. Type a Name and a Description (optional) for the policy that you are editing. You cannot edit these later.

    3. Review the policy Summary and then choose Save to save your work.

  7. If the managed policy already has the maximum of five versions, choosing Save displays a dialog box. To save your new version, you must remove at least one older version. You cannot delete the default version. Choose from the following options:

    • Remove oldest non-default policy version (version v# - created # days ago) – Use this option to see which version will be deleted and when it was created. You can view the JSON policy document for all nondefault versions by choosing the second option, Select versions to remove.

    • Select versions to remove – Use this option to view the JSON policy document and choose one or more versions to delete.

    After choosing the versions to remove, choose Delete version and save to save your new policy version.

To set the default version of a customer managed policy (console)

  1. Sign in to the AWS Management Console and open the IAM console at https://console.aws.amazon.com/iam/.

  2. In the navigation pane, choose Policies.

  3. In the list of policies, choose the policy name of the policy to set the default version of. You can use the Filter menu and the search box to filter the list of policies.

  4. Choose the Policy versions tab. Select the check box next to the version that you want to set as the default version, and then choose Set as default.

To delete a version of a customer managed policy (console)

  1. Sign in to the AWS Management Console and open the IAM console at https://console.aws.amazon.com/iam/.

  2. In the navigation pane, choose Policies.

  3. Choose the name of the customer managed policy that has a version you want to delete. You can use the Filter menu and the search box to filter the list of policies.

  4. Choose the Policy versions tab. Select the check box next to the version that you want to delete. Then choose Delete.

  5. Confirm that you want to delete the version, and then choose Delete.

Editing Inline Policies (Console)

You can edit an IAM policy or an inline policy using the AWS Management Console.

To edit an inline policy for a group, user, or role (console)

  1. In the navigation pane, choose Groups, Users, or Roles.

  2. Choose the name of the group, user, or role with the policy that you want to modify. Then choose the Permissions tab. If you chose Users or Roles, expand the policy.

  3. To edit an inline policy, choose Edit Policy.

  4. After you have modified your policy, choose Save to save your changes.

Editing IAM Policies (AWS CLI or the AWS API)

You can edit a managed or inline policy using the AWS Command Line Interface (AWS CLI) or the AWS API.

Note

A managed policy can have up to five versions. If you need to make changes to a customer managed policy beyond five versions from the AWS Command Line Interface or the AWS API, you must first delete one or more existing versions.

To list managed policies (AWS CLI or API)

To retrieve detailed information about a managed policy (AWS CLI or API)

To list the identities (users, groups, and roles) to which a managed policy is attached (AWS CLI or API)

To list the managed policies attached to an identity (a user, group, or role) (AWS CLI or API)

To edit a customer managed policy (AWS CLI or API)

To set the default version of a customer managed policy (AWS CLI or API)

To delete a version of a customer managed policy (AWS CLI or API)