Skip to content

Instantly share code, notes, and snippets.

@mikegrima
Last active March 19, 2019 00:02
Show Gist options
  • Select an option

  • Save mikegrima/d1361737acfb2cb929b1a70ff15d97fb to your computer and use it in GitHub Desktop.

Select an option

Save mikegrima/d1361737acfb2cb929b1a70ff15d97fb to your computer and use it in GitHub Desktop.
S3 only permit specific bucket object access
Documented here: https://aws.amazon.com/blogs/security/how-to-restrict-amazon-s3-bucket-access-to-a-specific-iam-role/
Yes, it's really shitty.
Example Policy to ONLY allow specific IAM Roles access to the objects (denies all the other roles access to the objects):
{
"Version": "2008-10-17",
"Statement": [
{
"Effect": "Deny",
"Principal": "*",
"Action": [
"s3:ListBucket",
"s3:GetObject*",
"s3:PutObject*",
"s3:DeleteObject*"
],
"Resource": [
"arn:aws:s3:::SOMEBUCKET",
"arn:aws:s3:::SOMEBUCKET/*"
],
"Condition": {
"StringNotLike": {
"aws:userId": "AROAEXAMPLE:*"
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment