(ecs-patterns): omiting cluster and specifying only vpc results in an error
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### What is the problem?
The ecs-patterns README states that 'Instead of providing a cluster you can specify a VPC and CDK will create a new ECS cluster.' However, omiting the cluster prop and only provided a vpc results in an error. And there is not clear direction on how to do this properly.
So far I have noticed this issue with the following constructs. It might apply to more.
- NetworkMultipleTargetGroupsEc2Service
- ApplicationMultipleTargetGroupsEc2Service
- ApplicationLoadBalancedEc2Service
This might just be a miss in the documentation, and not missing functionality. I will need to dive deeper into this to find out.
### Reproduction Steps
Synthesize and app with this sample code:
```
const stack = new Stack();
const vpc = new Vpc(stack, 'VPC');
const service = new ApplicationMultipleTargetGroupsEc2Service(stack, 'Service', {
vpc,
memoryLimitMiB: 1024,
taskImageOptions: {
image: ContainerImage.fromRegistry('test'),
},
});
```
### What did you expect to happen?
No errors, and it synthesizes an ECS service with a cluster created by the CDK.
### What actually happened?
I get this error:
```
[Default/Service/Service] Cluster for this service needs Ec2 capacity. Call addXxxCapacity() on the cluster.
```
### CDK CLI Version
1.139.0
### Framework Version
_No response_
### Node.js Version
12.22.7
### OS
MacOS
### Language
Typescript
### Language Version
_No response_
### Other information
_No response_
Contributor guide
Research direction
Start with the ecs-patterns README and the ApplicationMultipleTargetGroupsEc2Service, NetworkMultipleTargetGroupsEc2Service, and ApplicationLoadBalancedEc2Service constructs. Synthesize the provided VPC-only TypeScript example and trace the “Cluster for this service needs Ec2 capacity” error. Done means either the documented VPC-only usage synthesizes successfully or the README clearly explains the required configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100