I have a Django application that's running on AWS EC2. That application occasionally makes requests to an external API (stripe.com). I tested it extensively and it passed all my tests. When I deployed it behind an Application Load Balancer, the requests where never received by the external API.

When I configured my launch template to auto-assign public IP the requests get there, but pages like this one recommend not even assigning the public IP to prevent the instance from being vulnerable.

Is there a way to make this connection without assigning the public IP?

2 Answers 2


Deploy a NAT Gateway. It's basically a proxy which lets your instance reach out to the internet but doesn't let anything on the internet in.

You should probably also read up about AWS security in general, if you're running a financial workload on EC2.


Either the instance should be in a public subnet, have a public IP, and connect directly to the Internet and the API. Or it should be in a private subnet, without s public IP and connect to the API through a NAT gateway.

However having the instance in a public subnet without a public IP will cause problems, even with NAT.

Check out this answer for more details:

AWS: Outbound only connectivity from a private subnet

Hope that helps :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.