[英]Updating rather than replacing ECS Task Definition with CloudFormation
When updating a TaskDefinition in CloudFormation the docs say that a replacement action occurs - http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html在 CloudFormation 中更新 TaskDefinition 时,文档说发生了替换操作 - http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html
Is there a way to get that to be a new revision?有没有办法让它成为一个新的修订版? Should I be using the family parameter?
我应该使用family参数吗? Is there a TaskDefinition limit?
有任务定义限制吗? Otherwise I end up with a large number of inactive definitions.
否则,我最终会得到大量不活动的定义。
ContainerDefinitions:
- Name: container
Essential: 'true'
Image: image:tag
PortMappings:
- ContainerPort: 80
HostPort: 80
Protocol: 'tcp'
TaskRoleArn: 'arn:aws:iam::role'
Yes, in order to put your changes in a new revision of the same Task Definition you should use the Family
parameter. 是的,为了将更改放在同一任务定义的新修订版中,您应该使用
Family
参数。 Quoting from the official documentation : 引自官方文件 :
Family
家庭
The name of a family that this task definition is registered to.
此任务定义注册到的族的名称。 A family groups multiple versions of a task definition.
一个族将多个版本的任务定义分组。
CloudFormation will still consider this a "replacement" and will delete the old revision, however it will not create a new Task Definition if you use the Family
parameter. CloudFormation仍会将此视为“替换”,并将删除旧版本,但如果您使用
Family
参数,则不会创建新的任务定义。
Actually, parameter Family , as decribed above is not working, even you inform it, Task Definition are replaced, but I saw in other thread that you can do it using following sintaxe in your template:实际上,如上所述的参数 Family 不起作用,即使您通知它,任务定义也会被替换,但我在其他线程中看到您可以在模板中使用以下 sintaxe 来完成:
...
"Type": "AWS::ECS::TaskDefinition",
"UpdateReplacePolicy": "Retain",
"Properties": {
....
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.