Tuesday, October 24, 2017

HOWTO access AWS resources inside a private VPC

Sorry, no screenshots. I just encountered this problem in my work, and creating screenshots will redo the entire thing. :)

Scenario
Your AWS resources is inside a private VPC that's inaccessible from the outside world. In our specific case, we have Lambda functions located inside a VPC together with ElastiCache. I needed a way to load data into ElastiCache.

Solution (note: this is not be step by step, I'm just recreating the required components; there's probably a wizard for this or something).

  1. In the VPC page, create a VPC. Let's name this vpc-111
  2. Create an Internet Gateway. Let's name this igw-12345.
  3. Create a subnet for igw-12345 and in your Route Table, point 0.0.0.0/0 to igw-12345. Let's name this subnet subnet-2468.
  4. Launch an EC2 instance and put it inside vpc-111. Enable public IP auto-assignment. Select subnet-2468 for your instance.
  5. Launch your EC2 instance.
  6. You can now access the AWS resources inside the instance or you can use SSH tunneling to access them from your workstation.
  7. Enjoy!