Amazon Elastic Compute Cloud
User Guide for Linux (API Version 2014-09-01)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

Regions and Availability Zones

Amazon EC2 is hosted in multiple locations world-wide. These locations are composed of regions and Availability Zones. Each region is a separate geographic area. Each region has multiple, isolated locations known as Availability Zones. Amazon EC2 provides you the ability to place resources, such as instances, and data in multiple locations. Resources aren't replicated across regions unless you do so specifically.

Amazon operates state-of-the-art, highly-available data centers. Although rare, failures can occur that affect the availability of instances that are in the same location. If you host all your instances in a single location that is affected by such a failure, none of your instances would be available.

Note

Some AWS resources might not be available in all regions and Availability Zones. Ensure that you can create the resources you need in the desired regions or Availability Zone before deploying your applications.

Region and Availability Zone Concepts

Each region is completely independent. Each Availability Zone is isolated, but the Availability Zones in a region are connected through low-latency links. The following diagram illustrates the relationship between regions and Availability Zones.

Regions and Availability Zones

Amazon EC2 resources are either global, tied to a region, or tied to an Availability Zone. For more information, see Resource Locations.

Regions

Each Amazon EC2 region is designed to be completely isolated from the other Amazon EC2 regions. This achieves the greatest possible fault tolerance and stability.

Amazon EC2 provides multiple regions so that 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. The following table lists the regions that provide support for Amazon EC2.

CodeName

ap-northeast-1

Asia Pacific (Tokyo)

ap-southeast-1

Asia Pacific (Singapore)

ap-southeast-2

Asia Pacific (Sydney)

eu-central-1

EU (Frankfurt)

eu-west-1

EU (Ireland)

sa-east-1

South America (Sao Paulo)

us-east-1

US East (N. Virginia)

us-west-1

US West (N. California)

us-west-2

US West (Oregon)

When you view your resources, you'll only see the resources tied to the region you've specified. This is because regions are isolated from each other, and we don't replicate resources across regions automatically.

When you work with an instance using the command line interface or API actions, you must specify its regional endpoint. For more information about the regions and endpoints for Amazon EC2, see Regions and Endpoints in the Amazon Web Services General Reference. For more information about endpoints and protocols in AWS GovCloud (US), see AWS GovCloud (US) Endpoints in the AWS GovCloud (US) User Guide.

When you launch an instance, you must select an AMI that's in the same region. If the AMI is in another region, you can copy the AMI to the region you're using. For more information, see Copying an AMI.

All communications between regions is across the public Internet. Therefore, you should use the appropriate encryption methods to protect your data. Data transfer between regions is charged at the Internet data transfer rate for both the sending and the receiving instance. For more information, see Amazon EC2 Pricing - Data Transfer.

Availability Zones

You can list the Availability Zones that are available to your account. For more information, see Describing Your Regions and Availability Zones.

When you launch an instance, you can select an Availability Zone or let us choose one for you. If you distribute your instances across multiple Availability Zones and one instance fails, you can design your application so that an instance in another Availability Zone can handle requests.

You can also use Elastic IP addresses to mask the failure of an instance in one Availability Zone by rapidly remapping the address to an instance in another Availability Zone. For more information, see Elastic IP Addresses (EIP).

To ensure that resources are distributed across the Availability Zones for a region, we independently map Availability Zones to identifiers for each account. For example, your Availability Zone us-east-1a might not be the same location as us-east-1a for another account. Note that there's no way for you to coordinate Availability Zones between accounts.

As Availability Zones grow over time, our ability to expand them can become constrained. If this happens, we might restrict you from launching an instance in a constrained Availability Zone unless you already have an instance in that Availability Zone. Eventually, we might also remove the constrained Availability Zone from the list of Availability Zones for new customers. Therefore, your account might have a different number of available Availability Zones in a region than another account.

Describing Your Regions and Availability Zones

You can use the AWS Management Console or the command line interface to determine which regions and Availability Zones are available for your use. For more information about these command line interfaces, see Accessing Amazon EC2.

To find your regions and Availability Zones using the AWS Management Console

  1. Open the AWS Management Console.

  2. From the navigation bar, view the options in the region selector.

    View your regions
  3. Open the Amazon EC2 console. Your Availability Zones are listed on the dashboard under Service Health, under Availability Zone Status.

    View your Availability Zones

To find your regions and Availability Zones using the AWS CLI

  1. Use the describe-regions command as follows to describe your regions.

    $ aws ec2 describe-regions
    {
        "Regions": [
            {
                "Endpoint": "ec2.us-east-1.amazonaws.com",
                "RegionName": "us-east-1"
            },
            {
                "Endpoint": "ec2.ap-southeast-1.amazonaws.com",
                "RegionName": "ap-southeast-1"
            },
            {
                "Endpoint": "ec2.ap-southeast-2.amazonaws.com",
                "RegionName": "ap-southeast-2"
            },
            ...
        ]
    }
  2. Use the describe-availability-zones command as follows to describe your Availability Zones within the us-east-1 region.

    $ aws ec2 describe-availability-zones --region us-east-1
    {
        "AvailabilityZones": [
            {
                "State": "available",
                "RegionName": "us-east-1",
                "Messages": [],
                "ZoneName": "us-east-1b"
            },
            {
                "State": "available",
                "RegionName": "us-east-1",
                "Messages": [],
                "ZoneName": "us-east-1c"
            },
            {
                "State": "available",
                "RegionName": "us-east-1",
                "Messages": [],
                "ZoneName": "us-east-1d"
            }
        ]
    }

To find your regions and Availability Zones using the Amazon EC2 CLI

  1. Use the ec2-describe-regions command as follows to describe your regions.

    PROMPT> ec2-describe-regions
    REGION us-east-1  ec2.us-east-1.amazonaws.com
    REGION  ap-northeast-1  ec2.ap-northeast-1.amazonaws.com
    REGION  ap-southeast-1  ec2.ap-southeast-1.amazonaws.com
    ..
  2. Use the ec2-describe-availability-zones command as follows to describe your Availability Zones within the us-east-1 region.

    PROMPT>  ec2-describe-availability-zones --region us-east-1
    AVAILABILITYZONE	us-east-1a	available	us-east-1
    AVAILABILITYZONE	us-east-1b	available	us-east-1
    AVAILABILITYZONE	us-east-1c	available	us-east-1
    AVAILABILITYZONE	us-east-1d	available	us-east-1

Specifying the Region for a Resource

Every time you create an Amazon EC2 resource, you can specify the region for the resource. You can specify the region for a resource using the AWS Management Console or the command line.

To specify the region for a resource using the console

  1. Open the Amazon EC2 console.

  2. Use the region selector in the navigation bar.

    Use the console region selector

To specify the default region using the command line

You can set the value of an environment variable to the desired regional endpoint (for example, https://ec2.us-west-1.amazonaws.com):

  • AWS_DEFAULT_REGION (AWS CLI)

  • EC2_URL (Amazon EC2 CLI)

Alternatively, you can use the --region command line option with each individual command. For example, --region us-west-1.

For more information about the endpoints for Amazon EC2, see Amazon Elastic Compute Cloud Endpoints.

Launching Instances in an Availability Zone

When you launch an instance, select a region that puts your instances closer to specific customers, or meets the legal or other requirements you have. By launching your instances in separate Availability Zones, you can protect your applications from the failure of a single location.

When you launch an instance, you can optionally specify an Availability Zone in the region that you are using. If you do not specify an Availability Zone, we select one for you. When you launch your initial instances, we recommend that you accept the default Availability Zone, because this enables us to select the best Availability Zone for you based on system health and available capacity. If you launch additional instances, only specify an Availability Zone if your new instances must be close to, or separated from, your running instances.

To specify an Availability Zone for your instance using the console

  1. Open the Amazon EC2 console.

  2. On the dashboard, click Launch Instance.

  3. Follow the directions for the wizard. On the Configure Instance Details page, do the following:

    • [EC2-Classic] Select one of the Availability Zone options from the list, or select No Preference to enable us to select the best one for you.

      Select an Availability Zone for your instance
    • [EC2-VPC] Select one of the subnet options from the list, or select No preference (default subnet in any Availability Zone) to enable us to select the best one for you.

      Select a subnet for your instance

To specify an Availability Zone for your instance using the AWS CLI

You can use the run-instances command with one of the following options:

  • [EC2-Classic] --placement

  • [EC2-VPC] --subnet-id

To specify an Availability Zone for your instance using the Amazon EC2 CLI

You can use the ec2-run-instances command with one of the following options:

  • [EC2-Classic] --availability-zone

  • [EC2-VPC] --subnet

Migrating an Instance to Another Availability Zone

If you need to, you can migrate an instance from one Availability Zone to another. For example, if you are trying to modify the instance type of your instance and we can't launch an instance of the new instance type in the current Availability Zone, you could migrate the instance to an Availability Zone where we can launch an instance of that instance type.

The migration process involves creating an AMI from the original instance, launching an instance in the new Availability Zone, and updating the configuration of the new instance, as shown in the following procedure.

To migrate an instance to another Availability Zone

  1. Create an AMI from the instance. The procedure depends on the operating system and the type of root device volume for the instance. For more information, see the documentation that corresponds to your operating system and root device volume:

  2. [EC2-VPC] If you need to preserve the private IP address of the instance, you must delete the subnet in the current Availability Zone and then create a subnet in the new Availability Zone with the same IP address range as the original subnet. Note that you must terminate all instances in a subnet before you can delete it. Therefore, you should move all instances in the current subnet to the new subnet.

  3. Launch an instance from the AMI that you just created, specifying the new Availability Zone or subnet. You can use the same instance type as the original instance, or select a new instance type. For more information, see Launching Instances in an Availability Zone.

  4. If the original instance has an associated Elastic IP address, associate it with the new instance. For more information, see Associating an Elastic IP Address with a Different Running Instance.

  5. If the original instance is a Reserved Instance, change the Availability Zone for your reservation. (If you also changed the instance type, you can also change the instance type for your reservation.) For more information, see Submitting Modification Requests.

  6. (Optional) Terminate the original instance. For more information, see Terminating an Instance.