Interview Prep/AWS/Global Infrastructure and IAM Basics

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.

aws All AWS questions Roadmap: AWS core services

More on Global Infrastructure and IAM Basics