aws / aws/aws-cdk

aws-ecs-patterns: QueueProcessingFargateService should expose ScalableTaskCount

Open
#23,191 1 comment 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-ecs-patterns effort/small feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the feature

The high-level construct `QueueProcessingFargateService` [creates an autoscaling group](https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-ecs-patterns/lib/base/queue-processing-service-base.ts#L359) on behalf of the user. However, because only one such group can be created, this means that there's no way for a consumer of `QueueProcessingFargateService` to add policies to that group.

### Use Case

I'd like to add more autoscaling policies based on business logic. My only reprieve today is to extend `QueueProcessingFargateService` and override the protected `configureAutoScaling` [method](https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-ecs-patterns/lib/base/queue-processing-service-base.ts#L358), but this seems like an anti-pattern in CDK which favors composition over extension.

### Proposed Solution

1. Expose a new property in `QueueProcessingFargateService` with type [ScalableTaskCount](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.ScalableTaskCount.html) populated by the value created today in the link above (e.g. `const scalableTarget`).
2. (Optional) customers to bring their own ScalableTaskCount in `QueueProcessingFargateService`'s construct props.

### Other Information

_No response_

### Acknowledgements

- [X] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### CDK version used

2

### Environment details (OS name and version, etc.)

Linux

Contributor guide

Open the contributing guide

Research direction

Start in packages/@aws-cdk/aws-ecs-patterns/lib/base/queue-processing-service-base.ts at configureAutoScaling and the scalableTarget created there. Read the QueueProcessingFargateService construct props and ScalableTaskCount API, then verify the public construct exposes the created target so consumers can add autoscaling policies; the optional bring-your-own target needs a design decision.

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
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.