Trigger CodePipeline using EventBridge by supplying the input variable for the codepipeline.

0

I have a codepipeline with with source as ECR. I have specified a pipeline variable and I want to trigger the pipeline using Eventbridge by supplying this variable dynamically from the event (assume that the particular value is present in the event details), So I wanted to know If it is possible to supply the variable dynamically via eventbridge if yes then please help me understand how to implement it. Below is the current eventbridge rule with target as my codepipeline.

{
  "source": ["aws.ecr"],
  "detail-type": ["ECR Image Action"],
  "detail": {
    "action-type": ["PUSH"],
    "result": ["SUCCESS"],
    "repository-name": ["my-repo-name"]
  }
}
1 Answer
0

Hi,

The way I would do that is with SSM System Manager Parameter Store: https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html

I would store the value of the variable that you want to pass to the Pipeline at the moment (i.e. right before) the event is fired: your description says that you know it at this moment. Then, I would add an initial stage to the pipeline to retrieve the value of the variable.

You can link the parameter name in SSM to the name (name of param = name of event type) or moment (by adding a timestamp when updated / created) of the EventBridge event if it makes retrieval easier.

Look at this KC article for additional details on how to do it: https://repost.aws/knowledge-center/ssm-reference-parameters

I often use SSM System Parameter to share such values across disjointed services.

Best,

Didier

profile pictureAWS
EXPERT
answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions