Skip to content

@aws-cdk/aws-ecs-patterns: Add ability to set healthCheck for QueueProcessingFargateService #15636

@paya-cz

Description

@paya-cz

QueueProcessingFargateService currently does not offer healthCheck options property, even though it is very simple to add it here:

this.taskDefinition.addContainer(containerName, {

So, there is no good way to set a healthCheck on a container.

Use Case

I use healthcheck to make sure the tasks are healthy. Fargate ignores HEALTHCHECK instruction in Dockerfile, so I am forced to supply the healthCheck instruction via CDK. However, QueueProcessingFargateService does not let me.

Proposed Solution

Add a healthcheck property here:

export interface QueueProcessingFargateServiceProps extends QueueProcessingServiceBaseProps {

Pass it to the container here:

this.taskDefinition.addContainer(containerName, {

Workaround

This is not nice, but works.

// @ts-ignore
service.taskDefinition.defaultContainer!.props.healthCheck = <ecs.HealthCheck>{
    command: ['CMD', 'node /app/healthcheck.js'],
    interval: cdk.Duration.seconds(15),
    retries: 3,
    timeout: cdk.Duration.seconds(5),
};

This is a 🚀 Feature Request

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-ecs-patternsRelated to ecs-patterns libraryeffort/smallSmall work item – less than a day of effortfeature-requestA feature should be added or improved.feature/enhancementA new API to make things easier or more intuitive. A catch-all for general feature requests.p2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions