Skip to content

Instantly share code, notes, and snippets.

@eherot
Created November 6, 2019 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eherot/ef1800c5a0ff7dd540abbf4d2b8b55e0 to your computer and use it in GitHub Desktop.
Save eherot/ef1800c5a0ff7dd540abbf4d2b8b55e0 to your computer and use it in GitHub Desktop.
How to set up a basic VPC with a VPN

Required things

  1. The VPN
  2. An Internet gateway
  3. A route table (meaining the route to 0.0.0.0/0 should go through the above internet gateway)
  4. A public subnet (meaning it should be "associated" with the above route table)
  5. An elastic IP address
  6. An EC2 instance (your VPN server) running in the above subnet and associated with the above elastic IP

Optional things (but that you'll almost certainly want)

  1. At least one NAT Gateway
  2. A private route (meaning the route to 0.0.0.0/0 should go through the above NAT Gateway)
  3. A private subnet (to host the stuff you want to access with the VPN)

Security groups

  1. "vpn" - This group will be associated with the VPN server. It needs one rule allowing traffic IN from 0.0.0.0/0 on the OpenVPN port (usually UDP/1194). Allowing connections from your local IP on port 22 is also helpful.
  2. "default" - This group will be associated with everything else and it needs one rule allowing traffic on all ports from the above "vpn" group.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment