CmdID

CmdID / aws / aws accessanalyzer

aws accessanalyzer check-no-new-access

Checks whether new access is allowed for an updated policy when compared to the existing 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 check whether new access is allowed for an updated policy when compared to the existing policy

The following check-no-new-access example checks whether new access is allowed for an updated policy when compared to the existing policy.

aws accessanalyzer check-no-new-access --existing-policy-document file://existing-policy.json --new-policy-document file://new-policy.json --policy-type IDENTITY_POLICYIdentify
--existing-policy-documentThe JSON policy document to use as the content for the existing policy.
--new-policy-documentThe JSON policy document to use as the content for the updated policy.
--policy-typeThe type of policy to compare.

Contents of existing-policy.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/*"
            ]
        }
    ]
}

Contents of new-policy.json:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:GetObject",
                "s3:GetObjectAcl",
                "s3:ListBucket"
            ],
            "Resource": [
                "arn:aws:s3:::amzn-s3-demo-bucket",
                "arn:aws:s3:::amzn-s3-demo-bucket/*"
            ]
        }
    ]
}
Its output
{
    "result": "FAIL",
    "message": "The modified permissions grant new access compared to your existing policy.",
    "reasons": [
        {
            "description": "New access in the statement with index: 0.",
            "statementIndex": 0
        }
    ]
}

For more information, see Previewing access with IAM Access Analyzer APIs in the AWS IAM User Guide.

Options

3 in the AWS CLI reference
--existing-policy-documentThe JSON policy document to use as the content for the existing policy.
--new-policy-documentThe JSON policy document to use as the content for the updated policy.
--policy-typeThe type of policy to compare.