Score:0

Apache/AWS: How to identify local instance requests from the same VPC

cn flag

In this configuration the apache server instances are all in the same VPC (across several subnets) and all incoming requests are managed via an elastic load balancer, (with ProxyProtocol=On on each instance).

These instances serve 40+ websites in the same VPC behind the same loadbalancer.

When any of the sites on these instances initiate an outgoing http request, the request goes through the load balancer and then comes back as originating from the instance's public IP address. These are all pretty random (but once assigned, they are fixed for the lifespan of the instance).

For instance, when the site 'foo' uses a wget/curl to invoke site 'bar', that request will still arrive through the loadbalancer to bar, using foo's public ip, not foo's local network id.

We need a mechanism that allows us to identify whether or not that public IP belongs to an instance within the VPC. We could always use a manual register - but if there is a better way?

Tim avatar
gp flag
Tim
I don't follow what you're trying to achieve. Load balancers are typically for incoming requests being sent to a group of EC2 instances, rather than outbound requests.
Konchog avatar
cn flag
@Tim, yes that's right. But if I have 40 websites in the same VPC behind the same loadbalancer, and site 'foo' uses a wget/curl to invoke site 'bar', that request will still arrive through the loadbalancer to bar, using foo's public ip.
Tim avatar
gp flag
Tim
Ah, that's a pretty critical piece of important that you should put into your question. If all the EC2 servers are inside a VPC I would consider using a Route53 private hosted zone for each domain so that the request went directly from instance to instance rather than via public endpoints.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.