Using Regions and Availability Zones
Topics
This section describes how to work with regions and Availability Zones.
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. |
API Overview
This section provides a brief overview of each operation.
-
DescribeAvailabilityZones—Describes Availability Zones available to your account
-
DescribeRegions—Describes regions available to your account
Note | |
---|---|
Although the region and Availability Zone operation list is limited, you can specify a region or Availability Zone for many operations. For information about region and Availability Zone concepts, see Availability Zones. |
Describing Regions and Availability Zones
This section describes how to determine which regions and Availability Zones are available.
AWS Management Console
To find regions and Availability Zones
-
Log in to the AWS Management Console and click the Amazon EC2 tab.
-
To determine available regions, select the Region list box in the Navigation pane.
After selecting a region, you can view Availability Zones within that region when launching an instance or creating a new Amazon EBS volume.
-
To view Availability Zones within a region, click Volumes in the Navigation pane.
The Create Volumedialog box appears.
-
To view Availability Zones within the region, select the Availability Zones list box.
-
When you are finished, click Cancel.
Command Line Tools
To describe regions and Availability Zones
-
Enter the following command to describe regions:
PROMPT>
Amazon EC2 returns output similar to the following:
REGION us-east-1 us-east-1.ec2.amazonaws.com REGION eu-west-1 eu-west-1.ec2.amazonaws.com
-
Enter the following command to describe Availability Zones within the
us-east-1
region:PROMPT>
ec2-describe-availability-zones --region eu-west-1
Amazon EC2 returns output similar to the following:
AVAILABILITYZONE us-east-1a available eu-west-1 AVAILABILITYZONE us-east-1b available eu-west-1 AVAILABILITYZONE us-east-1c available eu-west-1 AVAILABILITYZONE us-east-1d available eu-west-1
How to Configure Your Environment
After choosing a region and one or more Availability Zones, you should set up your environment.
Note | |
---|---|
The |
To set up your environment
-
If you are using the command line tools, change the
EC2_URL
environment variable to point to the correct region.Note You can also use the
--region
command line option, or override the URL endpoint using the-U
flag. -
If you are using the AWS Management Console, you do not need to take any steps.
-
If you are using APIs, configure your application to use the appropriate service endpoint.
Launching Instances in Specific Availability Zones
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.
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. You are charged a small bandwidth charge for data that crosses Availability Zones. For more information, go to the Amazon EC2 product page. |
AWS Management Console
To launch an instance in a specific Availability Zone
-
Log in to the AWS Management Console and click the Amazon EC2 tab.
-
Click Instances in the Navigation pane.
The console displays a list of running instances.
-
Click Launch Instance.
The Launch Instance wizard appears.
-
Locate an AMI from the Quick Start, My AMIs, or Community AMIs tab and click Select.
The Configure Firewall page of the wizard appears.
-
If you have not configured a security group, complete the options on the Configure Firewall page. Otherwise, click Skip.
The Launch page of the wizard appears.
-
Confirm the following settings and click Launch.
- AMI name
- Number of instances to launch
- Instance type to launch
- Name of the key pair to launch the instance
- Security group(s) within which to launch the instance
The instance(s) begin launching.
Command Line Tools
To launch an instance in a specific Availability Zone
-
Enter the following command to describe Availability Zones:
PROMPT>
ec2-describe-availability-zones --region
region
Amazon EC2 returns output similar to the following:
AVAILABILITYZONE us-east-1a available AVAILABILITYZONE us-east-1b available AVAILABILITYZONE us-east-1c available AVAILABILITYZONE us-east-1d available
-
After determining the Availability Zones that are available to you, you can launch instances in any of them.
PROMPT>
ec2-run-instances
ami_id
-ncount
--availability-zonezone
Amazon EC2 returns output similar to the following:
RESERVATION r-0ea54067 495219933132 default INSTANCE i-3ea74257 ami-6ba54002 pending 0 m1.small 2007-07-11T16:40:44+0000 us-east-1a INSTANCE i-31a74258 ami-6ba54002 pending 1 m1.small 2007-07-11T16:40:44+0000 us-east-1a INSTANCE i-31a74259 ami-6ba54002 pending 2 m1.small 2007-07-11T16:40:44+0000 us-east-1a INSTANCE i-31a7425a ami-6ba54002 pending 3 m1.small 2007-07-11T16:40:44+0000 us-east-1a INSTANCE i-31a7425b ami-6ba54002 pending 4 m1.small 2007-07-11T16:40:44+0000 us-east-1a INSTANCE i-31a7425c ami-6ba54002 pending 5 m1.small 2007-07-11T16:40:44+0000 us-east-1a