Hostnames in backend definition...

Hugo Cisneiros (Eitch) hugo.cisneiros at
Tue Dec 13 18:38:32 CET 2011

On Tue, Dec 13, 2011 at 3:22 PM, david raistrick <drais at> wrote:
>> I'm setting up varnish to access a load balancer from amazon ec2. I
>> have two problems:
> For those of us familiar with EC2 architecture, can I get some
> clarification?
> You're trying to use varnish in front of ELB, with the ELB hostnames as your
> backends?
> I would strongly recommend against this.
>> - since the IP address for the load balancer changes very often, does
>> varnish obey the ttl rule for resolving the hostname if I specify the
>> hostname in vcl?
> ...for exactly this reason.
> You have no control, knowledge, or insight into when the IP address behind
> the ELB hostname changes, and varnish effectively caches the hostname on
> startup.  When the internal IP of ELB changes (and it will!) your traffic
> will stop.

That's the scenario. The idea for this is to use the ELB as a
"fallback" backend. When my main backend fails, varnish will switch to
another backend. This fallback backend would be an ELB because of the
autoscaling feature for cost efficiency. One instance will be up,
waiting for traffic, but getting nothing most of the time. When the
main backend fail, all of the traffic (it's a lot) will go to the ELB
that will spawn and terminate new servers as necessary.

I can use Elastic IPs with fixed instances, but this would kill the

And as you said, since varnish caches DNS on startup/vcl.load only,
this will not work for me... That's sad :(

Thanks for the information! :)


More information about the varnish-misc mailing list