-
Notifications
You must be signed in to change notification settings - Fork 4.5k
aws_ecs_patterns: Allow setting containerName of ScheduledFargateTask and ScheduledEc2Task #30281
Description
Describe the feature
Currently the container name for both of these constructs is hardcoded to "ScheduledContainer" and cannot be changed. The other constructs in this package accept a containerName parameter.
- EC2:
this.taskDefinition.addContainer('ScheduledContainer', { - Fargate:
aws-cdk/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/scheduled-fargate-task.ts
Line 81 in e4e8361
this.taskDefinition.addContainer('ScheduledContainer', {
Use Case
In the Cloudwatch logs, the stream name for ECS containers is always of the form:
prefix-name/container-name/ecs-task-id
The current behavior of these constructs means that the container-name will always be "ScheduledContainer", which is unhelpful if you have many scheduled tasks and are trying to find the right logs.
Proposed Solution
Allow passing a containerName as part of the taskImageOptions for these two constructs, as the other services in this package do.
Other Information
No response
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change
CDK version used
2.140.0 (build 46168aa)
Environment details (OS name and version, etc.)
MacOS 14.3