05 Secure with HTTPS - AWS

The website URL should be secured with HTTPS
AWS
To enable HTTPS for S3 you need to add AWS Cloud Front as a service. This is a CDN service that will serve your website on an HTTPS URL.

AWS Cloud Front

To create an AWS Cloud Front service, in the AWS portal find the Cloud Front service and select Create Distribution.

For the Origin, which is essentially the source the CDN will use to feed its caches, choose the S3 website endpoint on the URL http://{BUCKET NAME}.s3-website-{REGION}.amazonaws.com. If you browse and choose the S3 bucket then it will prompt you to use the website endpoint dynamically.

For this purpose we’ll skip the origin path.

For the Name leave it as deafult for now. The following pages will explain how we can use CNAME (DNS alias) to allow us to use our own domain name in-front of the Cloud Front service on the public URL.

Again, for ths purpose, skip header.

Enabling Origin Shield is optional and will incur costs. For this small scale setup it’s not required.

Under the Viewer section, enable the HTTPS only option to ensure that Cloud Front URLs are HTTPS only.

All other options can be left as-is.

Click Create Distribution and monitor the status in the portal. This could take 10-20 minutes to deploy.

Under the properties of the service is the Distribution Domain Name. This is the Cloud Front URL which will look something like this https://d1n6xxjjrymahi.cloudfront.net. Once the CDN caches are update with your origin, this URL should serve your website on an HTTPS connection.

image
Last modified July 21, 2024: update (e2ae86c)