Hello. This is Komiya.
A while ago, there was a demand to move VIP (Virtual IP address) on the AWS VPC, so I verified it.
I was just taking notes personally, and I had a few opportunities to be asked questions, so I'll post it briefly.
When handling some cluster configuration on a VPC, if you need to change the PrivateIP address in the VPC,
Since it is AWS, if you don't modify the switching script to use the API, you won't get a response to a PING from the outside, let alone internally.
In other words, the VIP will not have moved.
In other words, it looks like the following
When dropping, drop the IF and also run the CLI
[shell]ifconfig eth0:1 down ec2-unassign-private-addresses --network-interface eni-4b649*** --secondary-private-ip-address 10.0.0.96[/shell] ※ A shortened version of ec2-unassign-private-addresses is ec2upip
When starting, also launch IF and run CLI
[shell]ifconfig eth0:1 up ec2-assign-private-ip-addresses --network-interface eni-70609*** --secondary-private-ip-address 10.0.0.96[/shell] ※ A shortened version of ec2-assign-private-ip-addresses is ec2apip
Switched from ENI: eni-4b649***
Switching destination ENI: eni-70609***
Reference:
Granting multiple EIPs to EC2 instances in a VPC ec2-assign-private-ip-addresses - Amazon Elastic Compute Cloudec2-unassign-private-ip-addresses - Amazon Elastic Compute Cloud
If you want to detach or attach the ENI to which the EIP is attached, it looks like this. (Maybe (I haven't tried it myself))
[shell]ec2-detach-network-interface ${eni_attach_id} ec2-attach-network-interface ${ENI_ID} --instance ${target_instance_id} --device-index ${TARGET_DEVICE_INDEX}[/ shell]
In addition, it seems that it would be good to ifup and do IP route processing.
[shell]ifconfig eth${TARGET_DEVICE_INDEX} up
ip rule delete table 100 ip rule add from ${VIP_ADDRESS} table 100 prio 200 ip route add dev eth${TARGET_DEVICE_INDEX} src ${VIP_ADDRESS} table 100[/shell]
When preparing a switchover script, it seems that it is necessary to define ENI, InstanceID, VIP, device name, etc., and then check whether it is attached.
As an aside, it seems that there are the following restrictions for each instance type. I couldn't attach it if the Private IP was above the limit on ENI.
---------------
・High-MEM Quadruple Extra Large (8 ENI pieces) × (30 IP) = 240 pieces
・High-MEM Double Extra Large (4 ENI pieces) × (30 pieces of IP) = 120 pieces
・High-MEM Extra Large (4 ENI pieces) × (15 IP) = 60 pieces
・Extra Large (4 ENI pieces) × (15 IPs) = 60 pieces
・Large (3 ENI sheets) × (10 IP) = 30 pcs
・Medium (2 ENI pieces) × (6 IPs) = 12 pieces
・Small (2 ENI) × (4 IP) = 8
・Micro (2 ENI sheets) × (2 IP) = 4 pieces
・High-CPU Extra Large (4 ENI pieces) × (15 IP) = 60 pieces
・High-CPU Medium (2 ENIs) × (6 IPs) = 12
---------------
http://ec2info.s3-website-us-west-2.amazonaws.com/
Reference:
Pointing two NICs to the same subnet, or source routing - Note: Testing redundancy configurations using HeartBeat and Elastic IP - Serverworks Engineer Blog "Corosync & Pacemaker" with automatic failover in EC2 (VPC) "Public Switch between "IP" and "Private IP" at the same time
Thank you for watching the above.