- You should have a domain name already purchased to link with your Static Website.
- Some Web content to display on your domain.
- Create an S3 bucket and Configure it for static website hosting.
- Create a record in Route 53.
- Create a CloudFront distribution and link it with your custom domain.
- Create Certificates in AWS Certificate Manager.
- Then Finally Link the CloudFront CDN, S3, Custom Domain and SSL Certificate via Route 53 To securly access your webpage.
index.html
<html>
<body>
<h1> "Be A Better Version of Yourself".</h1>
<img src="image/image.jpg" alt="Be-a-Better-Version-of-Yourself">
</body>
</html>
In Block Public Access settings for this bucket, uncheck "Block all public access" and select the acknowledge at the end.
Once files are uploaded you can see the status "Succeeded".
Now go to "Properties" tab and enable "Static website hosting" enter index.html in index document section and save changes.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::learnwithsampath.world/*"
]
}
]
}
This policy will grants public read access to all objects within the "learnwithsampath.world" S3 bucket.
Now we have to redirect the click to learnwithsampath.world to this s3 bucket.
I have already purchased a domain name "learnwithsampath.world" with godaddy Internet domain registrar.
To manage godaddy domain name using AWS Route-53 we have to copy nameservers created in Route53 to godaddy.
Now you can manage your domain from Route-53 by creating records in it.
But it's still "Not secure" its http://learnwithsampath.world/ not https://learnwithsampath.world/
Note: You have to select the AWS North Virginia region(US-East-1). As CloudFront recognizes only this region as it's ACM certificates.
Once you click request, you need to add the given record in Route 53 by clicking on Create records in Route 53.
After the certificate is issued, we can set up a CloudFront distribution. Open Amazon CloudFront in aws console and click on "Create a CloudFront distribution"
**It will take few minutes.
Previously we have created A-record in Route 53 pointing to "S3 website endpoint" you delete/edit that A-record to point to Distribution domain name and save record.
Wait for some time for changes to apply
Even you time http://learnwithsampath.world/ also it will redirect to https://learnwithsampath.world/
Thank you for reading this post! I hope you found it helpful. If you have any feedback or questions,Please connect with me on LinkedIn at https://www.linkedin.com/in/sampathsivakumar-boddeti-1666b810b/. Your feedback is valuable to me. Thank you!