The public IP address of a running EC2 instance, as it is, is reallocate each time you stop or restart the instance. In order to have a persistent public IP address you have to use Elastic IPs.
- Open the AWS EC2 Management Console
- Under Network & Security, click Elastic IPs
- Click Allocate New Address: this will allocate a static IP address
- Go back to the Elastic IPs table, select the new address, and under the menu Actions choose Associate address
- Select the desired EC2 instance from the drop down, as well as the private IP address, and click Associate
- Now the new static IP address is associate with your EC2 instance, and it will not change upon stopping or restarting of your instance