1 Answer
- Newest
- Most votes
- Most comments
0
Hi, When using Amazon EventBridge Pipes you should be able to pass the body of the SQS payload using the "$.body" expression directly in your ECS Run Task Target Definition.
You will need to replace your settings variables with values from CloudFormation/CDK and convert the existing call to a JSON. Then use the Input Transformer to extract the SQS Message body and pass it to the ECS Run Task Target.
Something like this:
{
"cluster": "cluster-name",
"taskDefinition": "task-definition",
"count": 1,
"enableECSManagedTags": "True",
"enableExecuteCommand": "True",
"launchType": "FARGATE",
"networkConfiguration": {
"awsvpcConfiguration": {
"subnets": [
"subnets"
],
"securityGroups": [
"security-groups-ids"
]
}
},
"overrides": {
"containerOverrides": [
{
"command": [
"python3",
"task_path",
"--request",
<$.body>
],
"name": "container-task-name"
}
]
}
}
The following github sample provides CDK to deploy this scenario: https://github.com/rhlarora84/sqs-fargate-eventbridge-pipe/blob/main/lib/app-stack.ts
answered a year ago
Relevant content
- asked 6 months ago
- asked 3 years ago
- AWS OFFICIALUpdated 10 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
Thank you for your answer, the template which you have given is for the event bridge pipe. I was asking how to do the same overriding in the Event bridge rule.
in event bridge rule there is Input transformer and in documentation it is mentioned that it will pass the message but how to receive in the dockerfile or the python file as in case of event bridge pipe the CMD of dockerfile is override and the message is passed as an argument.