I tried creating dev and stg environments from existing main domain and route traffic to respective cloudfront

I tried creating dev and stg environments from existing main domain and route traffic to respective cloudfront

Clock Icon2023.06.13

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

Introduction

Hemanth of Alliance Department here. In this blog, I tried creating dev and stg environments from existing main domain and route traffic to respective cloudfront.

For a deploying a simple application using Cloudfront refer to the below blog. As this would be required going forward in this blog, as a cloudfront distribution is required.

Refer the below blog on how to register domain in aws and route it's traffic to cloudfront

Route53

AWS Route 53 service empowers you to carry out the following three tasks such as domain registration, DNS routing, and health checking. Route 53 is used to redirect internet traffic to your resources, create a domain name for your website or web application, and verify the functionality and accessibility of your resources. User queries are routed through Route 53, a highly available and scalable Domain Name System (DNS) web service, to internet apps that are running on AWS or locally.

Cloudfront

AWS CloudFront is a content delivery network (CDN) service that aids in the speedy and dependable distribution of static and dynamic information with high performance, security, and developer friendliness. It distributes your content over a global network of edge sites, or data centers that are close to your users. Using serverless compute features, you can also alter the code that is executed at the AWS CDN edge.

Demo

Go to AWS Certificate Manager of N.Virginia region and in request certificate click on next As we are going to create sub domains, give the fully qualified domain as follows "*.domainname" Keep other settings as default and click on request Now click on create records in route 53 in the domain section of the above created certificate Go to the cloudfront that will route traffic from dev subdomain, in the settings section click on edit Type down you alternate domain name and select the above created certificate Keep all the other settings as default and click on save changes Follow the same procedure for stg subdomain, in the settings section click on edit Type down you alternate domain name and select the above created certificate Keep all the other settings as default and click on save changes Go to hosted zone in route 53 which is associated your main domain and click on create record Give record name as dev, toggle alias and select the alias to cloudfront distribution and choose your distribution associated to dev and click on create records follow the same procedure for stg as well, in your hosted zone of in route 53 and click on create record Give record name as stg, toggle alias and select the alias to cloudfront distribution and choose your distribution associated to stg and click on create records
Accessing the dev environment Accessing the stg environment

Conclusion

Hope with this you get an idea of how to create dev and stg environments from existing main domain and route traffic to respective cloudfront. Thank you for seeing the blog till the end.

Share this article

facebook logohatena logotwitter logo

© Classmethod, Inc. All rights reserved.