AWS

How to Create VPC NAT Gateway in AWS

Create VPC NAT Gateway, NAT Gateway is a high-availability AWS manageable service that makes it easily to connect to the Internet from instances inside a private subnet in an Amazon (VPC) Virtual Private Cloud. Previous, you needed to launch a NAT instance to enable NAT for instances in a private subnet.

Create VPC NAT Gateway in AWS

To know about NAT Gateway please visit AWS

How to Create VPC

1- Log in with AWS account and select AWS Services tab and then select VPC under Networking & Content Delivery.

aws management console services

2- Virtual Private Cloud – select Your VPCs
Select Create VPC.

aws create vpc

3- Create VPC wizard,
Name tag – My-VPC
IPv4 CIDR block – 10.0.0.0/16.
Tenancy – default
Click Create.

aws create vpc-

4- Click Close.

the following vpc was created

5- Now you can see two VPC created.

your vpcs

How to Create Subnet in AWS

1st Subnet

1- Select Subnets and then select Create Subnet.

subnets aws

2- Name tag – PublicSubnet.
VPC – Select the VPC (My-VPC) that you created earlier.
Availability Zone – Select Availability zone.
IPv4 CIDR block – type a valid CIDR block. (For example – 10.0.0.0/24)
Click Create.

create subnet aws

3- Click Close.

following subnets successfully created

4- Subnet successfully created

2nd Subnet

Select Create Subnet

subnet amazon management console

5- Name tag – PrivateSubnet.
VPC – select the VPC (My-VPC) that you created earlier.
Availability Zone – Select Availability zone.
IPv4 CIDR block – Type a valid CIDR block. (For example – 10.0.2.0/24)
Click Create.

create subnet aws

6- Click Close.

following subnets successfully created

7- Subnet successfully created.

create subnet aws

Create Internet Gateway

1- Select Internet Gateways new and then click Create Internet Gateway.

aws create internet gateway

2- Enter a name in the Name tag text box and then click create internet gateway.

aws create internet gateway name

3- Internet gateway successfully created and in a detached state. Now we need to attach it to your VPC.

Choose Attach to a VPC button, or in the action menu select Attach to VPC.

aws internet gateway detached

4- Select your VPC (My-VPC) from the drop-down list and then click Attach internet gateway.

attach internet gateway

5- The internet gateway changes to attached state.

internet gateway status attached

Create VPC NAT Gateway in AWS

Create a Route Table

1st Route Table

1- Select Route Tables.
Click on Create route table.

create route table

2- Name tag – Type a name for your route table (Public-Route)
VPC – Select your VPC (My-VPC), and then select Create.

create route table name

3- Click Close.

route table was created

4- Route Table successfully created.

2nd route table

Click Create route table

create route table

5- Name tag – Type a name for your route table (Private-Route)
VPC – Select your VPC (My-VPC), and then select Create.

create route table name

6- Click Close.

route table was created

7- Subnet successfully created.

create route table

Routing of Public Subnets

Now you need to configure the routing for our public subnets. Enable traffic from the public subnets to Internet by utilize the internet gateway attached to the VPC.

Public-Route

1- Select Public-Route, select Subnet Associations, and then click on Edit Subnet associations.

edit subnet associations

2- Select your first public subnet (PublicSubnet) from the list and navigate to its Summary section and then click Save.

edit subnet associations save

3- Select Routes tab and then click Edit routes.

edit routes aws

4- Now the traffic from instances in the public subnets intended to the Internet shell be redirected to the Internet Gateway.

Then you redirected to the Route Table in the Virtual Private Cloud.
Add route for the Route Table – one for the traffic to the Internet to be routed using the Internet Gateway.
Click Add rules for destination type 0.0.0.0/0 (all packets for the internet) and for targets select the Internet Gateway.

edit routes target aws

5- Select (VPC-IGW) have created as in the earliest and then click save routes.

edit routes target aws save

6- Click close.

route successfully edited

Private-Route

7- Select Private-Route, select Subnet Associations, and then click on Edit subnet associations.

edit subnet associations

8- Select PrivateSubnet and then click save.

edit subnet associations save

9- Successfully edit routes.

create route table aws

Create Instance

1st EC2 Instance

1- Choose service tab and then click on EC2 under compute.

aws management console

2- Select instance on your left side and then click on Launch Instance button.

aws launch instance

3- Select Microsoft Windows Server 2019.

aws instance choose ami

4- Choose the type of instance you require based on your requirements.
Click Next : Configure Instance Details.

aws choose instance type

5- Network – select VPC (My-VPC).
Subnets – select PublicSubnet.
Auto Assign Public IP – select Enable.
Click on Next : Add Storage.

aws configure instance details

6- Click Next : Add Tags.

aws add storage

7- Here we have tagged the instance (Public Instance)
Click on Next : Configure Security Groups

aws add tag

8- Create a new Security Group.
Security group name – VPC-Securit
Choose Protocols RDP, HTTP, HTTPS and then Select Source Anywhere
Click on Review and then Launch.

aws configure security group

9- Review instance details, parameters and then click launch.

aws review instance launch

10- Select Create a new key pair
Type a name to your key (Private-key)
Click download key pair and save it in your secured folder

aws key pair name

11- After downloading key pair and saving your key, click launch instance.

aws key pair name

12- Click view instances.

aws launch status

2nd EC2 instance

Network – My-VPC
Subnet – PrivateSubnet
Auto-assign Public IP – Disable

aws configure instance details

14- Tow Instance created.

aws instance connect

How to login with AWS Instance

1- Select Public Instance and then click connect.

aws instance connect

2- Select Get Password.

get password aws

3- Select choose file and select your key pair and then click decrypt password.

get password aws

4- Copy password and click on download remote desktop file.

get password aws

5- Successfully login with Public Instance.

ec2 instance desktop

6- Search remote desktop connection and then select it.

windows server search bar

7- Go back to your instances and choose Private Instance
Copy Private IP.

aws connect instance

8- Paste in remote desktop connection and then click connect.

remote desktop connection

9- Inter your private instance credential and then click ok.

enter your credentials

10- Private Instance server desktop.

ec2 instance desktop

Test the internet is working.

Type pint 8.8.8.8 and hit enter.

command prompt

How to Create a NAT Gateway

1- Go back to your VPCs and select NAT Gateways.

create vpc

2- Select Create NAT Gateway.

create nat gateway aws

3- Select PublicSubnet.

create nat gateway and assign

4- Click on Allocate Elastic IP address.

create nat gateway and assign it

5- Elastic IP Allocation ID created click on Create a NAT Gateway.

create a nat gateway

6- Click Close.

nat gateway has been created

7- NAT Gateway is in pending status.

nat gateway status pending

8- Select Route Tables
Select Private-Route
Select routes tab and then click on Edit routes.

edit routes aws

9- Click Add route and type 0.0.0.0/0
Under target from drop-down menu select NAT Gateway.

edit routes target aws

10- Select newly create NAT Gateway and then click save routes.

edit routes target aws save

11- Click Close.

route successfully edited

12- Route table successfully edited.

edit routes aws

14- Now NAT Gateway is in available status.

create nat gateway

Go back your private instance and you can see it start pinging.

command prompt

Jamil Parvez

Jamil Pervez works as a Network Administrator, based in Kuwait with a Primary focus on Microsoft technologies. Microsoft Certified MCSE, MCTP, MCITP, CCNP, CCIP, CCVP with 20 years of experience in administering Windows Servers, Exchange, VMWare, Veeam B&R, Veritas BackupExec.

Related Articles

Leave a Reply

Back to top button