Description
Use SNS if a job needs to start when CloudTrail delivers a new log file to S3. Individual event alerts need their own monitoring.
Potential impact
A job that relies on SNS may remain idle even after a log file reaches the bucket.
Remediation
Set sns_topic_name to your topic, permit CloudTrail to publish, and subscribe the receiving system. Verify that the system receives a notification for a new file.
Examples
The first two tasks omit the topic name or leave it empty. Replace some_topic_name in the last task with your topic. Use amazon.aws.cloudtrail for new playbooks.
Before
yaml
- name: Create CloudTrail
community.aws.cloudtrail:
state: present
name: default
s3_bucket_name: mylogbucket
s3_key_prefix: cloudtrail
region: us-east-1
- name: Create CloudTrail2
community.aws.cloudtrail:
state: present
name: default
s3_bucket_name: mylogbucket
s3_key_prefix: cloudtrail
region: us-east-1
sns_topic_name:
After
yaml
- name: Create CloudTrail
community.aws.cloudtrail:
state: present
name: default
s3_bucket_name: mylogbucket
s3_key_prefix: cloudtrail
region: us-east-1
sns_topic_name: some_topic_name