Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

464
Views
How can I restrict access to allow everything within a VPC (in AWS) through a public nginx reverse proxy?

I have a service running inside a VPC that is exposed through nginx (also on a server within the VPC), since there are http(s) configurations needed which nginx handles. I want to allow that service to be reached only by servers in the same VPC - right now that's done through hardcoding ips with:

allow <elastic ip>;
allow <specific ip>;
allow <specific ip>;
...
deny all;

The Elastic IP (which is at vpc scope) seems to allow only instances which don't have their own public ip. I've also tried allowing the vpc and subnet CIDR blocks, which I'm assuming don't help since they are internal.

How can I get a general public CIDR for a private VPC? Is it possible? Am I going about this the wrong way?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

It sounds like you should use a Security Group.

A security group is like a firewall around every individual Amazon EC2 instance. It controls what ports are accessible from what CIDR range.

Let's say you have an EC2 instance running a service on port 80, and you only want it accessible to other instances in the VPC. You would simply configure the security group to only allow Inbound connections on port 80 from the CIDR range of the VPC. This would use the private IP addresses, since that's where the traffic is coming from.

Let's go one step better... let's say you only want specific instances to be able to communicate. You would:

  • Create a Security Group on the instances permitted to access the web server (let's call it App-SG)
  • Create a Security Group on the instance with the web server (let's call it Web-SG)
  • Configured Web-SG to allow Inbound connections on port 80 from App-SG

That is, the security group specifically references another security group. This will allow inbound connections from any EC2 instance that has the App-SG associated with it.

None of the above requires an Elastic IP address. Only public-facing resource require a public IP address. It is quite common to only expose a Load Balancer and to keep everything else 'private'.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!