Assign custom DNS name to ec2 instance.

0

Hello,

Is it possible to assign a domain name to ec2 instance. My goal is to have ec2 instances with my custom domain assigned for example: app-1.example.com For now my idea is to programmatically assign or remove domain name based on instance state.

Maybe there is a AWS service that could help me?

1개 답변
5
수락된 답변

Yes, it is possible to assign a custom domain name to your EC2 instances. One way to do this is by using Amazon Route 53, which is a DNS web service that you can use to route traffic to various AWS services, including EC2 instances.

Here are the general steps to assign a custom domain name to your EC2 instance using Route 53:

  1. First, register your domain name with a domain registrar such as Amazon Route 53, or transfer your existing domain to Route 53.
  2. Next, create a hosted zone in Route 53 that corresponds to your domain name.
  3. Create an "A" record in the hosted zone that maps your domain name to the Elastic IP address of your EC2 instance.
  4. Optionally, you can also create a "CNAME" record in the hosted zone that maps a subdomain of your domain name to the public DNS name of your EC2 instance.
  5. Associate the hosted zone with your domain name at the domain registrar.

To programmatically assign or remove the domain name based on the instance state, you can use AWS Lambda and AWS CloudWatch Events. You can create a Lambda function that listens to the EC2 instance state change events using CloudWatch Events, and then programmatically update or delete the Route 53 record sets accordingly.

profile picture
전문가
답변함 일 년 전
profile picture
전문가
검토됨 2일 전
profile pictureAWS
전문가
검토됨 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠