How can I associate a static public IP address with my EC2 Windows or Linux instance or network interface?

2 minute read

The auto-assigned public IP address associated with my Amazon Elastic Compute Cloud (Amazon EC2) instance changes every time I stop and start the instance.

Short description

An Elastic IP address is a static public IPv4 address associated with your AWS account in a specific Region. Unlike an auto-assigned public IP address, an Elastic IP address is preserved after you stop and start your instance in a virtual private cloud (VPC).

You can use these tools to associate an Elastic IP address with your EC2 instance:

  • The Amazon EC2 console
  • The AWS Command Line Interface (AWS CLI)
  • AWS Tools for Windows PowerShell

Note: If you receive errors when you run AWS CLI commands, see Troubleshoot AWS CLI errors. Also, make sure that you're using the most recent AWS CLI version.

Static IP addresses have these limitations:

  • You can't use an auto-assigned public IP address to retain or reserve the current public IP address assigned to the instance.
  • You can't convert an auto-assigned public IP address to an Elastic IP address.

Note: The default quota for Elastic IP addresses is 5 per Region per AWS account. For more information about quotas and how to request an increase, see Elastic IP address quota.


To allocate and associate an Elastic IP address with your EC2 Windows or Linux instance or network interface, follow these steps:

  1. Allocate an Elastic IP address from either Amazon's pool of public IPv4 addresses or bring your own IP addresses (BYOIP) to your AWS account.
  2. Associate the Elastic IP address with an instance or network interface.

You can also disassociate an Elastic IP address, and then re-associate it with a different instance.

Related information

How can I assign a static IP address to my Amazon EC2 Windows instance?

Elastic IP addresses

Amazon EC2 instance IP addressing

Stop and start your instance

AWS OFFICIALUpdated 9 months ago