Skip to content

Instantly share code, notes, and snippets.

@rjhintz
Last active March 23, 2019 09:49
Show Gist options
  • Save rjhintz/82db57d7697f2c4bb47d0f8b83a3db0e to your computer and use it in GitHub Desktop.
Save rjhintz/82db57d7697f2c4bb47d0f8b83a3db0e to your computer and use it in GitHub Desktop.
AWS NAT Instance Basics

NAT Instance on AWS - Basics

References:

Method

  1. Create a VPC with an internet gateway, if one doesn't exist
  2. Create a public subnet, if one doesn't exist
  3. Create a private subnet, if one doesn't exist
  • 172.30.21.0/24
  • us-east-1a
  • tag: private
  1. Launch NAT server
  • search on nat in community images
  • amzn-ami-vpc-nat-hvm-2016.03.0.x86_64-ebs - ami-311a1a5b * Amazon Linux AMI 2016.03.0 x86_64 VPC NAT HVM EBS * Root device type: ebs; Virtualization type: hvm
  • t2.nano
  • launch in public subnet with Public IP address to be assigned
  • storage to GP2 from Magnetic
  • Tag Name as NAT
  • Security group: [NATSG] (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_NAT_Instance.html#NATSG)
  • Once launched: Console>Actions>Networking>Change Source/Dest. Check>Disable
  1. Launch instance in private subnet
  • Ubuntu
  • t2.nano
  • Security group: all traffic
  1. Create new routing table
  • Go to VPC
  • name: private-for-NAT
  • 0.0.0.0/0 to NAT instance
  • check that status goes to Active on save
  • edit subnet associations so private subnet associated
  1. Copy .pem file to NAT instance
  2. Login into private instance through NAT instance (see also bastion server)

See Also

ssh-agent bash

ssh-add -c [key].pem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment