Last active
May 3, 2021 19:28
-
-
Save plasticbrain/49b07885914129150f16 to your computer and use it in GitHub Desktop.
AWS - EC2 - Assign Multiple IPs to the Same Instance
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
| 1. Assign a secondary private ip to the instance | |
| - Select the instance, then choose Actions > Mange Private IP Addresses | |
| - In the Manage Private IP Addresses dialog box, Click "Assign new IP" | |
| - Enter a specific IP address that's within the subnet range for the instance (or just leave the field blank to have it choose one for you) | |
| - (Optional) Select Allow reassignment to allow the secondary private IP address to be reassigned if it is already assigned to another network interface. | |
| - Click Yes, Update, and then click Close. | |
| 2. Add the new IP to the instance's network interface. | |
| - SSH into the instance | |
| - $ sudo ip addr add new.ip.address.here/20 dev eth0 | |
| - Test to make sure the ip is listed: | |
| - $ ip addr list dev eth0 | |
| Note: If you ever need to remove the new IP use: | |
| $ sudo ip addr del new.ip.address.here/20 dev eth0 | |
| 3. Assign an Elastic IP to your new private IP | |
| - In the AWS Console, choose "Elastic IPs" | |
| - Select an available IP and choose "Associate Address" | |
| - Choose the instance, and *importantly*, in the Private IP section, be sure to select the NEW private ip you just created. | |
| Click "Associate" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment