Skip to content
shellhacks.dev

AWS IAM Policy Generator

Generate least-privilege AWS IAM policies for common jobs: S3 bucket or prefix access, consuming an SQS queue, sending with SES, reading a secret and pushing to ECR.

Free · No sign-up · Your inputs stay in your browser

Input

Generate a least-privilege AWS IAM policy

Output

Policy JSON

551 characters

ListBucket is granted on the bucket ARN and object actions on bucket/*: the two resources are different, and putting both actions on one of them is the classic reason a policy 'does not work'. Check a policy with the IAM policy simulator before attaching it to a role.

Runs in this browser. Nothing you paste is sent to a server.

The S3 mistake everyone makes once

s3:ListBucket applies to the bucket ARN (arn:aws:s3:::name) and s3:GetObject to object ARNs (arn:aws:s3:::name/*). Granting both on one of them silently fails half the calls. The IAM policy elements reference describes each block.

Test before attaching

The IAM policy simulator in the console evaluates a policy against specific actions and resources. IAM Access Analyzer can also generate a policy from CloudTrail activity, which is the most accurate way to narrow an existing over-broad role.

Share

Frequently asked questions

What is the difference between an IAM policy and a bucket policy?
An identity policy is attached to a user or role and says what it may do. A bucket policy is attached to the bucket and says who may access it. Cross-account access usually needs both.
Why use aws:SecureTransport?
It denies requests made over plain HTTP. Combined with a bucket policy that denies when it is false, it guarantees data in transit is encrypted.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Go deeper

Suggested reading

Keep planning

Similar tools