In this lesson, we learned how to configure an S3 Bucket Policy to make an object publicly accessible. Below is a step-by-step breakdown of the process.
By default, public access is blocked in AWS S3 to prevent accidental data leaks. To allow public access:
⚠️ Warning: Making an S3 bucket public can expose sensitive data. Only do this for specific use cases, such as serving static assets.
Now that public access is enabled, we must define a Bucket Policy to grant read permissions.
AWS provides a Policy Generator to help create policies easily:
Allow as the effect.s3:GetObject as the action (allows read access)./* to the ARN to apply permissions to all objects inside the bucket.{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::your-bucket-name/*"
}
]
}