change public dns in ec2 to private DNS - amazon-ec2

I created an instance in Amazon ec2 and deployed. Now I am able to access my applications using the public dns. My default public dns is like ec2****compute-1.amazonaws.com. How can I change this to some Other Public Dns.

Get an elastic IP address from amazon
assign the elastic IP address to your instance through the aws management interface
Point your domain to your elastic IP address using your registrar's DNS tools
look this..http://aws.amazon.com/ec2/pricing/ and https://forums.aws.amazon.com/message.jspa?messageID=289265

Related

How to put public IP address directly on EC2 Instance network card

When I create a machine on Amazon AWS it always comes with Public and Private IP.
I need to have the public IP directly on the server's network card.
It's possible?
I don't think this is possible. What AWS does, is a mapping from public IP address to the primary private IP address using network address translation (NAT). They actually don't assign a public IP address to EC2 instances.
More info AWS Doc

How to prevent EC2 instances from changing public IP addresses when restarted?

I accidentally enabled firewall in my Ec2 instance which blocked me from SSHing --> Then, I used this answer to https://stackoverflow.com/a/50999373/3705478 gain access to my Ec2 instance, but my public Ip address changed. --> This caused me to update my Ip address with Domain registrar as it is a web server facing public. Also I have to change the ip address of the DB running Ec2 instances.
How can I prevent my public Ip address changing under such situations in Amazon EC2?
See the aws documentation for allocating a static ip here https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html#using-instance-addressing-eips-allocating

Change public IP address of EC2 instance to Elastic IP Address

Is it possible to assign Elastic IP Address to my instance without changing the public IP address?, i need to Transforms my public IP address to be Elastic IP Address
Yes. It is possible. You can access your instance with Both Elastic IP as well as Public IP Address. But remember when your EC2 instance restart at that time its public IP may get change so people preferring to use Elastic IP Address.
Hope this Helps !
Using Elastic Network Interfaces it is possible if you started the instance in a VPC. You can assign the Elastic IP to an Elastic Network Interface which you can then attach to the EC2 instance. EC2 instances in VPC can have multiple ENI. If you assign an EIP directly to the EC2 instance (classic or VPC) then the public IP changes to the EIP.
When you associate an EIP with an instance, the instance's current
public IP address is released to the EC2-Classic public IP address
pool. If you disassociate an EIP from the instance, the instance is
automatically assigned a new public IP address within a few minutes.
In addition, stopping the instance also disassociates the EIP from it.
from: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html

Connection to amazon-ec2 VPC instance fails

I have the following setup:
- a VPC, with several subnets, and an access gateway and a NAT instance having public addresses that I can connect to,
- I create a Linux instance in a subnet of the VPC, that has NO public IP address or DNS name (I want that only the Load Balancer be known on the internet).
I want to connect to my Linux instance to install and configure software.
How do you connect to that instance? All the documentation I have seen mentions that you connect using "ec2-user#".
Since I have no public DNS, i have tried to connect from the access gateway via putty with the private DNS of my linux instance but it fails ("host does not exist").
I am obviously missing something ... in the NAT?
Thanks, Laurent
You need to have a hosts in the public subnet which you can access. Once you access this host, then you can connect to your other hosts in VPC using their private IP address.
Your instance in question has only private IP address so connecting it from your workstation is not going to work.
The host I am referring to is usually called Bastion Host. read the Tip in Scenario 2: VPC with Public and Private Subnets documentation.
Also, read first few results of this Google Search to gain overall understanding on use-cases for Bastion hosts.

Are EIP's required for internet traffic?

Sorry if this is a dumb question but I can't find any definitive answers. I setup a VPC with a private subnet and a public subnet. THe private subnet has a NAT'd instance to route for internet traffic. The public subnet is configured to go out of the IGW.
-I created a Bastion host to login into SSH
-I created Test instance on private subnet and connect from Bastion Host. Because of the route to the NAT instance and port 80/443 is allowed and ICMP, i can ping and access files on the internet.
-I create instance on public subnet without EIP. Since it has a route to the IGW, shouldn't I have internet access? I created a test security group to allow all traffic from all sources and i still can't ping or get http links.
A public subnet instance with a public DNS name should be accessible over the internet provided you have right VPC security group configured. You do not need an EIP.
Public DNS name of EC2 instance changes when you stop and start the instance. to avoid this, you can assign an EIP to the instance so that the IP address remains same across the instance stop/start cycles.
You need to answer these questions:
Does your public subnet instance has a public DNS hostname? Run curl -s http://169.254.169.254/latest/meta-data/public-hostname on your instance to see the public DNS hostname.
Do you have VPC security group configured properly to allow incoming internet access ?

Resources