linux - 从 shell 向 CloudWatch 发送事件

标签 linux shell amazon-web-services amazon-cloudwatch

我有一个问题

我需要从 EC2 容器内的 shell 脚本向 AWS CloudWatch 发送事件。可能吗?

感谢帮助

最佳答案

您可以使用 AWS CLI 来执行此操作。

aws events put-events --entries file://putevents.json

putevents.json 中的以下内容:

[
  {
    "Source": "com.mycompany.myapp",
    "Detail": "{ \"key1\": \"value1\", \"key2\": \"value2\" }",
    "Resources": [
      "resource1",
      "resource2"
    ],
    "DetailType": "myDetailType"
  },
  {
    "Source": "com.mycompany.myapp",
    "Detail": "{ \"key1\": \"value3\", \"key2\": \"value4\" }",
    "Resources": [
      "resource1",
      "resource2"
    ],
    "DetailType": "myDetailType"
   }
]

完整引用:

https://docs.aws.amazon.com/cli/latest/reference/events/put-events.html

关于linux - 从 shell 向 CloudWatch 发送事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53326445/

相关文章:

c# - 从托管代码调用 SHCreateItemFromParsingName 时是否需要释放资源?

linux - Linux 中 bin 目录应该放在哪里?

regex - 如何在 VIM 中使用正则表达式检测代码行

linux - shell 脚本中的信号处理

bash - `test -n $a` 和 `test -n "$a"` 之间的区别

amazon-web-services - 提供的 region_name 'US East (Ohio) us-east-2' 与支持的格式不匹配

node.js - 如何使用 AND & OR 编写 DynamoDB 查询过滤器?

amazon-web-services - 无法更改网络接口(interface)的安全组

c - C中的fwide函数是什么

linux - 如何创建带有 FEXTRA 和 FCOMMENT 字段的 gzip 文件