I want to create and host a HTTPS secure static website using AWS S3 bucket, Cloudfront, and Godaddy.
If you are looking for options on hosting that is cost-effective, can scale just in case your site goes viral and is fairly easy to maintain? and It's important to host your websites and web apps with HTTPS enabled. here a right architecture for you to host.
We will be using AWS S3 for hosting our static website content (will post a separate blog, how to host an Angular application). AWS CloudFront for faster distribution, using AWS certificate manager and finally we will be using our DNS service from Godaddy. (I could have used AWS Route53 but why to pay that extra 50 bucks).
**imp. - because of GoDaddy only allows CNAME for subdomains; we will do cloudfront distribution for www.myexample.com, and use domain forwarding from myexample.com to www.myexample.com
**imp. - because of GoDaddy only allows CNAME for subdomains; we will do cloudfront distribution for www.myexample.com, and use domain forwarding from myexample.com to www.myexample.com
1. Setup S3 bucket and upload your website content to your bucket.
Just remember below points:
Just remember below points:
- Bucket name should be domain friendly. if domain name = web.myexample.com; keep it "myexample"
- Uncheck the "Block all public access"
- Properties tab, Set as static website hosting
- Permission tab, update the bucket policy with below text, Save
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowPublicReadAccess",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3::: myexample/*"
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowPublicReadAccess",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3::: myexample/*"
}
]
}
]
}
2. Use AWS Certificate Manager,
**Imp: it's easy to manage if you create a separate certificate for each subdomain
3. AWS Cloudfront - Create Distribution with below settings, rest leave default
**Imp: it's easy to manage if you create a separate certificate for each subdomain
- Change Zone to 'N. Virginia' --> Click 'Request a certificate' --> add domain name 'www.myexample.com'
- use DNS validation, follow process to update CNAME DNS records.
3. AWS Cloudfront - Create Distribution with below settings, rest leave default
- Origin Domain Name: Copy and paste bucket name from S3, don't use dropdown suggestion for static hosting.
- Viewer Protocol Policy: Redirect HTTP to HTTPS
- Change the
Allowed HTTP MethodstoGET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE, - Alternate Domain Names: add 'www.myexample.com'
- Click 'Custom SSL Certificate' : select your certificate for this subdomain.
4. GoDaddy, DNS manager
- Add DNS record, Type CNAME
- Host name: 'www', Point to: "Copy and paste the CloudFront distribution domain name here"
- Now to forward domain to subdomain: Click Forward, Domain - ADD, put 'www.myexample.com'

Comments