Examples of using the Amazon CLI with zonal shift - Amazon Route 53 Application Recovery Controller
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Examples of using the Amazon CLI with zonal shift

This section walks through simple application examples of using zonal shift, using the Amazon Command Line Interface to work with the zonal shift capability in Amazon Route 53 Application Recovery Controller using API operations. The examples are intended to help you develop a basic understanding of how to work with zonal shift using the CLI.

Zonal shift in Route 53 ARC enables you to temporarily move traffic for supported resources away from an Availability Zone so that your application can continue to operate normally with other Availabilty Zones in an Amazon Web Services Region. Zonal shift currently supports Network Load Balancers and Application Load Balancers with cross-zone load balancing turned off.

Let's look at an example of starting a zonal shift using the Amazon Command Line Interface. You can also use the Amazon CLI to update a zonal shift, for example, to set a new expiration. All zonal shifts are temporary and must be set initially to expire within three days. However, you can update a zonal shift later to set a new expiration.

For more information about using the Amazon CLI, see the Amazon CLI Command Reference. For a list of zonal shift API actions and links to more information, see Zonal shift API operations.

Start zonal shift

You can start a zonal shift with the CLI by using the start-zonal-shift command.

aws arc-zonal-shift start-zonal-shift \ --resource-identifier="arn:aws:testservice::111122223333:ExampleALB123456890" \ --away-from="usw2-az1" \ --expires-in="5m" \ --comment="Shifting traffic away from USW2-AZ1"
{ "zonalShiftId": "2222222-3333-444-1111", "resourceIdentifier": "arn:aws:testservice::111122223333:ExampleALB123456890", "awayFrom": "usw2-az1", "expiryTime": 2022-11-14T01:40:42+00:00, "startTime": 2022-11-14T01:35:42+00:00, "status": "ACTIVE", "comment": "Shifting traffic away from USW2-AZ1" }

Get managed resource

You can get information about a managed resource with the CLI by using the get-managed-resource command.

aws arc-zonal-shift get-managed-resource \ --resource-identifier="arn:aws:testservice::111122223333:ExampleALB123456890
{ "arn": "arn:aws:testservice::111122223333:ExampleALB123456890", "name": "TestResource", "appliedWeights": { "usw2-az1": 1.0, "usw2-az2": 1.0, "usw2-az3": 1.0 }, "zonalShifts": [] }

List managed resources

You can list the managed resources in your account with the CLI by using the list-managed-resources command.

aws arc-zonal-shift list-managed-resources
{ "items": [ { "arn": "arn:aws:testservice::111122223333:ExampleALB123456890", "name": "TestResource", "availabilityZones": [ "usw2-az1", "usw2-az2", "usw2-az3" ] } ] }

List zonal shifts

You can list the zonal shifts in your account with the CLI by using the list-zonal-shifts command.

aws arc-zonal-shift list-zonal-shifts
{ "items": [ { "zonalShiftId": "2222222-3333-444-1111", "resourceIdentifier": "arn:aws:testservice::111122223333:ExampleALB123456890", "awayFrom": "usw2-az1", "expiryTime": 2022-11-15T09:10:42+00:00, "startTime": 2022-11-13T01:35:42+00:00, "status": "ACTIVE", "comment": "Shifting traffic away from USW2-AZ1" } ] }

Update zonal shift

You can update a zonal shift with the CLI by using the update-zonal-shift command.

aws arc-zonal-shift update-zonal-shift \ --zonal-shift-id="="arn:aws:testservice::111122223333:ExampleALB123456890" \ --expires-in="1h" \ --comment="Still shifting traffic away from USW2-AZ1"
{ "zonalShiftId": "2222222-3333-444-1111", "resourceIdentifier": "arn:aws:testservice::111122223333:ExampleALB123456890", "awayFrom": "usw2-az1", "expiryTime": 2022-11-15T10:35:42+00:00, "startTime": 2022-11-15T09:35:42+00:00, "status": "ACTIVE", "comment": "Still shifting traffic away from USW2-AZ1" }

Cancel zonal shift

You can cancel a zonal shift with the CLI by using the cancel-zonal-shift command.

aws arc-zonal-shift cancel-zonal-shift \ --zonal-shift-id="="arn:aws:testservice::111122223333:ExampleALB123456890"
{ "zonalShiftId": "2222222-3333-444-1111", "resourceIdentifier": "arn:aws:testservice::111122223333:ExampleALB123456890", "awayFrom": "usw2-az1", "expiryTime": 2022-11-15T10:35:42+00:00, "startTime": 2022-11-15T09:35:42+00:00, "status": "CANCELED", "comment": "Shifting traffic away from USW2-AZ1" }