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
Is there a way to get that to be a new revision? Should I be using the family parameter? 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. 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.
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:
...
"Type": "AWS::ECS::TaskDefinition",
"UpdateReplacePolicy": "Retain",
"Properties": {
....
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.