Swipe left or right to navigate to next or previous post

Comprehensive tutorial on hosting the static site in AWS using S3, cloudfront, Certificate Manager and Route53 - part 2

09 Apr 2024 . category: AWS . Comments
#AWS #AWS S3 #AWS CloudFront #AWS Route53 #AWS Certificate Manager

Comprehensive tutorial on hosting the static site in AWS using  S3, cloudfront, Certificate Manager and Route53 - part 2  - Tapan BK

This is the part 2 of 2 of comprehensive tutorial on hosting the static site in AWS using AWS s3, AWS cloudfront, AWS Route53 and AWS certificate manager.

If you happen to come directly to this link, or you want to explore the part 1, Please visit Comprehensive tutorial on hosting the static site in AWS using S3, cloudfront, Certificate Manager and Route53 - part 1 . This is the final part of learning about hosting the static site in AWS using AWS s3, AWS cloudfront, AWS Route53 and AWS certificate

Major Steps for hosting the static sites:

  1. Step 1: Create a bucket
  2. Step 2: Edit Block Public Access settings
  3. Step 3: Enable static website hosting
  4. Step 4: Add a bucket policy that makes your bucket content publicly available
  5. Step 5: Configure an index document
  6. Step 6: Configure an index document
  7. Step 7: Test your website endpoint
  8. Step 8: Creating an SSL/TLS Certificate from AWS Certificate Manager
  9. Step 9: Configuring CloudFront Distributions for Website Delivery
  10. Step 10. Configuring Route53 for DNS Management

In this tutorial, we will learn about creating SSL/TLS certificate from AWS Certificate Manager, create cloudfront distribution and then finally configuring the route53 for DNS management.

Step 8: Creating an SSL/TLS Certificate for CloudFront

Steps to create the SSL/TLS certificate

  1. Sign in to the AWS Management Console and open the AWS Certificate Manager(ACM) at https://us-east-1.console.aws.amazon.com/acm/home
  2. Click on Request a certificate
  3. Enter the custom domain name like tapanbk.com.np and the click on request

    Website hosting using s3 |
Request public certificate - Tapan BK

  4. Choose the certificate from the list of certificates from the AWS Certificate Manager list page
  5. Under domains, You will see the lists of domains and their CNAME name and CNAME value

    Website hosting using s3 |
ACM CNAME list - Tapan BK

  6. Copy the CNAME name and CNAME value and update the CNAME record in the domain provider.

    If your domain name is tapanbk.com.np and CNAME name is _80dd5415bbf1vffd86f45cfv3d487c54.tapanbk.com.np., in most of the cases, do not use the .tapanbk.com.np of the CNAME name, just use _80dd5415bbf1vffd86f45cfv3d487c54

    Website hosting using s3 |
ACM CNAME in domain provider - Tapan BK

  7. Wait few minutes until the certification status changes from pending validation to success
  8. In Domains section at right hand-side, click on Create records in Route53 and then choose the domain records and then Create records

    Website hosting using s3 |
Create records- Tapan BK

Step 9: Configuring CloudFront Distributions for Website Delivery

Steps to configure the cloudfront distributions

  1. Sign in to the AWS Management Console and open the CloudFront at https://us-east-1.console.aws.amazon.com/cloudfront
  2. Click on the Create cloudfront distribution
  3. Select the static site endpoint that is previously configured in the origin domain.

    Website hosting using s3 |
Select static website endpoint - Tapan BK

  4. Enter your domain name in the Alternate domain name(CNAME) field and select your certificate in the Custom SSL certificate field

    Website hosting using s3 |
Cloudfront distribution SSL certificate - Tapan BK

  5. Default root object field, type your website HTML file (index.html)
  6. Other settings can be set as default.
  7. Click on create a distribution.
  8. Go to the home page of the Cloudfront Distribution, under the domain name, copy the cloudfront domain

    Website hosting using s3 |
Cloudfront distribution  domain- Tapan BK

  9. Paste the domain in the browser. the static website should open as it opens for static website endpoint. The website should open in https

Step 10. Configuring Route53 for DNS Management

  • Sign in to the AWS Management Console and open the Route53 at https://us-east-1.console.aws.amazon.com/route53
  • Click on the Hosted zones in left side of the Route53 dashboard under Dashboard link and Click Create hosted zone on right side

    Website hosting using s3 |
Create Hosted zone - Tapan BK

  • Enter the name and the description and then click Create hosted zone to register the hosted zones

    Website hosting using s3 |
Create Hosted zone - Tapan BK

  • Select the current created hosted zone from list of hosted domain in route53
  • Click onCreate record to create the record

    Website hosting using s3 |
Route53 hosted zones records - Tapan BK

  • In the Create record page, update the record type to Route traffic to(A record) type.Turn on the alias and select Route traffic to abd select Cloudfront distribution. On An alias, select the created cloudfront distribution

    Website hosting using s3 |
Route53 alias- Tapan BK

  • Create record.
  • Update the cloudfront distribution domain name as CNAME record in the domain provider

    Website hosting using s3 |
 cloudfront distribution domain- Tapan BK

    You are ready to access the content of AWS s3 using the custom own domain.

    Final Notes

    If you happen to come directly to this link, or you want to explore the part 1, Please visit Comprehensive tutorial on hosting the static site in AWS using S3, cloudfront, Certificate Manager and Route53 - part 1


    Tapan B.K. | Full Stack Software Engineer

    Tapan B.K. is Full Stack Software Engineer. In his spare time, Tapan likes to watch movies, visit new places.