This section walks through simple application examples of working with zonal autoshift, using the AWS Command Line Interface to work with the zonal autoshift 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 autoshift using the CLI.
Zonal autoshift is a capability in ARC. With zonal autoshift, you authorize AWS to shift away supported application resource traffic from an Availability Zone during events, on your behalf, to help reduce your time to recovery. Zonal autoshift includes practice runs, which also shift traffic away from Availability Zones, to help verify, on an ongoing basis, that autoshifts are safe for your application.
Zonal autoshift currently Application Load Balancers with cross-zone load balancing turned off.
For more information, see Supported resources.
This section provides the following examples to illustrate how to get started with and work with zonal autoshift:
Create a practice run configuration for a resource.
Enable and disable autoshifts for a resource.
End an in-progress practice run by canceling the zonal shift started by the practice run.
End an in-progress autoshift by disabling the zonal autoshift feature for a resource.
Edit a practice run configuration for a resource to change the specified alarms or blocked dates or windows.
Delete a practice run configuration for a resource.
For more information about using the AWS CLI, see the AWS CLI Command Reference. For a list of zonal autoshift API actions and links to more information, see Zonal autoshift API operations.
Create practice run configuration
Before you can enable zonal autoshift for a resource, you must create a practice run configuration
for the resource, to choose options for the required practice runs. You create a practice run configuration for a resource
with the CLI by using the create-practice-run-configuration
command.
Note the following when you create a practice run configuration for a resource:
The only supported alarm type at this time is
CLOUDWATCH
.You must use alarms that are in the same AWS Region that your resource is deployed in.
Specifying an outcome alarm is required. Specifying a blocking alarm is optional.
Specifying blocked dates or blocked windows is optional.
You create a practice run configuration with the CLI by using the create-practice-run-configuration
command.
For example, to create a practice run configuration for a resource, use a command like the following:
aws arc-zonal-shift create-practice-run-configuration \ --resource-identifier="arn:aws:elasticloadbalancing:
Region
:111122223333
:ExampleALB123456890
" \ --outcome-alarms type=CLOUDWATCH,alarmIdentifier=arn:aws:cloudwatch:Region
:111122223333
:alarm:Region
-MyAppHealthAlarm
\ --blocking-alarms type=CLOUDWATCH,alarmIdentifier=arn:aws:cloudwatch:Region
:111122223333
:alarm:Region
-BlockWhenALARM
\ --blocked-dates 2023-12-01 --blocked-windows Mon:10:00-Mon:10:30
{
"arn": "arn:aws:elasticloadbalancing:us-west-2:111122223333:ExampleALB123456890",
"name": "zonal-shift-elb"
"zonalAutoshiftStatus": "DISABLED",
"practiceRunConfiguration": {
"blockingAlarms": [
{
"type": "CLOUDWATCH",
"alarmIdentifier": "arn:aws:cloudwatch:us-west-2:111122223333:alarm:us-west-2-BlockWhenALARM"
}
]
"outcomeAlarms": [
{
"type": "CLOUDWATCH",
"alarmIdentifier": "arn:aws:cloudwatch:us-west-2:111122223333:alarm:us-west-2-MyAppHealthAlarm"
}
],
"blockedWindows": [
"Mon:10:00-Mon:10:30"
],
"blockedDates": [
"2023-12-01"
]
}
Enable or disable autoshifts
You enable or disable autoshifts for a resource by updating the zonal autoshift status with the CLI.
To change the zonal autoshift status, use the update-zonal-autoshift-configuration
command.
For example, to enable autoshifts for a resource, use a command like the following:
aws arc-zonal-shift update-zonal-autoshift-configuration \ --resource-identifier="arn:aws:elasticloadbalancing:
Region
:111122223333
:ExampleALB123456890
" \ --zonal-autoshift-status="ENABLED"
{
"resourceIdentifier": "arn:aws:elasticloadbalancing:us-west-2:111122223333:ExampleALB123456890",
"zonalAutoshiftStatus": "ENABLED"
}
Cancel an in-progress autoshift
To cancel an in-progress autoshift for a resource, you disable the zonal autoshift feature. This is the same command that you use to disable zonal autoshift in general, so when you disable zonal autoshift to cancel an in-progress autoshift, the resource is also not affected by future autoshifts. You can update zonal autoshift to enable it again at any time.
Note that you can disable zonal autoshift for a resource without deleting the practice run configuration for the resource.
To cancel an autoshift with the CLI, disable zonal sutoshift by using the update-zonal-autoshift-configuration
command. For example, to end an autoshift for a resource, use a command like the following:
aws arc-zonal-shift update-zonal-autoshift-configuration \ --resource-identifier="arn:aws:elasticloadbalancing:
Region
:111122223333
:ExampleALB123456890
" \ --zonal-autoshift-status="DISABLED"
{
"resourceIdentifier": "arn:aws:elasticloadbalancing:us-west-2:111122223333:ExampleALB123456890",
"zonalAutoshiftStatus": "DISABLED"
}
Cancel an in-progress practice run
You can cancel an in-progress practice run with the CLI by canceling the zonal shift that the practice run started
for the resource. To cancel a practice run, use the cancel-zonal-shift
command.
For example, to cancel a practice run for a resource, use a command like the following:
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": 2024-11-15T10:35:42+00:00,
"startTime": 2024-11-15T09:35:42+00:00,
"status": "CANCELED",
"comment": "Practice Run Started"
}
Edit a practice run configuration
You can edit a practice run configuration for a resource with the CLI to update different configuration
options, such as changing the alarms for practice runs or updating the blocked dates or blocked windows,
when ARC won't start practice runs. To edit a practice run configuration, use the
update-practice-run-configuration
command.
Note the following when you edit a practice run configuration for a resource:
The only supported alarm type at this time is
CLOUDWATCH
.You must use alarms that are in the same AWS Region that your resource is deployed in.
Specifying an outcome alarm is required. Specifying a blocking alarm is optional.
Specifying blocked dates or blocked windows is optional.
The blocked dates or blocked windows that you specify replace any existing values.
For example, to edit a practice run configuration for a resource to specify a new blocked date, use a command like the following:
aws arc-zonal-shift update-practice-run-configuration \ --resource-identifier="arn:aws:elasticloadbalancing:
Region
:111122223333
:ExampleALB123456890
" \ --blocked-dates 2024-03-01
{
"arn": "arn:aws:elasticloadbalancing:us-west-2:111122223333:ExampleALB123456890",
"name": "zonal-shift-elb"
"zonalAutoshiftStatus": "DISABLED",
"practiceRunConfiguration": {
"blockingAlarms": [
{
"type": "CLOUDWATCH",
"alarmIdentifier": "arn:aws:cloudwatch:us-west-2:111122223333:alarm:us-west-2-BlockWhenALARM"
}
]
"outcomeAlarms": [
{
"type": "CLOUDWATCH",
"alarmIdentifier": "arn:aws:cloudwatch:us-west-2:111122223333:alarm:us-west-2-MyAppHealthAlarm"
}
],
"blockedWindows": [
"Mon:10:00-Mon:10:30"
],
"blockedDates": [
"2024-03-01"
]
}
Delete a practice run configuration
You can delete a practice run configuration for a resource, but you must first disable zonal autoshift for the resource. A resource is required to have a practice run configuration to have zonal autoshift enabled. Regular practice runs help you to make sure that your application can run normally without one Availability Zone.
To delete a practice run configuration by using the CLI, first, disable zonal autoshift, if needed
by using the update-zonal-autoshift
command. Then, to delete the practice run configuration, use the
delete-practice-run-configuration
command.
First, disable zonal autoshift for the resource, using a command like the following:
aws arc-zonal-shift update-zonal-autoshift-configuration \ --resource-identifier="arn:aws:elasticloadbalancing:
Region
:111122223333
:ExampleALB123456890
" \ --zonal-autoshift-status="DISABLED"
{
"resourceIdentifier": "arn:aws:elasticloadbalancing:us-west-2:111122223333:ExampleALB123456890",
"zonalAutoshiftStatus": "DISABLED"
}
Then, delete the practice run configuration, using a command like the following:
aws arc-zonal-shift delete-practice-run-configuration \ --resource-identifier="arn:aws:elasticloadbalancing:
Region
:111122223333
:ExampleALB123456890
"
{
"arn": "arn:aws:elasticloadbalancing:us-west-2:111122223333:ExampleALB123456890",
"name": "TestResource",
"zonalAutoshiftStatus": "DISABLED"
}