Skip to content
GitHubXDiscordRSS

SafetyRule

Learn how to create, update, and manage AWS Route53RecoveryControl SafetyRules using Alchemy Cloud Control.

The SafetyRule resource lets you manage AWS Route53RecoveryControl SafetyRules that define the conditions under which traffic is allowed to flow to your resources.

Create a basic safety rule with required properties and an optional assertion rule.

import AWS from "alchemy/aws/control";
const safetyRule = await AWS.Route53RecoveryControl.SafetyRule("basicSafetyRule", {
ControlPanelArn: "arn:aws:route53-recovery-control::123456789012:controlpanel:example-control-panel",
RuleConfig: {
Type: "ALL_REQUIRED", // Example rule config type
Threshold: 2 // Minimum number of assertions for the rule to be satisfied
},
AssertionRule: {
AssertedControls: [
"arn:aws:route53-recovery-control::123456789012:control:example-control-1",
"arn:aws:route53-recovery-control::123456789012:control:example-control-2"
]
},
Name: "BasicSafetyRule"
});

Configure a safety rule with a gating rule to control traffic flow under specific conditions.

const advancedSafetyRule = await AWS.Route53RecoveryControl.SafetyRule("advancedSafetyRule", {
ControlPanelArn: "arn:aws:route53-recovery-control::123456789012:controlpanel:example-control-panel",
RuleConfig: {
Type: "ANY_REQUIRED",
Threshold: 1
},
GatingRule: {
GatingControls: [
"arn:aws:route53-recovery-control::123456789012:control:example-control-3"
],
WaitPeriodMs: 30000 // Wait period of 30 seconds for gating check
},
Name: "AdvancedSafetyRule"
});

Create a safety rule with tags for better resource management and identification.

const taggedSafetyRule = await AWS.Route53RecoveryControl.SafetyRule("taggedSafetyRule", {
ControlPanelArn: "arn:aws:route53-recovery-control::123456789012:controlpanel:example-control-panel",
RuleConfig: {
Type: "ALL_REQUIRED",
Threshold: 2
},
Tags: [
{ Key: "Environment", Value: "Production" },
{ Key: "Team", Value: "DevOps" }
],
Name: "TaggedSafetyRule"
});