Cloudwatch rule to match ssm hierarchy

I'd like to create a cloudwatch rule to trigger an action whenever a SSM parameter in a given hiearchy is updated (in my example anything in the /config hierarchy)

If I put a rule matching the whole name of the parameter the action gets triggered correctly.

I tried the following thus far:

    {
  "source": [
    "aws.ssm"
  ],
  "detail-type": [
    "Parameter Store Change"
  ],
  "detail": {
    "name": [
      "/config/",
      "/config/*",
      "/config/%"
    ],
    "operation": [
      "Update"
    ]
  }
}

Is there any way to achieve such behaviour ?

Upvotes: 0

Views: 58

Answers (2)

victorg
victorg

Reputation: 41

According to the AWS doc, matching using wildcards is supported in event bus rules only. [https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-create-pattern-operators.html#eb-filtering-wildcard-matching][1]

For this specific use case you can use prefix matching :

{
  "detail": {
    "name": [{
      "prefix": "/config/"
    }],
    "operation": ["Update"]
  },
  "detail-type": ["Parameter Store Change"],
  "source": ["aws.ssm"]
}

Late response, but hopefully helpful for anyone looking for an answer.

Upvotes: 0

Jeff A.
Jeff A.

Reputation: 1

Not exactly what you want, but you can leave off the "name" array entirely. You will then get notifications for all parameters, and then filter from the message receive side.

Upvotes: 0

Related Questions