AWS EC2 add more Public IP - amazon-ec2

My EC2 has 1 Elastic IP but I need to add second elastic IP.
I try to create a new Network interface then add second elastic IP to it, after reboot I receive a new interface with private IP but I can't SSH to the server by new Public IP.

You probably need to assign second private IP to new network interface.
Try this and change secondary_private_ip with its new private IP.
sudo ip addr secondary_private_ip/20 dev eth0

Related

How to access a public ip enabled instance from a another instance where only private ip is available

I have two instances in AWS where we have public ip and private ip for one instance and the other instance has only private ip.
Both are in the same VPC and same subnet. However I’m not able to access/ping the public ip from the instance 2. I can ping/access it using private ip. But how can we achieve it using public ip.
I have tried using the icmp rules in the security group but still not accessible.

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

Unable to ssh into private subnet using Elastic IP

I have setup a VPC with 2 subnets. One of them is public other one is private.
I am able to ssh from an instance in public subnet to an instance in private subnet using the private IP address of machine. However, if I use the elastic IP address of private instance, the connection times out.
For example, lets call EC2 instance in public subnet as "PUB" and instance in private subnet as PRV.
PRV has Elastic IP say "EIP" and private address, say PRV_IP.
When I ssh from public instance to private one using the private IP address, connection is successful, however if I use private IP, connection fails.
That is,
ssh -i private_key ec2-user#EIP (succeeds).
ssh -i private_key ec2-user#PRV_IP (fails, connection timesout).
Can someone explain me why connection is failing with elastic IP?
As you have seen, attaching Elastic IPs to an instance in private subnet is a worthless exercise. This happens because each subnet can have exactly one default route and that will either point to the igw object (public subnet) or the NAT instance/gateway(private subnet).
If you are binding an elastic IP to a machine in the private subnet, the inbound traffic would arrive at the instance, but the outbound reply traffic would be routed back through the NAT instance, which would discard it.
That's why when you are trying to do SSH, your client machine is able to send a request to the instance but the instance is not returning back the response, hence the timeout.

change public dns in ec2 to private DNS

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

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

Resources