Create ECS Service with existing task definition ARN
See original GitHub issueReproduction Steps
Now our customers cannot create an ECS service using an existing task definition ARN although we have fromFargateTaskDefinitionARN()
and fromEc2TaskDefinitionARN()
.
Related to https://github.com/aws-samples/aws-cdk-examples/issues/112
Error Log
Environment
- CLI Version :
- Framework Version:
- OS :
- Language :
Other
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 4 years ago
- Reactions:24
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Creating a task definition using the new console
Open the new console at https://console.aws.amazon.com/ecs/v2 . · In the navigation pane, choose Task definitions · Choose Create new task definition, Create new ......
Read more >update-service — AWS CLI 2.9.9 Command Reference
For services using an external deployment controller, you can update only the desired count, task placement constraints and strategies, health check grace ...
Read more >clearvoice/aws-ecs - CircleCI Developer Hub
Registers a task definition for the given ECS service and updates the service to use it. Optionally polls the status of the deployment...
Read more >aws_ecs_task_definition | Resources | hashicorp/aws
task_role_arn - (Optional) ARN of IAM role that allows your Amazon ECS container task to make calls to other AWS services. volume -...
Read more >aws.ecs.Service - Pulumi
Family and revision ( family:revision ) or full ARN of the task definition that you want to run in your service. Required unless...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For anyone still trying to create a service with a task definition ARN, here’s a temporary workaround. It can be done with “Raw Overrides”. Documented here: https://docs.aws.amazon.com/cdk/latest/guide/cfn_layer.html
You’ll need to create a service with a temporary task definition (can be done easily with CDK), and then overwrite that Task Definition with a new Task Definition.
Our reasons for using this is similar to @machielg, to mount an EFS volume to a Fargate task, which is not currently supported by CloudFormation.
I found this technique in @michaelmoussa’s example.
So in this case:
Here’s a gist showing how to create a Fargate + EFS service currently, adapted from @michaelmoussa’s examples. Hope this can help anyone, while the main issue is being fixed.
https://gist.github.com/cajames/3daec680b1101c8358e2ff30dfadd52a
Because I just spent a few hours trying to figure out why using addPropertyOverride didn’t work and resulted in strange error messages about invalid parameter types during deployment, maybe this is useful for someone else. Set the task-definition using the member instead of using addPropertyOverride:
Note: Using addPropertyOverride resulted in both, the old and the new task-definition attached to the service in the cloudformation template for me.