Sometimes you want to make a specific s3 bucket public. My purpose was to host a maven repo on s3.
So if you want to make a bucket and all its files available publicly, just run this:
curl -Lso public-bucket.sh j.mp/public-bucket && chmod +x public-bucket.sh && ./public-bucket.sh
In the case of s3 resources you have 3 options go controll access:
User-based permissions
, also calledIAM policies
Resource-based permissions
, also calledBucket policies
- ACLs
In the use-case of public access to all objects in a bucket it's easier to create a resource-based policy, attached to the whole bucket. Than creating ACLs for the bucket, and than an ACL for each object.
- User-based permissions are attached to:
- IAM user
- IAM group
- IAM role
- Resource-based Permissions are attached to:
- S3 bucket
- SNS topic
- SQS queue
Permissions are representes as json documents storing the policies
{
"Version":"2012-10-17",
"Statement":[{
"Effect":"Allow",
"Action":"s3:ListBucket",
"Resource":"arn:aws:s3:::example_bucket"
}]
}
The picture below show, that you can acchive the same result with both variant.
AWS s3 makes it even more confusing by the introduction of ACL
s, which gives ability to manage access to buckets and objects.