Reputation: 997
My CodePipeline is not getting triggered when I upload code.zip to s3-bucket or I copy code.zip using aws cli (aws s3 cp).
Cloudformation event Rule snippet:
Type: AWS::Events::Rule
Properties:
EventPattern:
source:
- 'aws.s3'
detail:
eventSource:
- 's3.amazonaws.com'
eventName:
- 'CopyObject'
- 'PutObject'
- 'CompleteMultipartUpload'
requestParameters:
bucketName:
- 's3-bucket'
key:
- 'code.zip'
State: 'ENABLED'
Targets:
-
Arn: <CodePipeline ARN>'
Id: 'Target-1'
RoleArn: <trigger role ARN>
Trigger role policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"codepipeline:StartPipelineExecution"
],
"Resource": "*"
}
]
}
Event Pattern:
{
"source": [
"aws.s3"
],
"detail": {
"eventSource": [
"s3.amazonaws.com"
],
"requestParameters": {
"bucketName": [
"s3-bucket"
],
"key": [
"code.zip"
]
},
"eventName": [
"CopyObject",
"PutObject",
"CompleteMultipartUpload"
]
}
}
What is missing here ? Or anyone has any pointers on how this can be debugged further?
Upvotes: 0
Views: 2437
Reputation: 997
The problem was events were not getting triggered out of S3 and when i enabled it from CloudTrail it worked.
Here is the related answer using which i resolved it: S3 object level events are not getting triggered
Upvotes: 0
Reputation: 968
There are two ways to further debug this.
First you want to ensure that you have a working event pattern. The easiest way to do this would to get a sample code-pipeline event and then make a test call via either https://docs.aws.amazon.com/eventbridge/latest/APIReference/API_TestEventPattern.html.
Next, if you have a working rule, you can check the metrics https://docs.aws.amazon.com/eventbridge/latest/userguide/eventbridge-monitoring-cloudwatch-metrics.html and setup DLQ https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html. Both provide visibility into if the rule had a match and was it successfully delivered.
Upvotes: 1