How to Launch a Website in Aws Cloud?
You have this wonderful idea which you may develop into an online product in future. Or you want to create a website for your business. May be you want to create a website in your kid’s name, because investing in a domain name will give them better returns when they grow up. Whatever may be the reason, buy a domain from one of the registrars like GoDaddy first. https://www.godaddy.com
Creating Hosted Zone in Route 53
Create an Aws account and login after verification. Navigate to Route 53 under Services menu. Create a Public Hosted Zone in Route 53 for your domain.
Creating SSL certificates for your domain
Now search for Certificate Manager in Services and select the link. Click Request a certificate. Select N. Virginia as your region for certificate creation.
Uncheck Block all public access and Save. Go to Bucket Policy and paste the below json. Replace the Resource with your domain name and click Save.
Now click Overview and Upload your index.html. Also an error.html to display as a generic error page.
Copy the Endpoint for the next Step.
Cloud Front distribution
Search for Cloud Front under Services and click Create Distribution. Click Get Started button in Web delivery method.
- Paste your S3 Endpoint Url in Origin Domain Name and Leave other settings as default under Origin Settings
- In Viewer Protocol Policy, select Redirect HTTP to HTTPS option
- Leave all other settings with defaults except Compress Objects Automatically for which select Yes. This enables Gzip compression.
- In Alternate Domain Names (CNAMEs) type “www.softwok.com, softwok.com”
- Select Custom SSL Certificate under SSL Certificate and select the certificates we created.
- Click Create Distribution to finish the Cloud Front creation
Wait till the Status of your Distribution changes to Deployed.
Route domain requests to Cloud Front in Route 53
Navigate to Route 53 and click Create Record Set. Paste the Domain Name copied into Alias Target after selecting Alias as Yes. Leave rest as default and click Save Record Set. Repeat this for www domain too.
Assuming you created the hosted zone a day before and you updated the registrar. Your website will be live in a few minutes with https enabled. Tada!
With Free Tier pricing your website is now running under a budget of $1 including taxes.