Examples of using the Amazon CLI with zonal shift
This section provides application examples of using zonal shift, using the Amazon Command Line Interface to work with the zonal shift capability in Amazon Application Recovery Controller (ARC) 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 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.
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:elasticloadbalancing:us-east-1:111122223333:loadbalancer/app/Testing/5a19403ecd42dc05 \ --away-from use1-az1 \ --expires-in 10m \ --comment "Shifting traffic away from use1-az1"
{ "awayFrom": "use1-az1", "comment": "Shifting traffic away from use1-az1", "expiryTime": "2024-12-17T21:37:26-08:00", "resourceIdentifier": "arn:aws:elasticloadbalancing:us-east-1:111122223333:loadbalancer/app/Testing/5a19403ecd42dc05", "startTime": "2024-12-17T21:27:26-08:00", "status": "ACTIVE", "zonalShiftId": "9ac9ec1e-1df1-0755-3dc5-8cf573cd9c38" }
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:elasticloadbalancing:us-east-1:111122223333:loadbalancer/app/Testing/5a19403ecd42dc05
{ "appliedWeights": { "use1-az1": 0.0, "use1-az2": 1.0, "use1-az6": 1.0 }, "arn": "arn:aws:elasticloadbalancing:us-east-1:111122223333:loadbalancer/app/Testing/5a19403ecd42dc05", "autoshifts": [], "name": "Testing", "zonalAutoshiftStatus": "DISABLED", "zonalShifts": [ { "appliedStatus": "APPLIED", "awayFrom": "use1-az1", "comment": "Shifting traffic away from use1-az1", "expiryTime": "2024-12-17T21:37:26-08:00", "resourceIdentifier": "arn:aws:elasticloadbalancing:us-east-1:111122223333:loadbalancer/app/Testing/5a19403ecd42dc05", "startTime": "2024-12-17T21:27:26-08:00", "zonalShiftId": "9ac9ec1e-1df1-0755-3dc5-8cf573cd9c38" } ] }
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": [ { "appliedWeights": { "use1-az1": 0.0, "use1-az2": 1.0, "use1-az6": 1.0 }, "arn": "arn:aws:elasticloadbalancing:us-east-1:111122223333:loadbalancer/app/Testing/5a19403ecd42dc05", "autoshifts": [], "availabilityZones": [ "use1-az1", "use1-az2", "use1-az6" ], "name": "Testing", "practiceRunStatus": "DISABLED", "zonalAutoshiftStatus": "DISABLED", "zonalShifts": [ { "appliedStatus": "APPLIED", "awayFrom": "use1-az1", "comment": "Shifting traffic away from use1-az1", "expiryTime": "2024-12-17T21:37:26-08:00", "resourceIdentifier": "arn:aws:elasticloadbalancing:us-east-1:111122223333:loadbalancer/app/Testing/5a19403ecd42dc05", "startTime": "2024-12-17T21:27:26-08:00", "zonalShiftId": "9ac9ec1e-1df1-0755-3dc5-8cf573cd9c38" } ] } ] }
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": [ { "awayFrom": "use1-az1", "comment": "Shifting traffic away from use1-az1", "expiryTime": "2024-12-17T21:37:26-08:00", "resourceIdentifier": "arn:aws:elasticloadbalancing:us-east-1:111122223333:loadbalancer/app/Testing/5a19403ecd42dc05", "startTime": "2024-12-17T21:27:26-08:00", "status": "ACTIVE", "zonalShiftId": "9ac9ec1e-1df1-0755-3dc5-8cf573cd9c38" } ] }
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 9ac9ec1e-1df1-0755-3dc5-8cf573cd9c38 \ --expires-in 1h \ --comment "Still shifting traffic away from use1-az1"
{ "awayFrom": "use1-az1", "comment": "Still shifting traffic away from use1-az1", "expiryTime": "2024-12-17T22:29:38-08:00", "resourceIdentifier": "arn:aws:elasticloadbalancing:us-east-1:111122223333:loadbalancer/app/Testing/5a19403ecd42dc05", "startTime": "2024-12-17T21:27:26-08:00", "status": "ACTIVE", "zonalShiftId": "9ac9ec1e-1df1-0755-3dc5-8cf573cd9c38" }
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 9ac9ec1e-1df1-0755-3dc5-8cf573cd9c38
{ "awayFrom": "use1-az1", "comment": "Still shifting traffic away from use1-az1", "expiryTime": "2024-12-17T22:29:38-08:00", "resourceIdentifier": "arn:aws:elasticloadbalancing:us-east-1:111122223333:loadbalancer/app/Testing/5a19403ecd42dc05", "startTime": "2024-12-17T21:27:26-08:00", "status": "CANCELED", "zonalShiftId": "9ac9ec1e-1df1-0755-3dc5-8cf573cd9c38" }