如何解决如何在 Cloudformation 中按用户名隔离事件
我正在使用 Cloudformation 自动化 AWS Cloudwatch Events。
我想通过类型:root分离事件,如果发生任何根活动,我们需要得到警报。
InputPathsMap中的代码怎么写
EventRule01:
Type: AWS::Events::Rule
Properties:
Name: !Join
- ""
- - !GetAtt ResourceListAccountAlias.accountAlias
- Root-Account-Change-Detected
Description: "Triggers an alarm when AWS Root Account"
State: "ENABLED"
Targets:
- Arn: !Ref AlarmNotificationTopic01
Id: "001"
InputTransformer:
InputPathsMap:
eventSource: "$.detail.eventSource"
accountId: "$.detail.userIdentity.accountId"
principalId: "$.detail.userIdentity.principalId"
type: "$.detail.userIdentity"
eventTime: "$.detail.eventTime"
eventName: "$.detail.eventName"
InputTemplate: |
"The following event: <eventSource> was detected: <eventName> in account: <accountId>"
"This event was initiated by: <principalId> for this Account: <type> on: <eventTime>"
EventPattern:
detail-type:
- "AWS API Call via CloudTrail"
detail:
eventSource:
- "signin.amazonaws.com"
eventName:
- "ConsoleLogin"
解决方法
InputPathsMap
不是为了隔离事件。所以你不能做你想做的事。您必须为不同的用户创建不同的规则,或者将所有事件定向到 lambda 函数。然后,该函数可以根据事件的主体进一步分发事件。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。