0

I am trying to add an eventbridge rule for whenever a codecommit repository is created trigger a lambda function. Below is my rule and I am not sure what to add on reference type or if is there is another rule that I can use.

  "source": [
    "aws.codecommit"
  ],
  "detail-type": [
    "CodeCommit Repository State Change"
  ],
  "detail": {
    "referenceType": ['']
    "event": ["referenceCreated"]
  }
}
keri1
  • 11
  • 2
  • Doesn't look like CodeCommit currently fires an EventBridge rule for when a repository is created, unfortunately ([See this AWS doc page](https://docs.aws.amazon.com/codecommit/latest/userguide/monitoring-events.html)). You'll have to enable CloudTrail and use a CloudTrail event. – Seafish Mar 21 '22 at 20:45

1 Answers1

0

Use the following event pattern1:

{
  "source": ["aws.codecommit"],
  "detail-type": ["AWS API Call via CloudTrail"],
  "detail": {
    "eventSource": ["codecommit.amazonaws.com"],
    "eventName": ["CreateRepository"]
  }
}

Disclaimer2:

To record events with a detail-type value of AWS API Call via CloudTrail, a CloudTrail trail with logging enabled is required.


1 Event name taken from underlying API call

2 Source for disclaimer

Kaustubh Khavnekar
  • 2,553
  • 2
  • 14