Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws_ecs_patterns: Allow setting containerName of ScheduledFargateTask and ScheduledEc2Task #30281

Closed
1 of 2 tasks
Assignees
Labels
@aws-cdk/aws-ecs-patterns Related to ecs-patterns library effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Comments

@dleavitt
Copy link

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.

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

@dleavitt dleavitt added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels May 20, 2024
@github-actions github-actions bot added the @aws-cdk/aws-ecs-patterns Related to ecs-patterns library label May 20, 2024
@khushail khushail self-assigned this May 21, 2024
@khushail khushail added investigating This issue is being investigated and/or work is in progress to resolve the issue. p2 effort/small Small work item – less than a day of effort effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. investigating This issue is being investigated and/or work is in progress to resolve the issue. effort/small Small work item – less than a day of effort labels May 21, 2024
@khushail
Copy link
Contributor

Thanks @dleavitt for submitting this FR.

@khushail khushail removed their assignment May 22, 2024
@moelasmar moelasmar self-assigned this May 28, 2024
@mergify mergify bot closed this as completed in #30357 May 28, 2024
mergify bot pushed a commit that referenced this issue May 28, 2024
… fargate tasks (#30357)

### Issue # (if applicable)

Closes #30281
Closes #27515

### Reason for this change

The customers have difficulties to find the correct logs for some scheduled task if they have multiple tasks defined in the stack, as all tasks will use the same container name.

### Description of changes

Add the new optional property `ContainerName` in the `ScheduledTaskImageProps`, so customer can use it to customize the containers names. If this property is undefined, so we will use `ScheduledContainer` as default value.

### Description of how you validated changes

added unit and integration test cases, and verified them.

### Checklist
- [X] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

atanaspam pushed a commit to atanaspam/aws-cdk that referenced this issue Jun 3, 2024
… fargate tasks (aws#30357)

### Issue # (if applicable)

Closes aws#30281
Closes aws#27515

### Reason for this change

The customers have difficulties to find the correct logs for some scheduled task if they have multiple tasks defined in the stack, as all tasks will use the same container name.

### Description of changes

Add the new optional property `ContainerName` in the `ScheduledTaskImageProps`, so customer can use it to customize the containers names. If this property is undefined, so we will use `ScheduledContainer` as default value.

### Description of how you validated changes

added unit and integration test cases, and verified them.

### Checklist
- [X] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
vdahlberg pushed a commit to vdahlberg/aws-cdk that referenced this issue Jun 10, 2024
… fargate tasks (aws#30357)

### Issue # (if applicable)

Closes aws#30281
Closes aws#27515

### Reason for this change

The customers have difficulties to find the correct logs for some scheduled task if they have multiple tasks defined in the stack, as all tasks will use the same container name.

### Description of changes

Add the new optional property `ContainerName` in the `ScheduledTaskImageProps`, so customer can use it to customize the containers names. If this property is undefined, so we will use `ScheduledContainer` as default value.

### Description of how you validated changes

added unit and integration test cases, and verified them.

### Checklist
- [X] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@aws-cdk-automation
Copy link
Collaborator

Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.

@aws aws locked as resolved and limited conversation to collaborators Jul 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.