DEV Community

Gabriel Olaleye for AWS Community Builders

Posted on • Originally published at linkedin.com

How to deploy a static website on Amazon S3 with Route 53

We will be launching a static website on Amazon S3 and routing it using Route 53

Design

Deploy a static website

What do we need

  • An S3 bucket
  • A domain name (Purchase from Amazon Route 53)

What to do

  • Create/Purchase a domain name using Amazon Route 53
  • Create an S3 bucket
  • Upload your website to your S3 bucket
  • Enable static webste hosting on S3
  • Attach a bucket policy
  • Direct your domin to the S3 bucket

Steps to follow

  1. Create/Purchase a domain name using Amazon Route 53 Open AWS Console and Navigate to Amazon Route 53 dashboard

Amazon Route 53 Dashboard

  1. Click on Register Domain
  2. Search if your Domain is available and add it to your cart
  3. Enter your details and accept the terms and conditions
    *Don't forget to disable automatic renewal

Create an S3 bucket

  1. Navigate to Amazon S3 dashboard and Create a bucket

Amazon S3 Dashboard

  1. Use your domain name as the bucket name
  2. Choose a region closest to you
  3. Uncheck BLOCK PUBLIC ACCESS (so that the public can access it)
  4. Acknowledge the warning and leave others as defaults
  5. Click on create bucket
  6. Once it's done, click your bucket and select upload

Upload your website to your S3 bucket

  1. Click on Add files (Add from your computer)

Upload to S3

  1. Select upload

Enable static website hosting on S3

  1. On the tab, Click on properties
  2. Scroll down and select STATIC WEBSITE HOSTING

Enable static webhost

  1. Change it to ENABLE and also change the index document (to your file name)
  2. Click SAVE CHANGES

Attach a bucket policy

  1. On the tab, click on PERMISSIONS
  2. Click edit and write a bucket policy

Add a policy

  1. Click save changes

Direct your domain to the S3 bucket

  1. Navigate to Route 53 dashboard
  2. Click on hosted zone

Direct your domain

  1. Click on your domain name
  2. Click on create record and choose a simple routing policy
  3. Click next
  4. Click on Define simple record
  5. For the VALUE, type Alias to S3 website endpoint
  6. Choose the same region you host your bucket
  7. Select the S3 endpoint
  8. Set 'Evaluate target health' to NO
  9. Click Define simple record
  10. Create record and wait for few minute to reload your website

To watch a step-bystep video
Click HERE

Top comments (0)