How to Create an S3 bucket with PublicRead in CloudFormation
Here’s a minimal CloudFormation template for creating an S3 bucket with public read access. This is useful for hosting static assets like images, CSS, or JavaScript files that need to be publicly accessible.
Note that AWS has been tightening S3 public access controls — newer accounts have the “Block Public Access” setting enabled by default at the account level. You may need to disable that first, or better yet, use a CloudFront distribution in front of the bucket with an Origin Access Identity instead of making the bucket directly public. The PublicRead ACL approach shown here still works but is considered legacy.
AWSTemplateFormatVersion: 2010-09-09
Description: Basic S3 Bucket CloudFormation template
Resources:
S3BucketForWebsiteContent:
Type: AWS::S3::Bucket
Properties:
AccessControl: PublicRead
Outputs:
BucketName:
Value: !Ref S3BucketForWebsiteContent
Description: Name of the newly created Amazon S3 Distribution