-
-
Save hatan4ik/4da913b347cf8731813bec3aafb58b4c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| VIP=$1 | |
| IF=$2 | |
| # Determine the interface's MAC address | |
| MAC=`ip link show $IF | awk '/ether/ {print $2}'` | |
| # Determine ENI ID of the interface | |
| ENI_ID=`curl http://169.254.169.254/latest/meta-data/network/interfaces/macs/$MAC/interface-id` | |
| # Set the current region as default | |
| export AWS_DEFAULT_REGION=`curl http://169.254.169.254/latest/meta-data/placement/availability-zone | rev | cut -c 2- | rev` | |
| aws ec2 assign-private-ip-addresses\ | |
| --network-interface-id $ENI_ID\ | |
| --private-ip-addresses $VIP\ | |
| --allow-reassignment |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment