Creating a New Version of a Managed Policy

You can create a new version of a managed policy to update it. Managed policy can have up to five versions.

You can set this new policy version as the default one to apply to EIM identities the policy is attached to.

Creating a New Version of a Managed Policy Using OSC CLI

See the CreatePolicyVersion command sample in the documentation of the EIM API.

Creating a New Version of a Managed Policy Using AWS CLI

To create a new version of a managed policy, use the create-policy-version command following this syntax:

Request sample
$ aws iam create-policy-version \
    --profile YOUR_PROFILE \
    --policy-arn arn:aws:iam::123456789012:policy/MY_POLICY \
    --policy-document file://policy \
    --set-as-default \
    --endpoint https://eim.eu-west-2.outscale.com

This command contains the following attributes that you need to specify:

  • (optional) profile: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI.

  • policy-arn: The OUTSCALE Resource Name (ORN) of the policy. For more information, see Resource Identifiers.

  • policy-document: The policy document, corresponding to a JSON string that contains the new version of the policy. For more information, see EIM Reference Information and EIM Policy Generator.

  • (optional) set-as-default | no-set-as-default: If set to set-as-default, the new policy version becomes the default one and is applied to the EIM identities the policy is attached to.

  • endpoint: The endpoint corresponding to the Region you want to send the request to.

The create-policy-version command returns the following elements:

  • PolicyVersion: Information about the newly created policy version. This element contains the following information:

    • CreateDate: The date and time of creation of the policy version.

    • VersionId: The ID of the policy version.

    • IsDefaultVersion: If true, the newly created policy version is the default one.

Result sample
{
    "PolicyVersion": {
        "CreateDate": "2016-05-12T18:43:524Z",
        "VersionId": "v2",
        "IsDefaultVersion": true
    }
}

The policy version is created and set as the default one if you specified so.

Related Pages

Corresponding API Method

AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.