We can use the AWS Policy Generator to generate a bucket policy for our bucket.
Select the option as per below then click on "Add Statement"
The above example allows (
Effect: Allow
) anyone (Principal: *
) to access (Action: s3:GetObject
) any object in the bucket (Resource: arn:aws:s3:::<bucket-name>/*
).Then select "Generate Policy"
Then We will get policy like below
this policy will allow anyone to read every object in our S3 bucket(raj03282019) (just replace
<bucket-name>
with the name of your bucket):{
"Id": "Policy1553770384193",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1553769495927",
"Action": [
"s3:GetObject"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::raj03282019/*",
"Principal": "*"
}
]
}
Now go to your AWS S3 console, At the bucket level(raj03282019), click on Permissions, then Select Bucket Policy. Paste the above generated code into the editor and hit save.
Now all your items in the bucket(raj03282019 in my case) will be public by default.
No comments:
Post a Comment