amazon-web-services - 如何在 Cloudformation 中按用户名隔离事件
问题描述
我正在使用 Cloudformation 自动化 AWS Cloudwatch 事件。
我想按类型分离事件:root如果发生任何 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 函数中。然后,该函数可以根据事件的主体进一步分发事件。
推荐阅读
- ruby - 在 `SecureRandom.hex` 上使用 `SecureRandom.base64` 的用例是什么?
- python - python中是否有所有字母数字符号的列表?
- java - SQS 队列 URL 不同于 AWS CLI 和 Java SDK
- javascript - Shiny:在非活动的 tabPanel 上更新 DT
- omnet++ - 静脉中的不同模型
- laravel - 数组到字符串转换电子邮件唯一验证 Laravel
- c# - GridLayout 或 RectTransform 问题
- algorithm - 旋转没有孙子的二叉树
- vb.net - VB删除文本文件中的文本块
- laravel - Laravel 5.6 - 如何实现 404 页面/路由