Hosting a static website on AWS S3 with SSL.

  • AWS S3
  • AWS CloudFront
  • AWS Certificate Manager
  • A Domain name for the website
  • AWS Route53

How does everything pieces together?

Hosting a website generally requires a computing entity, generally an EC2. There whole hustle of making sure that the contents are secure, backed up properly and also are available at all times. S3 allows to host a static website and S3 does the job exactly as well. And the cost of hosting a website on S3 is significantly lower as compared to provisioning an EC2. There are few advantages other than having to pay less as well, naming a few here.

  • Low Cost and Scalability — Well, no surprises here. Hosting Images on Amazon S3 gives you the ability to store a large amount of data with a very low cost. With Amazon S3 you only pay for your what you use. While hosting on your own server is expensive and its price is fixed. Whether you use it or not you have to pay for it. You don’t need to worry about the storage space it auto scales and available in abundance.
  • Data backup and availability — Hosting Images on Amazon S3 gives you 99.99% availability that will protect your data. Your data will be protected against network and power problems as well as against hardware failure. Plus imagine putting different copies of your images on three servers like amazon s3 does for every image it hosts and you will see that the cost is even more great.
  • Security — Data stored in Amazon is secure by default because only owner and bucket have access to Amazon S3 resources. It provides encryption for both secure storage and secure transit.
  • Simple Data Transfer — Amazon S3 gives you many options for Cloud Data Migration. It makes is cost effective and so simple to transfer a large amount of data to Amazon S3 or out of Amazon S3.
  • Easy to Manage — With Amazon S3, you don’t have to worry about creating the environment for your code to run, dependencies, package upgrades, patches, networking, firewall and all the hassle that a server brings. You just upload your code and S3 will read the index.html page and hosts your website.

Creating a S3 bucket

  1. Login into AWS console and navigate to S3.
  2. Click on Create Bucket.

Creating a SSL certificate using Certificate Manager

Let’s also create a SSL certificate for our website using AWS Certificate Manager.

  1. Navigate to Certificate Manager.
  2. Click on Request a certificate.
  3. Request a public certificate.
  4. Add domain names as applicable and click on Next. You can use *.cubedsteps.com as well.

Creating hosted zones on Route53

  1. Navigate to Route53 to create a hosted zone.

Creating CloudFront distribution

Now finally, we will be creating a CloudFront distribution as CDN to serve the files in S3. But more importantly, S3 doesn’t have a mechanism to enable SSL on the websites being hosted on. For this reason, we are going to create a CloudFront distribution and attach the SSL certificate to the distribution.

  1. Navigate to CloudFront service. Click on create distribution right away. Choose Web delivery method.
  2. While clicking on the origin, you can see your bucket name listed there.
  1. Navigate to Route53.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Suman Dhakal

Suman Dhakal

AWS certified Solutions Architect — Associate