AWS S3 Bucket, Publish Static website using S3
S3 (Simple Storage Service) — Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance. This means customers of all sizes and industries can use it to store and protect any amount of data for a range of use cases, such as data lakes, websites, mobile applications, backup and restore, archive, enterprise applications, IoT devices, and big data analytics. Amazon S3 provides easy-to-use management features so you can organize your data and configure finely-tuned access controls to meet your specific business, organizational, and compliance requirements. Amazon S3 is designed for 99.999999999% (11 9’s) of durability, and stores data for millions of applications for companies all around the world.
How to create S3 Bucket :
Go to AWS Console and search for S3 Service on the portal. On S3 Dashboard click on Create Bucket Button.
Enter the Bucket name, Bucket Name must be unique across the AWS S3 Names, as buckets are not tied to any account or any specific region. They work as open names on the internet across all AWS S3 users hence you need to provide a unique name for your S3 Bucket.
You can also clone bucket from and existing S3 bucket to copy all its permissions and configurations on the bucket.
By default the bucket is marked as private and all Public access to the bucket is blocked by default, you can de-select this option if you want to allow public access to your S3 bucket.
You can also enable Versioning on Bucket to maintain the versioning of the files you upload on your bucket.
You can also enable data encryption on your bucket and select the encryption method to add further protection to your data.
How to Enable Static Website hosting on your bucket :
Go to the bucket details and select the Properties tab, go to the bottom section which starts as Static Website Hosting.
Click on Edit button and select the enable option. After enabling the Static website hosting you will get the public url to access the contents of the S3 Bucket.
Now you need to set the permissions on your bucket to add access to your S3 bucket. Go to the permissions tab. Edit the Bucket policy as follows
AWS CLI (Command Line Interface)
check if aws cli is available at ec2: aws s3 ls
if needed : pip install awscli
--Create new bucket--list objects of a bucket--remove a bucket--sync content to s3 from local/ec2--sync from s3 to ec2
aws s3 mb s3://<bucket-name>
aws s3 ls s3://bucket-name
aws s3 rb s3://bucket-name
aws s3 sync . s3://<bucket-name>
aws s3 sync s3://<bucket-name> .