To assign a static IP address for a VPC machine, you can either boot the machine directly with the desired IP address or you can add a secondary static IP address to the node. The second option allows you to quickly re-assign the ip address to another machine

 

1. Assign the secondary IP address to the network interface

Locate the network interface of your instance and select the “Manage private IP addresses” option. Assign the new IP address to the machine (in this case 10.4.2.101)

Screen Shot 2015-04-28 at 16.44.11

 

2. Create an alias on the hosts network interface

To tell the host it should process requests for said IP address, we need to add an alias to the eth0 interface

$ ifconfig eth0:1 10.4.2.101 netmask 255.255.255.0 up

 

3. Persist on reboot

Depending on your linux distribution, you will need to configure it to automatically add the alias on boot. We use CentOS 6.5

$ vi /etc/sysconfig/network-scripts/ifcfg-eth0:1
DEVICE="eth0:1"
BOOTPROTO="none"
IPADDR="10.4.2.101"
NETMASK="255.255.255.0"
MTU="1500"
ONBOOT="yes"
TYPE="Ethernet"

 

Enjoy!