Getting ready

We need an AWS account and user with proper permissions for creating a NAT instance on EC2. Create an EC2 in the same way as the previous recipe. The only difference is, you don't put any Advanced Details in the Choose Network page. In the security group page, create NATSG security group and attach the same with instance with the following rules. We are allowing all traffic for simplicity. However, you should only put the required CIDR ranges. 

NATSG: Rules

Inbound

Type

Protocol

Port range

Source

HTTP

TCP

80

0.0.0.0/0 and ::/0

HTTPS

TCP

443

0.0.0.0/0 and ::/0

SSL

TCP

22

0.0.0.0/0 and ::/0

Outbound

Destination

Protocol

Port range

Comments

All traffic

TCP

ALL

Get AWS Networking Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.