Reading IAM policies is important. Writing them is where the knowledge solidifies. In this exercise, you will write IAM policies for five real-world scenarios that GRC engineers encounter regularly. Each scenario presents a specific access requirement, and your job is to write the minimum-privilege policy that satisfies it.
These are not trick questions. They are based on actual access patterns in production AWS environments. The goal is precision — granting exactly the permissions needed, scoping to specific resources, and including conditions where appropriate.
For each scenario, you will see a description of the requirement, a JSON template with placeholders to get you started, and a reference solution you can reveal after you have written your own version. Write your policy first, then compare.
Exercise
~30 min
Write an IAM policy for this scenario
Scenario
S3 Read-Only Access for a Data Analyst
A data analyst needs read-only access to a specific S3 bucket containing quarterly financial reports. They need to list the contents of the bucket and download individual objects, but must not be able to upload, modify, or delete anything.
Write your IAM policy in JSON below. The policy must be a valid JSON object.
Exercise
~30 min
Write an IAM policy for this scenario
Scenario
Cross-Account Audit Role Trust Policy
The security team in account 111111111111 needs to assume a read-only audit role in account 222222222222. Write the trust policy for the role in account 222222222222 that allows only the security team's role to assume it, and only when MFA is present.
Write your IAM policy in JSON below. The policy must be a valid JSON object.
Exercise
~30 min
Write an IAM policy for this scenario
Scenario
SCP: Protect CloudTrail Integrity
Write a Service Control Policy (SCP) that prevents anyone in the organization from stopping CloudTrail logging, deleting CloudTrail trails, or modifying event selectors. This SCP will be attached to the root OU to protect audit log integrity across all accounts.
Write your IAM policy in JSON below. The policy must be a valid JSON object.
Exercise
~30 min
Write an IAM policy for this scenario
Scenario
Least-Privilege Lambda Execution Role
A Lambda function processes images uploaded to an S3 bucket and writes metadata to a DynamoDB table. Write the identity-based policy for the Lambda execution role that grants exactly the permissions needed — no more.
Write your IAM policy in JSON below. The policy must be a valid JSON object.
Exercise
~30 min
Write an IAM policy for this scenario
Scenario
Permission Boundary for Delegated Role Creation
A team lead can create IAM roles for their team members. You need to ensure that any role the team lead creates can never have more than S3 and DynamoDB permissions — even if the team lead attaches AdministratorAccess. Write the permission boundary policy that limits the maximum possible permissions.
Write your IAM policy in JSON below. The policy must be a valid JSON object.
Review your solutions against the references. Pay attention to these common mistakes:
s3:ListBucket operates on the bucket (arn:aws:s3:::bucket-name), while s3:GetObject operates on the objects inside (arn:aws:s3:::bucket-name/*). Forgetting one of the two ARNs is the most common S3 policy error."Resource": "*" when you could scope to a specific bucket, table, or log group. Least privilege applies to resources, not just actions.Each correctly written policy maps directly to a control you would document in a SOC 2 or ISO 27001 assessment. The S3 read-only policy demonstrates least privilege (CC6.3). The cross-account trust policy demonstrates access control and MFA enforcement (CC6.1, CC6.3). The SCP demonstrates preventive controls for audit log integrity (CC7.2). The Lambda role demonstrates least privilege for machine identities. The permission boundary demonstrates delegated administration with guardrails.