Regions and Availability Zones
Amazon EC2 provides the ability to place instances in multiple locations. Amazon EC2 locations are composed of Availability Zones and regions. Regions are dispersed and located in separate geographic areas (e.g., US and EU). Availability Zones are distinct locations within a region that are engineered to be insulated from failures in other Availability Zones and provide inexpensive, low latency network connectivity to other Availability Zones in the same region.
By launching instance in separate regions, you can design your application to be closer to specific customers or to meet legal or other requirements. By launching instances in separate Availability Zones, you can protect your applications from the failure of a single location.
The following graphic shows the Amazon EC2 cloud. Each region is completely independent. Each Availability Zone is isolated, but connected through low-latency links.
Regions
Amazon EC2 provides multiple regions so you can launch Amazon EC2 instances in locations that meet your requirements. For example, you might want to launch instances in Europe to be closer to your European customers or to meet legal requirements.
Each Amazon EC2 region is designed to be completely isolated from the other Amazon EC2 regions. This achieves the greatest possible failure independence and stability, and it makes the locality of each EC2 resource unambiguous.
To launch or work with instances, you must specify the correct regional URL endpoint. For example,
to access the United States region, you make service calls to the us-east-1.ec2.amazonaws.com
service endpoint. To access the region in Europe, you make service calls to the
eu-west-1.ec2.amazonaws.com
service endpoint.
Example
This shows an example of describing the Availability Zones within the EU region.
ec2-describe-availability-zones --region eu-west-1
AVAILABILITYZONE eu-west-1a available eu-west-1 AVAILABILITYZONE eu-west-1b available eu-west-1
Region Selection
This section describes how to find available regions and how to select one.
To view the available regions
-
Enter the following command:
PROMPT>
ec2-describe-regions
REGION us-east-1 us-east-1.ec2.amazonaws.com REGION eu-west-1 eu-west-1.ec2.amazonaws.com
Note Data transfer between regions is charged at the Internet data transfer rate for both the sending and the receiving region. For detailed information on Amazon EC2 charges, go to the Amazon EC2 Product Page.
The
us-east-1.ec2.amazonaws.com
region is the original Amazon EC2 region and is selected by default.
To select a specific region using the command line tools
-
Change the
EC2_URL
environment variable.Note You can also use the
--region
command line option, or override the URL endpoint using the-U
flag.
To select a specific region for Query or SOAP
-
Configure your application to use the appropriate service endpoint.
Availability Zones
Amazon operates state-of-the-art, highly available data center facilities. However, failures can occur that affect the availability of instances that are in the same location. Although this is rare, if you host all your Amazon EC2 instances in a single location that is affected by such a failure, your instances will be unavailable.
For example, if you have instances distributed across three Availability Zones and one of them fails, you can design your application so the instances in the remaining Availability Zones handle any requests.
Note | |
---|---|
You can use Availability Zones in conjunction with elastic IP addresses to remap IP addresses across Availability Zones. For information on elastic IP addresses, see Elastic IP Addresses. |
Availability Zone Selection
When you launch an instance, you can optionally specify an Availability Zone. If you do not specify an Availability Zone, Amazon EC2 selects one for you in the region that you are using. When launching your initial instances, we recommend accepting the default Availability Zone, which allows Amazon EC2 to select the best Availability Zone for you based on system health and available capacity. Even if you have other instances running, you might consider not specifying an Availability Zone if your new instances do not need to be close to, or separated from, your existing instances.
To view the Availability Zones available to you
-
Enter the following command:
PROMPT>
ec2-describe-availability-zones
AVAILABILITYZONE us-east-1a available AVAILABILITYZONE us-east-1b available AVAILABILITYZONE us-east-1c available
Note | |
---|---|
Availability Zones are not the same across accounts. The Availability Zone us-east-1a for account A is not necessarily the same as us-east-1a for account B. Zone assignments are mapped independently for each account. |
After determining the Availability Zones that are available to you, you can launch instances in any of the zones.
Note | |
---|---|
You are charged a small bandwidth charge for data that crosses Availability Zones. For more information, go to the Amazon EC2 product page. |
Resources
The following table describes which Amazon EC2 resources are global, regional, or Availability Zone-based.
Resource | Type | Description |
---|---|---|
|
Global |
You use the same AWS account in all regions. |
|
Global |
You use the same DevPay product codes throughout all regions. |
|
Regional |
Includes the AMI ID, Instance ID, EBS Volume ID, EBS Snapshot ID, and so on. |
|
Availability Zone |
Instances are tied to Availability Zones. However, the instance ID is tied to the region. |
|
Regional |
AMIs are tied to the region where its files are located within Amazon S3. |
|
Regional |
Security groups are not copied across regions. Instances within the region cannot communicate with instances outside the region using group-based firewall rules. Traffic from instances in another region is seen as WAN bandwidth. |
|
Regional |
Key pairs (to connect to instances) are region-specific. |
|
Regional |
Includes security group names, SSH key pair names, and so on. Although you can create the same names in multiple regions, they have no relationship to each other. |
|
Regional |
Elastic IP addresses are tied to a region and cannot be mapped across regions. |
|
Availability Zone |
An Amazon EBS volume must be located within the same Availability Zone as the instance to which it attaches. |
|
Regional |
Snapshots are tied to regions and can only be used for volumes within the same region. |