CmdID

CmdID / aws / aws iam

aws iam create-policy-version

Creates a new version of the specified managed policy. AWS CLI reference

1 example 3 options Its page in the AWS CLI reference

Opens CmdID with your command. It is read in your browser and sent nowhere.

Examples

from aws-cli, each command read by CmdID

To create a new version of a managed policy

The following create-policy-version example creates a new v2 version of the IAM policy whose ARN is arn:aws:iam::123456789012:policy/MyPolicy and makes it the default version.

aws iam create-policy-version --policy-arn arn:aws:iam::123456789012:policy/MyPolicy --policy-document file://NewPolicyVersion.json --set-as-defaultIdentify
--policy-arnThe Amazon Resource Name (ARN) of the IAM policy to which you want to add a new version.
--policy-documentThe JSON policy document that you want to use as the content for this new version of the policy.
--set-as-defaultSpecifies whether to set this version as the policy's default version.

Contents of NewPolicyVersion.json:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:GetObject",
                "s3:ListBucket"
            ],
            "Resource": [
                "arn:aws:s3:::amzn-s3-demo-bucket",
                "arn:aws:s3:::amzn-s3-demo-bucket/*"
            ]
        }
    ]
}
Its output
{
    "PolicyVersion": {
        "CreateDate": "2015-06-16T18:56:03.721Z",
        "VersionId": "v2",
        "IsDefaultVersion": true
    }
}

For more information, see Versioning IAM policies in the AWS IAM User Guide.

Options

3 in the AWS CLI reference
--policy-arnThe Amazon Resource Name (ARN) of the IAM policy to which you want to add a new version.
--policy-documentThe JSON policy document that you want to use as the content for this new version of the policy.
--set-as-defaultSpecifies whether to set this version as the policy's default version.