Comment 1 for bug 317065

Revision history for this message
Eric Hammond (esh) wrote :

There is currently no standard, reliable method for determining what specific availability zone an EC2 instance is running in.

In fact, availability zone us-east-1a for one EC2 account may not be the same availability zone as us-east-1a for another EC2 account. Amazon assigns these names randomly for each account (but keeps them consistent within that account).

There are no public, shared, external names for the EC2 availability zones. They are all relative to the specific account running the instance.

I believe the best an instance can do is to determine what region it is running in and use a mirror name which represents the mirror instance(s) in that region.

When architecting the mirrors, there should still be at least one instance running in each availability zone to provide the level of reliability that EC2 users depend on.

When the instance determines the region it is in (say, us-east-1) it could use something like:
  ec2-us-east-1.archive.canonical.com
or
  us-east-1.ec2.archive.canonical.com
and that could resolve to the internal IP addresses for the mirrors in all the availability zones in that region.

There is a chance that the user's instance might not get the mirror in its own availability zone which would add a small network transfer charge (currently $0.01/GB) but this is still much less than accessing a mirror completely outside of EC2 (about $0.10/GB).