Assigning a fixed IP address to an EC2 instance
Amazon, being the kind-hearted souls that they are allow you five static/fixed IP addresses completely free. Gratis. No charge. Nada. This is handy if, like me, you often play with EC2 isntances but only power them up when you need them, but still want to reference them at the same address each time.
Normally, AWS assigns a new public DNS and private IP/DNS to each instance meaning it can be hard to reference a particular machine externally (think config files or even RDP stored credentials). Luckily, Amazon have made it trivially easy to get a fixed IP address
To allocate a new IP address to an already running EC2 instance, perform the following steps:
- Log in to your AWS account and go to the EC2 services panel
- Under network & security select Elastic IPs
- Click Allocate New Address in the command bar
- Select EC2 from the drop down in the resultant popup box
- Right-click on the new IP address and click associate (alternatively you can use the Associate Address button in the command bar
- Select your EC2 instance in the resultant popup and click Yes, Associate
You can now refer to that instance using a fixed IP address and not have to worry about its public DNS or private IP address changing.
It’s worth noting that these addresses are free only when they are assigned to an instance. When they’re not, you will get charged a small amount, but their usefulness far outweighs the costs IMO. When you’re done with the IP, disassciate the IP address from the instance, then click the Release address button in the command bar