- Newest
- Most votes
- Most comments
To make a single file in your S3 bucket publicly accessible, you'll need to follow these steps:
- First, you need to modify the Block Public Access settings for your bucket:
- Go to the S3 console and navigate to your bucket
- Click on the "Permissions" tab
- Find the "Block public access" section and click "Edit"
- Uncheck "Block all public access" (you may need to uncheck all four individual settings)
- Save the changes by typing "confirm" when prompted and clicking "Confirm"
- Make the specific object (file) public:
- Go to the "Objects" tab in your bucket
- Select the file you want to make public
- Click "Actions" and choose "Make public using ACL"
- Confirm the action
Alternatively, if you prefer using bucket policies instead of ACLs (especially if you have "Bucket owner enforced" object ownership setting), you can:
- Go to the "Permissions" tab of your bucket
- Under "Bucket Policy", click "Edit"
- Add a policy that grants public read access to only your specific file:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadForSingleObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::YOUR-BUCKET-NAME/YOUR-FILE-NAME"
}
]
}
(Replace YOUR-BUCKET-NAME with your actual bucket name and YOUR-FILE-NAME with the path to your file) 4. Save the changes
After completing these steps, you should be able to access your file using its S3 object URL. Keep in mind that making objects public has security implications, so only do this for content that you intend to be publicly accessible.
Sources
How do I obtain a public access link for my S3 bucket resource? | AWS re:Post
Can't Open a Link to download a File | AWS re:Post
Module 5. Test your setup
Relevant content
- asked 8 months ago
- AWS OFFICIALUpdated 5 months ago
