Create an EventBridge rule for an Amazon ECR source (console) (original) (raw)

To create an EventBridge rule for use in CodePipeline operations (Amazon ECR source)
  1. Open the Amazon EventBridge console at https://console.aws.amazon.com/events/.
  2. In the navigation pane, choose Events.
  3. Choose Create rule, and then under Event source, from Service Name, chooseElastic Container Registry (ECR).
  4. In Event Source, choose Event Pattern.
    Choose Edit, and then paste the following example event pattern in the Event Source window for aeb-test repository with an image tag ofcli-testing:
{  
    "detail-type": [  
        "ECR Image Action"  
    ],  
    "source": [  
        "aws.ecr"  
    ],  
    "detail": {  
        "action-type": [  
            "PUSH"  
        ],  
        "image-tag": [  
            "latest"  
        ],  
        "repository-name": [  
            "eb-test"  
        ],  
        "result": [  
            "SUCCESS"  
        ]  
    }  
}  
  1. Choose Save.
    In the Event Pattern Preview pane, view the rule.
  2. In Targets, chooseCodePipeline.
  3. Enter the pipeline ARN for the pipeline to be started by this rule.
Note

You can find the pipeline ARN in the metadata output after you run theget-pipeline command. The pipeline ARN is constructed in this format:
arn:aws:codepipeline:region:account:pipeline-name
Sample pipeline ARN:
arn:aws:codepipeline:us-east-2:80398EXAMPLE:MyFirstPipeline 8. Create or specify an IAM service role that grants EventBridge permissions to invoke the target associated with your EventBridge rule (in this case, the target is CodePipeline).

  1. (Optional) To specify source overrides with a specific image ID, use the input transformer to pass the data as a JSON parameters.
    • Expand Additional settings.
      Under Configure target input, chooseConfigure input transformer.
      In the dialog window, choose Enter my own. In the Input path box, type the following key-value pairs.
    {"revisionValue": "$.detail.image-digest"}  
    • In the Template box, type the following key-value pairs.
    {  
            "sourceRevisions": {  
                "actionName": "Source",  
                "revisionType": "IMAGE_DIGEST",  
                "revisionValue": "<revisionValue>"  
            }  
        }  
    • Choose Confirm.
  2. Review your rule setup to make sure it meets your requirements.
  3. Choose Configure details.
  4. On the Configure rule details page, enter a name and description for the rule, and then choose State to enable the rule.
  5. If you're satisfied with the rule, choose Create rule.

Amazon ECR source actions and EventBridge

Create an EventBridge rule for an Amazon ECR source (CLI)

Did this page help you? - Yes

Thanks for letting us know we're doing a good job!

If you've got a moment, please tell us what we did right so we can do more of it.

Did this page help you? - No

Thanks for letting us know this page needs work. We're sorry we let you down.

If you've got a moment, please tell us how we can make the documentation better.