Least privilege means giving each person exactly what their job needs, and nothing more. If a key is stolen or someone makes a mistake, the damage stays small.
Ready-made policies are often too wide. AmazonS3FullAccess lets someone delete every bucket. When nothing fits, write your own policy:
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::dragon-photos-2026/*"
}]
}s3:PutObject is uploading an object. The Resource is every object in one bucket: /* after the name means "everything inside".
aws iam create-policy
Saves your own policy in the account. It does nothing until you attach it.
"Arn": "arn:aws:iam::123456789012:policy/DragonUpload", ← use this to attach itYour own policies have your account's id in their ARN, where AWS's ready-made ones say aws.
A policy's name can be used only once. Made a mistake? Save the fixed file, delete the policy with aws iam delete-policy --policy-arn arn:aws:iam::123456789012:policy/DragonUpload, and create it again. (A policy that is already attached must be detached first, so check the file before you attach it.)