If you want a cheap static website and a hobby that mostly involves DNS fiddling then S3 on the AWS free tier is your friend. This guide walks you through creating a matching bucket name turning on static website hosting making objects readable and pointing a custom domain with Route 53 or your registrar. If you care about HTTPS then add CloudFront and request a free certificate from ACM in the right region and bask in secure, cached glory.
Pick a bucket name that exactly matches your domain for the root site. For example example.com is a good name if you own example.com. In the S3 console open bucket properties and turn on static website hosting. Set the index document to index.html and the error document to error.html or whatever tiny rage page you prefer.
By default AWS blocks public access. Turn off block public access for this bucket only if you want the S3 website endpoint to serve files directly. Then attach a policy that lets the web fetch objects. Here is a minimal example that you will adapt with your actual bucket name.
{
"Version" : "2012-10-17",
"Statement" : [
{
"Effect" : "Allow",
"Principal" : "*",
"Action" : [ "s3:GetObject" ],
"Resource" : "arn:aws:s3:::example.com/*"
}
]
}
That policy opens your files for browsers to fetch. If you are allergic to public buckets then skip this and use CloudFront to restrict access with an origin access identity.
Drag and drop in the console or use the CLI. A common command looks like this
aws s3 sync ./public s3://example.com --acl public-read
After upload visit the bucket website endpoint in your browser. If index.html renders you win. Minify CSS and JS gzip or brotli assets locally and set cache control headers to save bandwidth and speed up visits.
If you use Route 53 create an alias A record for the root or a CNAME for the www name and point it at the S3 website endpoint or at a CloudFront distribution. If you use an external registrar add the appropriate A or ALIAS records your registrar provides. DNS changes sometimes take a nap before propagating so be patient.
S3 website endpoints do not speak HTTPS. If you want secure connections you must put CloudFront in front of the bucket. Create a CloudFront distribution and use the S3 website endpoint or S3 origin with origin access identity depending on your access pattern. Request an ACM certificate in the us-east-1 region for CloudFront to use. Attach your custom domain to the distribution and wait for the distribution to deploy.
CloudFront gives global caching lower latency and HTTPS at the cost of one more AWS service to learn to love. For tiny personal projects costs are usually low but not strictly free beyond the S3 free tier storage for new accounts.
Summary Basically make a matching bucket enable static hosting upload files make objects readable and map your domain with DNS. Add CloudFront and ACM when you want HTTPS and faster global delivery. Congrats you have a static site hosted on AWS S3 with fewer moving parts than your last relationship.
I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!
This is a dedicated watch page for a single video.