CmdID / aws / aws accessanalyzer
aws accessanalyzer check-access-not-granted
Checks whether the specified access isn't allowed by a policy. AWS CLI reference
1 example 3 options Its page in the AWS CLI reference
Examples
To check whether the specified access isn't allowed by a policy
The following check-access-not-granted example checks whether the specified access isn't allowed by a policy.
aws accessanalyzer check-access-not-granted --policy-document file://myfile.json --access actions="s3:DeleteBucket","s3:GetBucketLocation" --policy-type IDENTITY_POLICYIdentify--policy-documentThe JSON policy document to use as the content for the policy.--accessAn access object containing the permissions that shouldn't be granted by the specified policy.--policy-typeThe type of policy.Contents of myfile.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
{
"result": "PASS",
"message": "The policy document does not grant access to perform one or more of the listed actions."
}For more information, see Previewing access with IAM Access Analyzer APIs in the AWS IAM User Guide.
Options
--accessAn access object containing the permissions that shouldn't be granted by the specified policy.--policy-documentThe JSON policy document to use as the content for the policy.--policy-typeThe type of policy.