How can I assign a static IP address to my Amazon EC2 Windows instance?
Last updated: 2022-05-05
I use an Amazon Elastic Compute Cloud (Amazon EC2) Windows instance, and a private IP address is automatically assigned to the instance. Can I assign a static IP address to my Amazon EC2 Windows instance?
Static private IP addresses aren't required for Amazon EC2 Windows instances. However, you can use two private IP addresses for your Windows network adapter. To assign a static private IP address for an Amazon EC2 Windows instance, follow these steps:
Note: The network interface IP address and Windows adapter IP addresses must match for a successful network connection.
- Open the Amazon EC2 console, and then choose Instances from the navigation pane.
- Select your instance. From the Networking tab, Expand Network interfaces, and then choose the Interface ID.
- Select the Network interface ID, Choose Actions, and then choose Manage IP Addresses. The primary private IPv4 IP address is already listed.
- Expand the network interface ID, and then choose Assign new IP address.
- Do one of the following:
For Auto-assign, enter a new IP address, and then choose Save.
Don't enter a new IP address, choose Save, and then choose Confirm to auto assign the new IP address to the network interface.
Important: Note the primary private IPv4 address and the new IP address for a later step.
- Connect to your Amazon EC2 Windows instance using Remote Desktop Protocol (RDP).
- Open a command prompt window as an administrator, type ipconfig/all, and then press the enter key. Note the IP address, Subnet mask, and Default gateway.
- Open Network and Sharing Center, and then choose Change adapter settings.
- Open the context menu for the network connection, and then choose Properties.
- Select Internet Protocol Version 4 (TCP/IPv4), and then choose Properties.
- Choose Use the following IP address.
For IP address, enter the primary private IPv4 address.
For Subnet mask, enter the network mask for the subnet.
For Default gateway, enter the gateway for the subnet.
- For IP addresses, choose Add. Enter the new private IP address and subnet mask, and then choose Add.
- (Optional) Choose the DNS tab, enter a DNS server address, and then choose OK.
Note: For more information about finding your VPC DNS server settings, see Amazon DNS server. For information about reserved addresses, see Subnet sizing.
To verify that the new IP address is successfully added, open a command prompt window as an administrator and ping both private IP addresses. You can also ping both addresses from another instance in the same subnet.