Enable controls across an organization
To enable a control across an organization, deploy an
AWS::CloudFormation::HookTypeConfig resource for each control with
service-managed CloudFormation StackSets. Settings can differ by organizational unit (OU). For
example, you can set a control to FAIL mode in a production OU and to
WARN mode in a development OU.
Create a template that sets a control's mode
The following template contains one AWS::CloudFormation::HookTypeConfig
resource that configures the AWS::Controls::IAMRoleInUseRemoved control.
The FailureMode parameter sets the mode for each stack set that you create
from the template.
AWSTemplateFormatVersion: 2010-09-09 Parameters: FailureMode: Type: String AllowedValues: - FAIL - WARN Resources: IAMRoleInUseRemovedConfig: Type: AWS::CloudFormation::HookTypeConfig Properties: TypeName: AWS::Controls::IAMRoleInUseRemoved Configuration: !Sub '{"CloudFormationConfiguration":{"HookConfiguration":{"HookInvocationStatus":"ENABLED","FailureMode":"${FailureMode}"}}}'
Deploy the template to organizational units with StackSets
Create one stack set for each mode, and then create stack instances in the OUs that
use that mode. The following example sets FAIL mode in a production OU and
WARN mode in a development OU.
To enable a control across an organization (AWS CLI)
-
Use the create-stack-set command to create the stack set for the production OU.
aws cloudformation create-stack-set \ --stack-set-nameProactiveControlsProd\ --template-bodyfile://template.yaml\ --parameters ParameterKey=FailureMode,ParameterValue=FAIL \ --permission-model SERVICE_MANAGED \ --auto-deployment Enabled=true,RetainStacksOnAccountRemoval=false -
Use the create-stack-instances command to deploy the stack set to the production OU.
aws cloudformation create-stack-instances \ --stack-set-nameProactiveControlsProd\ --deployment-targets OrganizationalUnitIds=ou-1111-11111111\ --regionsus-east-1 -
Create the stack set for the development OU with
WARNmode.aws cloudformation create-stack-set \ --stack-set-nameProactiveControlsDev\ --template-bodyfile://template.yaml\ --parameters ParameterKey=FailureMode,ParameterValue=WARN \ --permission-model SERVICE_MANAGED \ --auto-deployment Enabled=true,RetainStacksOnAccountRemoval=false -
Deploy the stack set to the development OU.
aws cloudformation create-stack-instances \ --stack-set-nameProactiveControlsDev\ --deployment-targets OrganizationalUnitIds=ou-2222-22222222\ --regionsus-east-1