I have a EventBridge (previously CloudWatch Events) Rule
and Target
that are used to launch ECS Task
s on a schedule (cron). I would like to apply some tags to the Task.
I tried including tags in RegisterTaskDefinition
, but this did not result in any tags being set on the Task
s, as RunTask
does not propagate tags if propagateTags
is unspecified.
PutTargets
is the action to create the event target that will eventually call RunTask
. I searched in ecsParameters
(EcsParameters
) and input
(TaskOverride
) for fields that would correspond to either tags
or propagateTags
from RunTask
but I could not find any corresponding fields.
Is there any way to apply tags to an ECS Task that is run from an EventBridge rule target?
2021-06-24 update (thanks @baxang): EventBridge has added ecsParameters.PropagateTags: "TASK_DEFINITION"
to the API documentation and to some SDKs yesterday (containers-roadmap#89)!
- python botocore 1.20.99
- js aws-sdk v2.933.0
- js @aws-sdk/client-eventbridge 3.20.0 @aws-sdk/client-cloudwatch-events 3.20.0 (2021-07-01 commit)
- aws-sdk-go v1.38.66
- aws-sdk-go-v2/service/eventbridge 1.7.0, aws-sdk-go-v2/service/cloudwatchevents 1.7.0 (2021-06-25 commit)
- java com.amazonaws aws-java-sdk-eventbridge 1.12.11 (commit)
- java software.amazon.awssdk eventbridge 2.16.98 (commit)
- .Net AWSSDK.EventBridge 3.7.68.0, AWSSDK.CloudWatchEvents 3.7.68.0 (commit)
- terraform provider aws aws_cloudwatch_event_target (source) (#19975, part of the 2021-07-15 v3.50.0 release)
- CloudFormation AWS::Events::Rule EcsParameters (2021-09-22)
It seems the API has
propagateTags
https://docs.aws.amazon.com/eventbridge/latest/APIReference/API_EcsParameters.html#eventbridge-Type-EcsParameters-PropagateTags so if you are launching the task via API, there seems to be a way.CloudFormation however does not support the property: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-ecsparameters.html. This issue(link) on aws-cloudformation/cloudformation-coverage-roadmap repo seems to be related.