List and update routing controls and states with the AWS CLI - Amazon Route 53 Application Recovery Controller

List and update routing controls and states with the AWS CLI

After you provision a set of Amazon Route 53 Application Recovery Controller resources (cluster, routing controls, and possibly control panels), you can begin interacting with the cluster to list and update routing control states using the highly reliable Route 53 ARC data plane endpoints.

For each cluster that you create, Route 53 ARC provides you with a set of cluster endpoints. You must specify one of these Regional endpoints (the AWS Region and the endpoint URL) when you make calls to the cluster to retrieve or set routing control states to On or Off. In addition to the Regional endpoint, you must also specify the --region of the Regional endpoint when you use the AWS CLI with Route 53 ARC, as shown in the examples in this section.

You can use any of the Regional cluster endpoints. We recommend that your systems be prepared to retry with each of the available endpoints. For code samples that illustrate trying cluster endpoints in sequence, see Actions for Application Recovery Controller using AWS SDKs.

Important

Although you can update a routing control state on the Amazon Route 53 console, we recommend that you update routing control states by using the AWS CLI. Route 53 ARC offers extreme reliability with the Route 53 ARC routing control data plane for rerouting traffic and failing over across cells.

When you create a routing control, the state is set to Off. This means that traffic is not routed to the target cell for that routing control. You can verify the state of the routing control by running the command get-routing-control-state.

To determine the Region and the endpoint to specify, run the describe-clusters command to view the ClusterEndpoints. Each ClusterEndpoint includes a Region and corresponding endpoint that you can use to get or update routing control states. DescribeCluster is a recovery control configuration API operation. We recommend that you keep a local copy of your Route 53 ARC Regional cluster endpoints, in bookmarks or hardcoded in automation code that you use to retry your endpoints.

You can view your routing controls and routing control states using the highly reliable Route 53 ARC data plane endpoints.

1. List routing controls for a specific control panel. If you don't specify a control panel, list-routing-controls returns all the routing controls in the cluster.

aws route53-recovery-cluster list-routing-controls --control-panel-arn \ arn:aws:route53-recovery-control::111122223333:controlpanel/0123456bbbbbbb0123456bbbbbb0123456 \ --region us-west-2 \ --endpoint-url https://host-dddddd.us-west-2.example.com/v1
{ "RoutingControls": [{ "ControlPanelArn": "arn:aws:route53-recovery-control::111122223333:controlpanel/0123456bbbbbbb0123456bbbbbb0123456", "ControlPanelName": "ExampleControlPanel", "RoutingControlArn": "arn:aws:route53-recovery-control::111122223333:controlpanel/0123456bbbbbbb0123456bbbbbb0123456/routingcontrol/abcdefg1234567", "RoutingControlName": "RCOne", "RoutingControlState": "On" }, { "ControlPanelArn": "arn:aws:route53-recovery-control::023759465626:controlpanel/0123456bbbbbbb0123456bbbbbb0123456", "ControlPanelName": "ExampleControlPanel", "RoutingControlArn": "arn:aws:route53-recovery-control::023759465626:controlpanel/0123456bbbbbbb0123456bbbbbb0123456/routingcontrol/zzzzxxxxyyyy123456", "RoutingControlName": "RCTwo", "RoutingControlState": "Off" } ]

2. Get a routing control state.

aws route53-recovery-cluster get-routing-control-state --routing-control-arn \ arn:aws:route53-recovery-control::111122223333:controlpanel/0123456bbbbbbb0123456bbbbbb0123456/routingcontrol/abcdefg1234567 \ --region us-west-2 \ --endpoint-url https://host-dddddd.us-west-2.example.com/v1
{"RoutingControlArn": "arn:aws:route53-recovery-control::111122223333:controlpanel/0123456bbbbbbb0123456bbbbbb0123456/routingcontrol/abcdefg1234567", "RoutingControlName": "RCOne", "RoutingControlState": "On" }

To route traffic to the target endpoint controlled by the routing control, you update the routing control state to On. Update the routing control state by running the command update-routing-control-state. (When the request is successful, the response is empty.)

2a. Update a routing control state.

aws route53-recovery-cluster update-routing-control-state \ --routing-control-arn \ arn:aws:route53-recovery-control::111122223333:controlpanel/0123456bbbbbbb0123456bbbbbb0123456/routingcontrol/abcdefg1234567 \ --routing-control-state On \ --region us-west-2 \ --endpoint-url https://host-dddddd.us-west-2.example.com/v1
{}

You can update several routing controls at the same time with one API call: update-routing-control-states. (When the request is successful, the response is empty.)

2b. Update several routing control states at once (batch updates).

aws route53-recovery-cluster update-routing-control-states \ --update-routing-control-state-entries \ '[{"RoutingControlArn": "arn:aws:route53-recovery-control::111122223333:controlpanel/0123456bbbbbbb0123456bbbbbb0123456/routingcontrol/abcdefg1234567", "RoutingControlState": "Off"}, \ {"RoutingControlArn": "arn:aws:route53-recovery-control::111122223333:controlpanel/0123456bbbbbbb0123456bbbbbb0123456/routingcontrol/hijklmnop987654321", "RoutingControlState": "On"}]' \ --region us-west-2 \ --endpoint-url https://host-dddddd.us-west-2.example.com/v1
{}