简体   繁体   English

AWS Cloudwatch不会在API调用上触发

[英]AWS Cloudwatch not triggering on API calls

I am trying to make a rule trigger on any API call for creation, but I haven't had any success. 我正在尝试对创建的任何API调用进行规则触发,但是我还没有成功。

I have another rule that triggers whenever and ec2 instance is running which works, but this rule does not trigger for RunInstances although I see the cloudtrail logs with RunInstances in the API log. 我有另一个规则,无论何时只要有一个ec2实例都在运行,它就会触发,并且可以运行,但是即使在API日志中看到带有RunInstances的cloudtrail日志,该规则也不会为RunInstances触发。

I have made a CloudWatch log from the cloudtrail and see the events that should be triggering it, but they don't. 我已经从cloudtrail制作了CloudWatch日志,并查看了应该触发该日志的事件,但事实并非如此。 Is there a step I am missing? 我缺少步骤了吗? What are the necessary components to have CloudWatch properly trigger on API calls? 什么是使CloudWatch正确触发API调用的必要组件?

The rule mentioned: 规则提到:

 {
      "source": [
        "aws.cloudtrail"
      ],
      "detail-type": [
        "AWS API Call via CloudTrail"
      ],
      "detail": {
        "eventSource": [
          "cloudtrail.amazonaws.com"
        ],
        "eventName": [
          "CreateUserPool",
          "CreateImage",
          "CreateCacheCluster",
          "RunInstances",
          "CreateActivation",
          "RunJobFlow ",
          "CreateVault",
          "CreateDeliveryStream",
          "CreateStream",
          "CreateCluster",
          "CreateDBInstance",
          "CreateHostedZone",
          "CreateBucket",
          "CreateLaunchConfiguration",
          "CreateStack",
          "CreateEnvironment",
          "CreateWorkspaces"
        ]
      }
    }

To add more detail here is the other rule I used to test CloudWatch 要在此处添加更多详细信息,这是我用来测试CloudWatch的另一条规则

{
  "source": [
    "aws.ec2"
  ],
  "detail-type": [
    "EC2 Instance State-change Notification"
  ],
  "detail": {
    "state": [
      "running"
    ]
  }
}

This is the log of the startInstances and the following Lambda function running. 这是startInstances和随后运行的Lambda函数的日志。 在此处输入图片说明

Cloudtrail of the the lambda function specifically which functions normally. lambda函数的Cloudtrail具体可以正常运行。

Lambda功能日志

Here is the API call which should also initiate it according to the rule, but it does not. 这是API调用,它也应根据规则启动它,但不是。 在此处输入图片说明

Hopefully these images make it clearer as to what I am having trouble with. 希望这些图像可以使我更清楚地了解所遇到的问题。

PS I didn't know how much info I should consider confidential, so I over censored PS:我不知道应该考虑多少信息保密,因此我进行了过多的审查

I misunderstood the rule I created. 我误解了我创建的规则。 I thought "AWS API calls from Cloudtrail" when using the cloudtrail Service meant all the information stored in Cloudtrail. 我以为使用cloudtrail服务时“从Cloudtrail调用AWS API”意味着所有存储在Cloudtrail中的信息。 That does not seem to be the case. 似乎并非如此。

As I mention in my comment, I am looking for other solutions for my problem, but I will make a separate question for that. 正如我在评论中提到的那样,我正在寻找其他解决方案来解决我的问题,但是我将为此提出一个单独的问题。 Thanks! 谢谢!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM