What is AWS NAT Gateway and How To Create AWS NAT Gateway??-DecodingDevOps
What is AWS NAT Gateway
NAT Gateway is used for “Network Address Translation”. For the secured application, you want your EC2 instance to be in a private subnet. But connect it to the internet (for security patches, updates, etc.) but you don’t want the internet to initiate the connection. That’s where the AWS NAT gateway comes into the picture. in the following steps i will explain what is aws nat gateway and how to create aws nat gateway step by step.
Few Points to Note while Creating AWS Nat Gateway:
- You will be charged for creating & using NAT gateway
- You will be charged for the data transfer from EC2
- It doesn’t allow IP6 traffic
- Each NAT gateway is implemented with redundancy
- Quota limit for NAT gateway is 5
How To Create AWS NAT Gateway
- Select the public subnet where your gateway can reside.
- Must specify ELASTIC IP to associate with NAT gateway
- After creating NAT gateway update the routes in the private subnet
The following diagram illustrates the architecture of the NAT gateway.
Creating A AWS NAT Gateway:
- To Create a AWS NAT gateway you need a Elastic IP address that is currently not associated with Network Interface.
- Open VPC Console. https://console.aws.amazon.com/vpc/
- In the navigation pane, select NAT Gateway -> Create NAT gateway
- Choose the subnet in which you want to create NAT gateway.
-
- Choose the Elastic IP
- Choose Create NAT gateway
- NAT gateway is creating. The status will be pending. Wait for some time till its ready to use and the status changes to Ready.
Update the Route Tables:
- Open VPC Console.
- In the navigation pane, select Route Tables
- Select the route table associated with the private subnet
- Choose Routes (In the bottom window) -> Edit
-
- Choose Add Another Rule ,
-
-
- Destination -> 0.0.0.0/0
- Target -> ID of the NAT instance
-
Choose Save
Testing Internet Gateway:
After creating the internet gateway you can connect any instance from that private subnet to connect to the internet.
Note: You can not initialize the connection from the internet.
Cleaning Up:
You can delete NAT gateway from the vpc console -> NAT gateway.
But the entry will remain in the console for about an hour.
- In the navigation pane, select NAT Gateway
- Select a NAT Gateway -> Actions -> Delete a NAT Gateway
Rules & Limitations:
- Supports 5 Gbps of bandwidth, automatically scale to 45 Gbps
- If requires more, you can split resources into multiple subnets
- Associate NAT gateway with only one Elastic IP
- Can not disassociate IP once its created
- Supports:
- Protocol: TCP, UDP, ICMP.
- Connection: 55,000 simultaneous connections
- Can not Associate Security Group with NAT gateway
- You can use NACL to control traffic from the subnet
- Can not be accessed by ClassicLink connection