nixmind
nixmind

Reputation: 2266

Cloudwatch event rule does not get codepipeline execution events

I would like to know if someone here have ever use cloudwatch rules to catch codepipeline execution event, based on event pattern.

This is the event pattern I set :

{
  "detail-type": [
    "CodePipeline Stage Execution State Change",
    "CodePipeline Action Execution State Change",
    "CodePipeline Pipeline Execution State Change"
  ],
  "resources": [
    "arn:aws:codepipeline:ap-southeast-1:XXXXXXXXXXXX:pipeline:cp-itops-servicecatalog-featuretest"
  ],
  "source": [
    "aws.codepipeline"
  ],
  "detail": {
    "pipeline": [
      "cp-itops-servicecatalog-featuretest"
    ],
    "state": [
      "FAILED"
    ]
  },
  "region": [
    "ap-southeast-1"
  ],
  "account": [
    "XXXXXXXXXXXX"
  ]
}

I've never catch any job failed from the above pipeline, while the pipeline is failing. I event remove the state property from the above event pattern in order to catch all events, but it doesn't work, I have never seen anything in the rule metrics in cloudwatch and the targeted lambda function is not invoked.

Is there a special tweak to let codepipeline send events to cloudwatch, or for cloudwatch to catch codepipeline events....???

Thanks.

Upvotes: 2

Views: 1867

Answers (1)

nixmind
nixmind

Reputation: 2266

I solved the issue by removing resources, account and region properties from the event pattern, like this :

{
  "detail-type": [
    "CodePipeline Stage Execution State Change",
    "CodePipeline Action Execution State Change",
    "CodePipeline Pipeline Execution State Change"
  ],
  "source": [
    "aws.codepipeline"
  ],
  "detail": {
    "pipeline": [
      "cp-itops-servicecatalog-featuretest"
    ],
    "state": [
      "FAILED"
    ]
  }
}

Upvotes: 1

Related Questions