Using Amazon AWS S3 to hosting a static web site.
Amazon AWS bucket storage, known as S3 has an interesting option: you can enable it to serve its content anonymously by http protocol, so if you store some html, js and css inside it, you will end up with a static web site!
Bucket creation and configuration
- create a new bucket with a unique name across S3 service. Don’t use dot “.” in the name because it will be problematic when interacting with CloudFront CDN; as a separator use dash “-” instead.
- Uncheck “Block all public access”, and all its sub options:

S3 bucket settings
- Once created, inside bucket’s options, choose: Properties -> Static website hosting, click EDIT

Static website hosting options
- add permissions.
- inside Policy (Note: “bucket-name” is the name of your bucket):
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::bucket-name/*"
}
]
}
- After this, the bucket will be marked with a red warning, like this:
![Publicly Accessible [red warning]](image-3.png)
Publicly Accessible [red warning]
- After this, your public URL is: http://bucket-name.s3-website-region.amazonaws.com/
- where: bucket-name and region are specific, for example:
Configure CDN cloud Front
-
Create a new distribution. Use as origin domain name, that public access name without “http://” part.
-
fill “Alternate Domain Names (CNAMEs)” and request a new certified or use an already issued one
-
After distribution was created, put the name “Domain name” as a CNAME of your domain
[ Post to be continued …]