Step 4: Assign an Elastic IP Address to Your Instance
In the previous step, you launched your instance into a public subnet — a subnet that has a route to an Internet gateway. However, the instance in your subnet also needs a public IP address to be able to communicate with the Internet. By default, an instance in a nondefault VPC is not assigned a public IP address. In this step, you'll allocate an Elastic IP address to your account, and then associate it with your instance. For more information about Elastic IP addresses, see Elastic IP Addresses.
The following diagram represents the architecture of your VPC after you've completed this step.
To allocate and assign an Elastic IP address
Open the Amazon VPC console at https://console.aws.amazon.com/vpc/.
In the navigation pane, choose Elastic IPs.
Choose Allocate New Address, and then Yes, Allocate.
If your account supports EC2-Classic, first select EC2-VPC from the Network platform list.
Select the Elastic IP address from the list, choose Actions, and then choose Associate Address.
In the dialog box, choose Instance from the Associate with list, and then select your instance from the Instance list. Choose Yes, Associate when you're done.
Your instance is now accessible from the Internet. You can connect to your instance through its Elastic IP address using SSH or Remote Desktop from your home network. For more information about how to connect to a Linux instance, see Connecting to Your Linux Instance in the Amazon EC2 User Guide for Linux Instances. For more information about how to connect to a Windows instance, see Connect to Your Windows Instance Using RDP in the Amazon EC2 User Guide for Microsoft Windows Instances.
This completes the exercise; you can choose to continue using your instance in your VPC, or if you do not need the instance, you can terminate it and release its Elastic IP address to avoid incurring charges for them. You can also delete your VPC — note that you are not charged for the VPC and VPC components created in this exercise (such as the subnets and route tables).