Data protection and business continuity controls
Data protection and business continuity controls help developers and AI agents prevent common deployment mistakes. They check whether a stack operation deletes or replaces a resource that stores data your applications use or that your applications depend on. AWS builds the controls from the checks that AWS runs on its own infrastructure. For security and compliance requirements, AWS provides proactive controls from the Control Catalog. For more information, see Security and compliance controls from the Control Catalog.
Each control has a type name that starts with AWS::Controls::, which you use
with the AWS CLI. The controls are available at no additional charge in all AWS Regions
where CloudFormation is supported, except the AWS China Regions.
For a comparison of the two groups of AWS-managed proactive controls, see AWS-managed proactive controls.
What the controls check
The controls check stack operations that run through CloudFormation, before any resource changes. This includes AWS Cloud Development Kit (AWS CDK) and AWS Serverless Application Model deployments, change sets, and create, update, and delete operations. When you enable a control, it evaluates the stack operations that run after you enable it.
Controls that check whether a resource is still in use read the activity of the resource over a fixed window:
-
The last 24 hours for most resource types.
-
The last 7 days for IAM roles and Amazon S3 bucket policies.
When a resource has DeletionPolicy or UpdateReplacePolicy set to
Retain, CloudFormation keeps the resource, and the control reports no finding.
Controls enabled by default
Data protection controls that check whether a resource is still in use are enabled by
default in WARN mode in every account. You enable the other controls.
Control modes
Each control has one of the following modes:
-
WARN: The control reports the finding and lets the operation continue. -
FAIL: The control stops the operation before any resource changes. -
Disabled: The control is inactive.
If a control can't finish a check, a FAIL control stops the operation, and a
WARN control lets the operation continue.
Permissions to read resource activity
The controls read activity with the credentials of the caller, for example Amazon CloudWatch metrics and IAM role last-used data. The permissions are the same whether a control is enabled by default or enabled by you.
-
Controls that check whether a resource is still in use read CloudWatch metrics with
cloudwatch:GetMetricData. -
The IAM role in-use control reads IAM role last-used data with
iam:GetRole.
If the caller can't read the activity of a resource, a FAIL control stops
the operation and names the missing permission, and a WARN control lets the operation
continue.
The following example policy statement allows the actions that the controls use.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "cloudwatch:GetMetricData", "iam:GetRole" ], "Resource": "*" } ] }
You aren't charged for the CloudWatch calls that the controls make.
Enable, disable, or change the mode of a control
You can enable or disable a control and change its mode on the CloudFormation console or with the AWS CLI.
Enable, disable, or change the mode of a control (console)
To enable, disable, or change the mode of a control
Sign in to the AWS Management Console and open the CloudFormation console at https://console.aws.amazon.com/cloudformation
. -
On the navigation bar at the top of the screen, choose the AWS Region where you want to manage the control.
-
In the navigation pane on the left, choose Hooks.
-
On the Hooks page, find the control in the proactive controls table.
-
Enable or disable the control, and set its mode to
WARNorFAIL.
Enable, disable, or change the mode of a control (AWS CLI)
To enable, disable, or change the mode of a control (AWS CLI)
-
To list the controls, use the following list-types command.
aws cloudformation list-types \ --type HOOK \ --visibility PUBLIC \ --filters Category=AWS_MANAGED,TypeNamePrefix=AWS::Controls -
To enable a control and set its mode, use the following set-type-configuration command. This example enables the
AWS::Controls::IAMRoleInUseRemovedcontrol inFAILmode.aws cloudformation set-type-configuration \ --type HOOK \ --type-name AWS::Controls::IAMRoleInUseRemoved \ --configuration '{"CloudFormationConfiguration":{"HookConfiguration":{"HookInvocationStatus":"ENABLED","FailureMode":"FAIL"}}}'To disable a control, set
HookInvocationStatustoDISABLED. For more information about the configuration schema, see Hook configuration schema syntax reference.
Apply a control to specific stacks
To apply a control to specific stacks, add StackFilters to the
configuration. A control evaluates only the stacks that match its stack filter. The
following example applies a control to the stack named
OrdersStack.
"StackFilters": { "FilteringCriteria": "ALL", "StackNames": { "Include": ["OrdersStack"] } }
For more information about stack level filters, see CloudFormation Hooks stack level filters.
The following topics describe how to use the controls.