7

I am having a lambda function that trigger a Jenkins job. I want to invoke this lambda when a new ssm parameter is added. I have added the below Custom event pattern in the cloud-watch event pattern.

{
  "source": [
    "aws.ssm"
  ],
  "detail-type": [
    "Parameter Store Change",
    "Parameter Store Policy Action"
  ],
  "detail": {
      "name": [
          "/dev/*"
        ],
        "operation": [
          "Create",
          "Update",
          "Delete",
          "LabelParameterVersion"
  ]

}

}

This means, the lambda need to trigger if i create a ssm parameter start with "/dev/anystring" But the lambda is not triggering if i provide wild card. Any suggestion on this.?

1 Answer 1

13

In this case you want to use the prefix comparison operator to filter based on values in the detail.name field.

{
  "source": [
    "aws.ssm"
  ],
  "detail-type": [
    "Parameter Store Change",
    "Parameter Store Policy Action"
  ],
  "detail": {
    "name": [ { "prefix": "/dev/" } ],
    "operation": [
      "Create",
      "Update",
      "Delete",
      "LabelParameterVersion"
    ]
  }
}

For more details, see Reducing custom code by using advanced rules in Amazon EventBridge, especially example 2. All ATMs in New York City in the section Filtering events in a custom application.

I am contributing this on behalf of my employer, Amazon. My contribution is licensed under the MIT license. See here for a more detailed explanation.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.