satoshi
satoshi

Reputation: 4103

Static IP for external API

I need to use an external web API for my website and they ask me what will be the IP address where the requests will come from. The point is that my web application is scaled on more Amazon EC2 instances, because it's deployed using Elastic Beanstalk with auto scaling configured.

What will be the best solution to solve the problem?

The best thing I can think of is to set up a micro instance, associate an Elastic IP to it and use it as an HTTP proxy. Is there a better solution?

I'm sure I'm not the only one having this problem but I couldn't find another question like my one on stackoverflow. A lot of e-commerce websites usually use an external payment system that requires the requests to come from one or more specific IP addresses...

Thank you.

Update - thanks to @David, I did set up an HTTP proxy using the Apache module mod_proxy. How can I configure it so that only my EC2 instances can access it? My EC2 instances are dynamically created when auto scaling.

ProxyRequests On                                                                                                                                                                   

<Proxy *>                                                                                                                                                                          
 Order deny,allow                                                                                                                                                                  
 Deny from all                                                                                                                                                                     
 Allow from ???                                                                                                                                               
</Proxy>

Upvotes: 5

Views: 1259

Answers (3)

Mauvis Ledford
Mauvis Ledford

Reputation: 42334

I would use Nginx as a reverse proxy instead of Apache because Nginx has a way smaller footprint and is evented so can handle way more traffic. See this blog post for more details: http://readystate4.com/2012/07/08/nginx-the-non-blocking-model-and-why-apache-sucks/

Upvotes: 0

Crooner
Crooner

Reputation: 11

Setup a Virtual Private Cloud (VPC) to isolate instances IP to a /24 net, then use AWS Security Groups to isolate access to only your EC2 instances.

Upvotes: 1

Frodo Baggins
Frodo Baggins

Reputation: 8533

Just use a (forward) proxy, Apache2 can do this. By default request will come from the IP address of the proxy (if the service is looking at "REMOTE_ADDR"). Some proxies add "HTTP_X_FORWARD_FOR" to indicate the true IP of the client where the request originated, but I doubt your service would check for this.

Upvotes: 2

Related Questions