aws / aws/aws-cdk

aws-ecs-patterns: add support for `pidMode` in `ApplicationLoadBalancedFargateService`

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

Description

### Describe the feature

I'd like to configure the `pidMode` for the fargate task definition that I'm building using the `aws-ecs-patterns.ApplicationLoadBalancedFargateService` construct. However, the construct takes a `ApplicationLoadBalancedFargateServiceProps` object which doesn't allow configuring `pidMode`.

It'd be great to add `pidMode` as an option to `ApplicationLoadBalancedFargateServiceProps` so that this can be configured without having to build a full `FargateTaskDefinition` construct.

### Use Case

I need to configure `pidMode` so that I can monitor [live process information my fagate ecs tasks with DataDog](https://docs.datadoghq.com/infrastructure/process/?tab=awsecsfargate#installation). Replacing my use of `taskImageOptions` with a new `taskDefinition` property will cause a full replacement of my task definition which i'm trying to avoid. I'm surprised that `taskImageOptions` doesn't support `pidMode`.

### Proposed Solution

Add an optional `pidMode` property to `FargateServiceBaseProps` and if specified, provide it to the `FargateTaskDefinition` construct created in `application-load-balanced-fargate-service.ts`

```typescript
...

this.taskDefinition = new FargateTaskDefinition(this, 'TaskDef', {
memoryLimitMiB: props.memoryLimitMiB,
cpu: props.cpu,
ephemeralStorageGiB: props.ephemeralStorageGiB,
executionRole: taskImageOptions.executionRole,
taskRole: taskImageOptions.taskRole,
family: taskImageOptions.family,
runtimePlatform: props.runtimePlatform,
pidMode: props.pidMode,
});

...
```

### Other Information

Related Issues:

- https://github.com/aws/aws-cdk/issues/29995
- https://github.com/aws/aws-cdk/issues/29619

### Acknowledgements

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

### CDK version used

2.148.1

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

macOS Sonoma 14.6.1, Macbook Pro 2021, Apple m1 Max

Contributor guide

Open the contributing guide

Research direction

Start in application-load-balanced-fargate-service.ts and inspect ApplicationLoadBalancedFargateServiceProps, FargateServiceBaseProps, and the FargateTaskDefinition construction. Add the optional pidMode path described in the issue, then verify that configuring it through taskImageOptions reaches the generated task definition without requiring a replacement taskDefinition.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.