EC2 instances will not support elastic IP

So, I don’t understand what is going on here ... I have (3) Micro EC2 instances that start up (without elastic ip)

Then go to Network Security->Elastic IPsand click on the associated IP address. I chose an instance of EC2, which then uses elastic ip.

If I am stop, then startthis is the MOST instance of ec2, it does not have the same old elastic IP address and instead is a completely new IP address. These are corrupted scripts, which then depend on the previously connected elastic ip with the EC2 instance.

Why is this happening and why can't I get any of (3) instances to accept and save this assigned elastic ip?

+4
source share
3 answers

Elastic IP addresses become dissociated with EC2 instances (in EC2-Classic) when you stop them. You will need to relink them again at startup, which can be done through the API (through AssociateAddress ), the CLI (through ec2-associate-address ), or through the AWS console .

Here's what Elastic IP says about this:

When you associate an EIP with an instance, the current instance public IP address is issued to the public IP address of the EC2-Classic pool. If you disconnect EIP from the instance, the instance automatically assigns a new public IP address within minutes. In addition, stopping the instance also disconnects the EIP from it.

, dev ( ) IP script , , IP.

+3

VPC, 3 VPC, EIP /. EC2 EIP; VPC.

+6

If you are ready to pay for a NAT gateway (per hour of charge + for each processed GB traffic), you can create a NAT gateway to connect Elastic IP to your private VPC subnet (you need to create a route for the subnet, specify nat-gateway and change your default route on igw-id).

Any restart of the EC2 instance will affect Elastic IP afterwards.

0
source

Source: https://habr.com/ru/post/1525654/


All Articles