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?

demandé il y a un an316 vues
1 réponse
5
Réponse acceptée

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
EXPERT
répondu il y a un an
profile picture
EXPERT
vérifié il y a 2 jours
profile pictureAWS
EXPERT
vérifié il y a un an

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions