ecs: create Ec2Service or FargateService with imported TaskDefinition
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
`FargateService` requires the `TaskDefinition` type and using existing task definition is not allowed.
https://github.com/aws/aws-cdk/blob/c304d24d313ef61d8cc6b110df9ba4f3f441d133/packages/%40aws-cdk/aws-ecs/lib/fargate/fargate-service.ts#L17
### Use Case
Becasue cloudformation is missing some features such as TaskDefinition with EFS support, we may create our own task definition with CLI or console and allow CDK to create Fargate service by importing the existing task definition.
### Proposed Solution
Maybe we can simply use `ITaskDefinition` instead?
The drawback is we will not be able to check the defaultContainer here.
https://github.com/aws/aws-cdk/blob/c304d24d313ef61d8cc6b110df9ba4f3f441d133/packages/%40aws-cdk/aws-ecs/lib/fargate/fargate-service.ts#L167-L169
### Other
* [ ] :wave: I may be able to implement this feature request
* [ ] :warning: This feature might incur a breaking change
---
This is a :rocket: Feature Request
Contributor guide
Research direction
Start in packages/@aws-cdk/aws-ecs/lib/fargate/fargate-service.ts, especially the TaskDefinition type and the defaultContainer check around lines 167-169. Trace how FargateService consumes task definitions and determine the expected behavior for an imported task definition; done means an existing task definition can be used to create the service without losing necessary validation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100