AWS CLI Elastic IP, IPv6
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:
#!/bin/bash
EIP=52.212.151.17
INSTANCE_ID=i-0bdd8a68eb573fd1a
/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?
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.