CloudFormation stacks should publish notifications so operators are alerted to important stack events, such as failed deployments or unexpected stack changes. Without notifications, security incidents or configuration drift can go undetected and response times increase. In Ansible, tasks using the amazon.aws.cloudformation or legacy cloudformation module must define the notification_arns parameter and set it to one or more SNS topic ARNs. Resources missing notification_arns are flagged for remediation.
Secure example:
- name:Create or update CloudFormation stack with notificationsamazon.aws.cloudformation:stack_name:my-stackstate:presenttemplate_body:"{{ lookup('file', 'template.yaml') }}"notification_arns:- arn:aws:sns:us-east-1:123456789012:stack-notifications
Compliant Code Examples
- name:create a stack, pass in the template via an URLamazon.aws.cloudformation:stack_name:ansible-cloudformationstack_policy:wowowowoowownotification_arns:a, bstate:presentregion:us-east-1disable_rollback:truetemplate_url:https://s3.amazonaws.com/my-bucket/cloudformation.templatetemplate_parameters:KeyName:jmartinDiskType:ephemeralInstanceType:m1.smallClusterSize:3tags:Stack:ansible-cloudformation
Non-Compliant Code Examples
- name:create a stack, pass in the template via an URLamazon.aws.cloudformation:stack_name:"ansible-cloudformation"state:presentregion:us-east-1disable_rollback:truetemplate_url:https://s3.amazonaws.com/my-bucket/cloudformation.templatetemplate_parameters:KeyName:jmartinDiskType:ephemeralInstanceType:m1.smallClusterSize:3tags:Stack:ansible-cloudformation
1
2
rulesets:- Ansible / AWS # Rules to enforce / AWS.
맞춤형 데모 요청
Datadog 시작하기
Ask AI
AI-generated responses may be inaccurate. Verify important info.