Introduction
Sometimes, we want to have a static IP address assigned to our EC2 instance. That way, when we manually stop and start our EC2 instance we do not have to log into WHM and update all of our configurations to the new IP address.
Procedure
To allocate a static IP address to the EC2 instance, we need to first allocate an IP address to the account. To do this we will need to log into our AWS console and go to EC2.
From there, we will follow these steps:
- From the EC2 page, click on Network & Security >> Elastic IPs
- Click on Allocate Elastic IP Address
- Update the Network Border Group to the Region that your EC2 instance is located in and click Allocate
Now that we have an Elastic IP address allocated to the account, let's go through and assign it to our EC2 instance using these steps:
- Click on the checkbox for the new IP address
- Click on Actions >> Associate Elastic IP address
- On the next page, search for your EC2 instance that you want to assign the IP address too
- Select the IP address and click Associate
- Go to EC2 >> Instances and click on the refresh Icon and the IP address should reflect your newly associated IP address.
We recommend doing these steps before installing cPanel, however, if cPanel is already installed the you will need to update the IP address in WHM using the IP Migration Wizard. Some more information can be located in How do I move sites on the shared IP to a new Shared IP?