diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-load-balanced-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-load-balanced-service-base.ts index 92bc1d8f34154..214e4664e1641 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-load-balanced-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-load-balanced-service-base.ts @@ -296,6 +296,32 @@ export interface NetworkLoadBalancedTaskImageOptions { * @default - No labels. */ readonly dockerLabels?: { [key: string]: string }; + + /** + * The entry point that's passed to the container. + * + * This parameter maps to `Entrypoint` in the [Create a container](https://docs.docker.com/engine/api/v1.38/#operation/ContainerCreate) section + * of the [Docker Remote API](https://docs.docker.com/engine/api/v1.38/) and the `--entrypoint` option to + * [docker run](https://docs.docker.com/engine/reference/commandline/run/). + * + * For more information about the Docker `ENTRYPOINT` parameter, see https://docs.docker.com/engine/reference/builder/#entrypoint. + * + * @default none + */ + readonly entryPoint?: string[]; + + /** + * The command that's passed to the container. If there are multiple arguments, make sure that each argument is a separated string in the array. + * + * This parameter maps to `Cmd` in the [Create a container](https://docs.docker.com/engine/api/v1.38/#operation/ContainerCreate) section + * of the [Docker Remote API](https://docs.docker.com/engine/api/v1.38/) and the `COMMAND` parameter to + * [docker run](https://docs.docker.com/engine/reference/commandline/run/). + * + * For more information about the Docker `CMD` parameter, see https://docs.docker.com/engine/reference/builder/#cmd. + * + * @default none + */ + readonly command?: string[]; } /** diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/network-load-balanced-ecs-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/network-load-balanced-ecs-service.ts index 65c8970912b14..ca6aa054c843a 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/network-load-balanced-ecs-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/network-load-balanced-ecs-service.ts @@ -126,6 +126,8 @@ export class NetworkLoadBalancedEc2Service extends NetworkLoadBalancedServiceBas secrets: taskImageOptions.secrets, logging: logDriver, dockerLabels: taskImageOptions.dockerLabels, + command: taskImageOptions.command, + entryPoint: taskImageOptions.entryPoint, }); container.addPortMappings({ containerPort: taskImageOptions.containerPort || 80, diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/network-load-balanced-fargate-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/network-load-balanced-fargate-service.ts index cf5b0389914c8..efe45c6508da3 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/network-load-balanced-fargate-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/network-load-balanced-fargate-service.ts @@ -1,6 +1,6 @@ import { Construct } from 'constructs'; import { ISecurityGroup, SubnetSelection } from '../../../aws-ec2'; -import { FargateService, FargateTaskDefinition } from '../../../aws-ecs'; +import { FargateService, FargateTaskDefinition, HealthCheck } from '../../../aws-ecs'; import { FeatureFlags } from '../../../core'; import * as cxapi from '../../../cx-api'; import { FargateServiceBaseProps } from '../base/fargate-service-base'; @@ -31,6 +31,13 @@ export interface NetworkLoadBalancedFargateServiceProps extends NetworkLoadBalan * @default - A new security group is created. */ readonly securityGroups?: ISecurityGroup[]; + + /** + * The health check command and associated configuration parameters for the container. + * + * @default - Health check configuration from container. + */ + readonly healthCheck?: HealthCheck; } /** @@ -79,10 +86,13 @@ export class NetworkLoadBalancedFargateService extends NetworkLoadBalancedServic const containerName = taskImageOptions.containerName ?? 'web'; const container = this.taskDefinition.addContainer(containerName, { image: taskImageOptions.image, + healthCheck: props.healthCheck, logging: logDriver, environment: taskImageOptions.environment, secrets: taskImageOptions.secrets, dockerLabels: taskImageOptions.dockerLabels, + command: taskImageOptions.command, + entryPoint: taskImageOptions.entryPoint, }); container.addPortMappings({ containerPort: taskImageOptions.containerPort || 80,