AWS CLI Elastic IP, IPv6

Thiago Souza asked:

I have two AWS instances working in high availability. (I’m using keepalived)

I have an Elastic IP associated, everything was a fine.

I used this script so to change the instance IP in case o failover:



/usr/bin/aws ec2 disassociate-address --public-ip $EIP
/usr/bin/aws ec2 associate-address --public-ip $EIP --instance-id  $INSTANCE_ID

But now my server has an ipv4 and ipv6. And i cannot do the same for ipv6. Only ipv4.

How can i do the same for ipv6? Since there is no Elastic ipv6?

My answer:

IPv6 addressing is different than IPv4 is usually managed. IPv6 is managed by subnet, not by individual address as in IPv4 today.

So in Amazon AWS, you need to first assign an IPv6 CIDR block to your VPC. Then you can assign individual IPv6 addresses to your instances. See Amazon’s guides for getting started with IPv6 and understanding IP addressing.

By default your instances will obtain IPv6 addresses automatically. If you don’t want this, you can assign a specific IPv6 address to it. But unlike IPv4, with IPv6 you assign addresses to the network interface of the instance, not to the instance.

Use aws ec2 assign-ipv6-addresses to assign IPv6 addresses to your instances’ network interfaces.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.