如何将标签传播到从 EventBridge 目标启动的 ECS 任务?
How to propogate tags to an ECS Task launched from an EventBridge Target?
我有一个 EventBridge(以前称为 CloudWatch Events)Rule
and Target
that are used to launch ECS Task
s on a schedule (cron)。我想为任务应用一些标签。
我试过在 RegisterTaskDefinition
, but this did not result in any tags being set on the Task
s, as RunTask
does not propagate tags if propagateTags
中包含标签未指定。
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
但我找不到任何对应的字段。
有什么方法可以将标签应用到来自 EventBridge 规则目标的 运行 的 ECS 任务?
2021-06-24 更新(感谢@baxang):EventBridge 已将 ecsParameters.PropagateTags: "TASK_DEFINITION"
添加到 API 文档和一些 SDK 昨天(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 提供商 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)
似乎 API 有 propagateTags
https://docs.aws.amazon.com/eventbridge/latest/APIReference/API_EcsParameters.html#eventbridge-Type-EcsParameters-PropagateTags 所以如果你通过 API 启动任务,似乎有办法。
但是 CloudFormation 不支持 属性:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-ecsparameters.html. This issue(link) on aws-cloudformation/cloudformation-coverage-roadmap 回购似乎是相关的。
我有一个 EventBridge(以前称为 CloudWatch Events)Rule
and Target
that are used to launch ECS Task
s on a schedule (cron)。我想为任务应用一些标签。
我试过在 RegisterTaskDefinition
, but this did not result in any tags being set on the Task
s, as RunTask
does not propagate tags if propagateTags
中包含标签未指定。
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
但我找不到任何对应的字段。
有什么方法可以将标签应用到来自 EventBridge 规则目标的 运行 的 ECS 任务?
2021-06-24 更新(感谢@baxang):EventBridge 已将 ecsParameters.PropagateTags: "TASK_DEFINITION"
添加到 API 文档和一些 SDK 昨天(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 提供商 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)
似乎 API 有 propagateTags
https://docs.aws.amazon.com/eventbridge/latest/APIReference/API_EcsParameters.html#eventbridge-Type-EcsParameters-PropagateTags 所以如果你通过 API 启动任务,似乎有办法。
但是 CloudFormation 不支持 属性:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-ecsparameters.html. This issue(link) on aws-cloudformation/cloudformation-coverage-roadmap 回购似乎是相关的。