Create NAT Gateway
Create NAT Gateway
- Access the VPC interface:
- Choose Elastic IPs
- Click on Allocate Elastic IP address
![ConnectPrivate](../../images/4.CreateEC2/4.3NATGW/001-NAT.png)
- In the Allocate Elastic IP address interface:
- Network border group: choose ap-southeast-1
- Public IPv4 address pool: Choose Amazon’s pool of IPv4 addresses
![ConnectPrivate](../../images/4.CreateEC2/4.3NATGW/002-NAT.png)
- Scroll down and choose Allocate
![ConnectPrivate](../../images/4.CreateEC2/4.3NATGW/003-NAT.png)
- In the VPC interface:
- Choose NAT gateways
- Click on Create NAT gateway
![ConnectPrivate](../../images/4.CreateEC2/4.3NATGW/004-NAT.png)
- In the Create NAT gateway interface:
- Name: Enter
workshop-NATGW
- Subnet: Choose Public Subnet 1
- Connectivity type: Choose Public
- Elastic IP allocation ID: Select recently created Elastic IP
![ConnectPrivate](../../images/4.CreateEC2/4.3NATGW/005-NAT.png)
- Review and click on Create NAT gateway.
![ConnectPrivate](../../images/4.CreateEC2/4.3NATGW/006-NAT.png)
- In the VPC interface:
- Choose Route tables
- Choose Route Table Private
- Click on Actions and select Edit routes
![ConnectPrivate](../../images/4.CreateEC2/4.3NATGW/007-NAT.png)
- In the Edit routes interface:
- Select Add route
- Destination: Enter
0.0.0.0/0
- Target: NAT Gateway and choose workshop-NATGW
- Click on Save changes
![ConnectPrivate](../../images/4.CreateEC2/4.3NATGW/008-NAT.png)
- After creating NAT gateway, test
ping aws.amazon.com
successfully from EC2 Private
![ConnectPrivate](../../images/4.CreateEC2/4.3NATGW/009-NAT.png)
- Now, let’s execute the
aws s3 ls
command in the terminal EC2 Private.
![ConnectPrivate](../../images/4.CreateEC2/4.3NATGW/010-NAT.png)
- After running the command aws s3 ls, we encountered an error: Unable to locate credentials.
- The error observed seems identical to that on the EC2 in the public subnet. This can be explained through the permissions of the S3 bucket.
![ConnectPrivate](../../images/4.CreateEC2/4.3NATGW/011-NAT.png)