m.zemlyanoi
m.zemlyanoi

Reputation: 337

Send event to CloudWatch from shell

I have a question

I need to send event to AWS CloudWatch from shell script inside EC2 container. Is it possible?

Thanks for help

Upvotes: 1

Views: 831

Answers (1)

kichik
kichik

Reputation: 34704

You can use the AWS CLI to do that.

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

With the following in 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"
   }
]

Full reference:

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

Upvotes: 1

Related Questions