In the previous article, we have created a VPC and two subnets. We have created one public and one private subnet. However, your public subnet will not be able to route traffic to and from the Internet until you attach an Internet Gateway manually with your custom created VPC. In this article, we will explore how to create and use an Internet Gateway with AWS VPC.
- Also read: Creating and managing AWS VPC
An Internet gateway is an exit point for the internal EC2 instances and the entry point for the outside public users. In AWS Cloud, you can logically consider an Internet Gateway as a Router that distinguishes the public and private network. Each public subnet requires an Internet gateway to provide services to public users and access the services from the Internet.
Please visit the following link to know more about the AWS Internet Gateways.
Typically, when you create a VPC, an Internet Gateway is also created by default. If you wish to add additional or different internet gateway, which typically should not be required, you can do it. For this, you need to perform the following steps:
- Select the Internet Gateways option in the left pane.
- Click the Create Internet Gateway option and specify the name of Gateway.
- Click the Yes, Create button to complete the task.
- In the Internet Gateways list, select the created IGW, and then click the Attach to VPC option.
- In the Attach to VPC window, select the VPC that you want to attach with this IGW and then click Yes, Attach as shown in the following figure.
That’s all you need to create and attach the Internet Gateways for AWS VPC. An Internet gateway can only be attached to a single VPC. However, a single Internet Gateway can be attached to the multiple subnets (routing tables) inside a single VPC.
- Also read: How to create and manage AWS NAT gateways
Hope, this helped you, we always would like to hear your views and suggestions in the comment box.