从 shell 向 CloudWatch 发送事件
Send event to CloudWatch from shell
我有一个问题
我需要从 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
我有一个问题
我需要从 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