Monday, October 24, 2011

allowing public access to amazon s3 bucket

You might need to give public access to bucket contents, for example if you use the bucket to load images for your site. Simple GUI option supplied by Amazon only gives access for a specific files but if you need a whole bucket, you have to use policy.

To edit policy, in GUI go to
'Bucket => Properties => Add Bucket Policy'

And add for example (just change yourbucketname with the name of your bucket:
{
    "Version": "2011-10-24",
    "Statement": [
        {
            "Sid": "AddPerm",
            "Effect": "Allow",
            "Principal": {
                "AWS": "*"
            },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::yourbucketname/*"
        }
    ]
}
save it and policy is applied.

Provided by:SiQ systems, Cloud experts

No comments: