Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (790 points)
How can I assign a public DNS to an EC2 instance?

3 Answers

0 votes
by (1.4k points)

There are 2 ways to do the same :

METHOD-1

While launching the instance,

1) Go to Configure instance 

2) You will see 'Auto-assign Public IP' with a drop-down menu

3) Choose Enable and launch the instance

METHOD 2

1) Login to https://console.aws.amazon.com/console

2) Click on Services and choose VPC

3) Go to Your VPCs and select the VPC connected to your instance

4) Click on Actions and you will get a drop-down menu

5) Choose: Edit DNS Hostnames

6) Change the option to YES

0 votes
by (2.9k points)

In order to assign a public DNS to a EC2 instance, the very first thing that we need to make sure is that the EC2 instance has public address assigned to it.

Now in order to do the same, visit your EC2 dashboard, and click on Launch instance, then choose the image type and instance. After this configure the instance, by selecting the correct VPC, make sure your are enabling auto-assign public IP. And then launch your instance. Once launched, you can go to your instance and in the description option check the public DNS

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
by (2.6k points)

To assign a public DNS to an EC2 instance:

  1. Enable Auto-assign Public IP:

  • Go to the subnet section of the instance in the VPC and tick the box “Auto-assign Public IPv4 Address”.

  1. Elastic IP (Static Public IP):

  • Get an Elastic IP for your Amazon EC2 dashboard.

  • Link it to your instance example.

  • The public DNS will automatically correct itself to recognize the Elastic IP.

That is why, Public DNS depends directly on the instance Public IP.

Related questions

0 votes
2 answers
asked Jul 10, 2019 in AWS by yuvraj (19.1k points)
Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer

1.4k questions

32.9k answers

507 comments

693 users

...