![](/img/trans.png)
[英]How to add Tags to ECS existing Service, Task definition using Terraform
[英]How to add tags to all ECS task definition in one go
我想在一个 go 中标记所有 9000 多个任务定义,请帮助我找到最好的方法。 我尝试使用 cmd aws ecs tag-resource --resource-arn 但它允许一次使用一个 arn。
您只能使用程序来执行此操作。 使用 AWS SDK,列出所有 ARN,遍历它们并在每个 ARN 上调用标签资源 api。 这是在 Python 中标记一堆表的方式:
session = boto3.Session(profile_name="my-region")
client = session.client('dynamodb')
# Get all DDB tables
tables = client.list_tables()
# Loop through tables
for table in tables['TableNames']:
print(f'Tagging table: {table}')
client.tag_resource(ResourceArn=f'arn:aws:dynamodb:us-east-1:xxx:table/{table}',Tags=[{'Key':'my_tag','Value':'my_tag_value'}])
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.