Walk through the anatomy of an IAM policy document.
BeginnerConceptGlobal Infrastructure and IAM Basics
Answer
A policy has a Version (always "2012-10-17") and one or more Statements. Each statement has Effect (Allow/Deny), Action (or NotAction), Resource (or NotResource), an optional Condition, and Principal in resource-based policies.
{
"Version": "2012-10-17",
"Statement": [{
"Sid": "ReadLogs",
"Effect": "Allow",
"Action": ["s3:GetObject", "s3:ListBucket"],
"Resource": ["arn:aws:s3:::acme-logs", "arn:aws:s3:::acme-logs/*"],
"Condition": {"StringEquals": {"aws:RequestedRegion": "ap-south-1"}}
}]
}
Note the bucket ARN and object ARN are separate resources.
More on Global Infrastructure and IAM Basics
What is the difference between a Region, an Availability Zone and an edge location?BeginnerHow do you choose a Region for a workload?BeginnerWhat is the difference between an AZ name like `us-east-1a` and an AZ ID like `use1-az1`?IntermediateExplain the shared responsibility model.BeginnerWhat is the root user and how should you treat it?BeginnerWhat is the difference between an IAM user, group and role?Beginner