diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/application-load-balanced-ecs-service.ts b/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/application-load-balanced-ecs-service.ts index 25a38144d6e3e..d1021a3377a9f 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/application-load-balanced-ecs-service.ts +++ b/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/application-load-balanced-ecs-service.ts @@ -79,6 +79,13 @@ export interface ApplicationLoadBalancedEc2ServiceProps extends ApplicationLoadB * @default - No strategies. */ readonly placementStrategies?: PlacementStrategy[]; + + /** + * Whether to enable the ability to execute into a container. + * + * @default true + */ + readonly enableExecuteCommand?: boolean; } /** @@ -94,6 +101,10 @@ export class ApplicationLoadBalancedEc2Service extends ApplicationLoadBalancedSe * The EC2 Task Definition in this construct. */ public readonly taskDefinition: Ec2TaskDefinition; + /** + * Whether enableExecuteCommand is enabled. + */ + public readonly enableExecuteCommand: boolean; /** * Constructs a new instance of the ApplicationLoadBalancedEc2Service class. @@ -101,6 +112,8 @@ export class ApplicationLoadBalancedEc2Service extends ApplicationLoadBalancedSe constructor(scope: Construct, id: string, props: ApplicationLoadBalancedEc2ServiceProps = {}) { super(scope, id, props); + this.enableExecuteCommand = props.enableExecuteCommand ?? true; + if (props.taskDefinition && props.taskImageOptions) { throw new Error('You must specify either a taskDefinition or taskImageOptions, not both.'); } else if (props.taskDefinition) { @@ -141,6 +154,7 @@ export class ApplicationLoadBalancedEc2Service extends ApplicationLoadBalancedSe cluster: this.cluster, desiredCount: desiredCount, taskDefinition: this.taskDefinition, + enableExecuteCommand: this.enableExecuteCommand, assignPublicIp: false, serviceName: props.serviceName, healthCheckGracePeriod: props.healthCheckGracePeriod, diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/application-multiple-target-groups-ecs-service.ts b/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/application-multiple-target-groups-ecs-service.ts index 6934ba66eac63..6c24c4c0f76d1 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/application-multiple-target-groups-ecs-service.ts +++ b/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/application-multiple-target-groups-ecs-service.ts @@ -74,6 +74,13 @@ export interface ApplicationMultipleTargetGroupsEc2ServiceProps extends Applicat * @default - No strategies. */ readonly placementStrategies?: PlacementStrategy[]; + + /** + * Whether to enable the ability to execute into a container. + * + * @default true + */ + readonly enableExecuteCommand?: boolean; } /** @@ -93,6 +100,10 @@ export class ApplicationMultipleTargetGroupsEc2Service extends ApplicationMultip * The default target group for the service. */ public readonly targetGroup: ApplicationTargetGroup; + /** + * Whether enableExecuteCommand is enabled. + */ + public readonly enableExecuteCommand: boolean; /** * Constructs a new instance of the ApplicationMultipleTargetGroupsEc2Service class. @@ -100,6 +111,8 @@ export class ApplicationMultipleTargetGroupsEc2Service extends ApplicationMultip constructor(scope: Construct, id: string, props: ApplicationMultipleTargetGroupsEc2ServiceProps = {}) { super(scope, id, props); + this.enableExecuteCommand = props.enableExecuteCommand ?? true; + if (props.taskDefinition && props.taskImageOptions) { throw new Error('You must specify only one of TaskDefinition or TaskImageOptions.'); } else if (props.taskDefinition) { @@ -160,6 +173,7 @@ export class ApplicationMultipleTargetGroupsEc2Service extends ApplicationMultip cluster: this.cluster, desiredCount: desiredCount, taskDefinition: this.taskDefinition, + enableExecuteCommand: this.enableExecuteCommand, assignPublicIp: false, serviceName: props.serviceName, healthCheckGracePeriod: props.healthCheckGracePeriod, diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/network-load-balanced-ecs-service.ts b/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/network-load-balanced-ecs-service.ts index 6b3798704f4e4..e7f5ee76d9031 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/network-load-balanced-ecs-service.ts +++ b/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/network-load-balanced-ecs-service.ts @@ -77,6 +77,13 @@ export interface NetworkLoadBalancedEc2ServiceProps extends NetworkLoadBalancedS * @default - No strategies. */ readonly placementStrategies?: PlacementStrategy[]; + + /** + * Whether to enable the ability to execute into a container. + * + * @default true + */ + readonly enableExecuteCommand?: boolean; } /** @@ -92,6 +99,10 @@ export class NetworkLoadBalancedEc2Service extends NetworkLoadBalancedServiceBas * The EC2 Task Definition in this construct. */ public readonly taskDefinition: Ec2TaskDefinition; + /** + * Whether enableExecuteCommand is enabled. + */ + public readonly enableExecuteCommand: boolean; /** * Constructs a new instance of the NetworkLoadBalancedEc2Service class. @@ -99,6 +110,8 @@ export class NetworkLoadBalancedEc2Service extends NetworkLoadBalancedServiceBas constructor(scope: Construct, id: string, props: NetworkLoadBalancedEc2ServiceProps = {}) { super(scope, id, props); + this.enableExecuteCommand = props.enableExecuteCommand ?? true; + if (props.taskDefinition && props.taskImageOptions) { throw new Error('You must specify either a taskDefinition or an image, not both.'); } else if (props.taskDefinition) { @@ -139,6 +152,7 @@ export class NetworkLoadBalancedEc2Service extends NetworkLoadBalancedServiceBas cluster: this.cluster, desiredCount: desiredCount, taskDefinition: this.taskDefinition, + enableExecuteCommand: this.enableExecuteCommand, assignPublicIp: false, serviceName: props.serviceName, healthCheckGracePeriod: props.healthCheckGracePeriod, diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/network-multiple-target-groups-ecs-service.ts b/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/network-multiple-target-groups-ecs-service.ts index 5e4b5a40c0a37..61133dcba79a4 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/network-multiple-target-groups-ecs-service.ts +++ b/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/network-multiple-target-groups-ecs-service.ts @@ -73,6 +73,13 @@ export interface NetworkMultipleTargetGroupsEc2ServiceProps extends NetworkMulti * @default - No strategies. */ readonly placementStrategies?: PlacementStrategy[]; + + /** + * Whether to enable the ability to execute into a container. + * + * @default true + */ + readonly enableExecuteCommand?: boolean; } /** @@ -92,6 +99,10 @@ export class NetworkMultipleTargetGroupsEc2Service extends NetworkMultipleTarget * The default target group for the service. */ public readonly targetGroup: NetworkTargetGroup; + /** + * Whether enableExecuteCommand is enabled. + */ + public readonly enableExecuteCommand: boolean; /** * Constructs a new instance of the NetworkMultipleTargetGroupsEc2Service class. @@ -99,6 +110,8 @@ export class NetworkMultipleTargetGroupsEc2Service extends NetworkMultipleTarget constructor(scope: Construct, id: string, props: NetworkMultipleTargetGroupsEc2ServiceProps = {}) { super(scope, id, props); + this.enableExecuteCommand = props.enableExecuteCommand ?? true; + if (props.taskDefinition && props.taskImageOptions) { throw new Error('You must specify only one of TaskDefinition or TaskImageOptions.'); } else if (props.taskDefinition) { @@ -160,6 +173,7 @@ export class NetworkMultipleTargetGroupsEc2Service extends NetworkMultipleTarget cluster: this.cluster, desiredCount: desiredCount, taskDefinition: this.taskDefinition, + enableExecuteCommand: this.enableExecuteCommand, assignPublicIp: false, serviceName: props.serviceName, healthCheckGracePeriod: props.healthCheckGracePeriod, diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/queue-processing-ecs-service.ts b/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/queue-processing-ecs-service.ts index 0cd4ae3e77d2a..420488b544942 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/queue-processing-ecs-service.ts +++ b/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/queue-processing-ecs-service.ts @@ -83,6 +83,13 @@ export interface QueueProcessingEc2ServiceProps extends QueueProcessingServiceBa * @default - No strategies. */ readonly placementStrategies?: PlacementStrategy[]; + + /** + * Whether to enable the ability to execute into a container. + * + * @default true + */ + readonly enableExecuteCommand?: boolean; } /** @@ -98,6 +105,10 @@ export class QueueProcessingEc2Service extends QueueProcessingServiceBase { * The EC2 task definition in this construct */ public readonly taskDefinition: Ec2TaskDefinition; + /** + * Whether enableExecuteCommand is enabled. + */ + public readonly enableExecuteCommand: boolean; /** * Constructs a new instance of the QueueProcessingEc2Service class. @@ -106,6 +117,7 @@ export class QueueProcessingEc2Service extends QueueProcessingServiceBase { super(scope, id, props); const containerName = props.containerName ?? 'QueueProcessingContainer'; + this.enableExecuteCommand = props.enableExecuteCommand ?? true; // Create a Task Definition for the container to start this.taskDefinition = new Ec2TaskDefinition(this, 'QueueProcessingTaskDef', { @@ -132,6 +144,7 @@ export class QueueProcessingEc2Service extends QueueProcessingServiceBase { cluster: this.cluster, desiredCount: desiredCount, taskDefinition: this.taskDefinition, + enableExecuteCommand: this.enableExecuteCommand, serviceName: props.serviceName, minHealthyPercent: props.minHealthyPercent, maxHealthyPercent: props.maxHealthyPercent, diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/application-load-balanced-fargate-service.ts b/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/application-load-balanced-fargate-service.ts index 81f243f4a6fa6..ed00cebf976e3 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/application-load-balanced-fargate-service.ts +++ b/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/application-load-balanced-fargate-service.ts @@ -91,6 +91,13 @@ export interface ApplicationLoadBalancedFargateServiceProps extends ApplicationL * @default - A new security group is created. */ readonly securityGroups?: ISecurityGroup[]; + + /** + * Whether to enable the ability to execute into a container. + * + * @default true + */ + readonly enableExecuteCommand?: boolean; } /** @@ -111,6 +118,10 @@ export class ApplicationLoadBalancedFargateService extends ApplicationLoadBalanc * The Fargate task definition in this construct. */ public readonly taskDefinition: FargateTaskDefinition; + /** + * Whether enableExecuteCommand is enabled. + */ + public readonly enableExecuteCommand: boolean; /** * Constructs a new instance of the ApplicationLoadBalancedFargateService class. @@ -119,6 +130,7 @@ export class ApplicationLoadBalancedFargateService extends ApplicationLoadBalanc super(scope, id, props); this.assignPublicIp = props.assignPublicIp ?? false; + this.enableExecuteCommand = props.enableExecuteCommand ?? true; if (props.taskDefinition && props.taskImageOptions) { throw new Error('You must specify either a taskDefinition or an image, not both.'); @@ -162,6 +174,7 @@ export class ApplicationLoadBalancedFargateService extends ApplicationLoadBalanc desiredCount: desiredCount, taskDefinition: this.taskDefinition, assignPublicIp: this.assignPublicIp, + enableExecuteCommand: this.enableExecuteCommand, serviceName: props.serviceName, healthCheckGracePeriod: props.healthCheckGracePeriod, minHealthyPercent: props.minHealthyPercent, diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/application-multiple-target-groups-fargate-service.ts b/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/application-multiple-target-groups-fargate-service.ts index 8052e0483b16a..f8d90d8a48823 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/application-multiple-target-groups-fargate-service.ts +++ b/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/application-multiple-target-groups-fargate-service.ts @@ -81,6 +81,13 @@ export interface ApplicationMultipleTargetGroupsFargateServiceProps extends Appl * @default Latest */ readonly platformVersion?: FargatePlatformVersion; + + /** + * Whether to enable the ability to execute into a container. + * + * @default true + */ + readonly enableExecuteCommand?: boolean; } /** @@ -107,6 +114,10 @@ export class ApplicationMultipleTargetGroupsFargateService extends ApplicationMu * The default target group for the service. */ public readonly targetGroup: ApplicationTargetGroup; + /** + * Whether enableExecuteCommand is enabled. + */ + public readonly enableExecuteCommand: boolean; /** * Constructs a new instance of the ApplicationMultipleTargetGroupsFargateService class. @@ -115,6 +126,7 @@ export class ApplicationMultipleTargetGroupsFargateService extends ApplicationMu super(scope, id, props); this.assignPublicIp = props.assignPublicIp ?? false; + this.enableExecuteCommand = props.enableExecuteCommand ?? true; if (props.taskDefinition && props.taskImageOptions) { throw new Error('You must specify only one of TaskDefinition or TaskImageOptions.'); @@ -177,6 +189,7 @@ export class ApplicationMultipleTargetGroupsFargateService extends ApplicationMu desiredCount: desiredCount, taskDefinition: this.taskDefinition, assignPublicIp: this.assignPublicIp, + enableExecuteCommand: this.enableExecuteCommand, serviceName: props.serviceName, healthCheckGracePeriod: props.healthCheckGracePeriod, propagateTags: props.propagateTags, diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/network-load-balanced-fargate-service.ts b/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/network-load-balanced-fargate-service.ts index 9095be5cf2cd1..4036a936dbc3f 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/network-load-balanced-fargate-service.ts +++ b/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/network-load-balanced-fargate-service.ts @@ -84,6 +84,13 @@ export interface NetworkLoadBalancedFargateServiceProps extends NetworkLoadBalan * @default Latest */ readonly platformVersion?: FargatePlatformVersion; + + /** + * Whether to enable the ability to execute into a container. + * + * @default true + */ + readonly enableExecuteCommand?: boolean; } /** @@ -100,6 +107,10 @@ export class NetworkLoadBalancedFargateService extends NetworkLoadBalancedServic * The Fargate task definition in this construct. */ public readonly taskDefinition: FargateTaskDefinition; + /** + * Whether enableExecuteCommand is enabled. + */ + public readonly enableExecuteCommand: boolean; /** * Constructs a new instance of the NetworkLoadBalancedFargateService class. @@ -108,6 +119,7 @@ export class NetworkLoadBalancedFargateService extends NetworkLoadBalancedServic super(scope, id, props); this.assignPublicIp = props.assignPublicIp ?? false; + this.enableExecuteCommand = props.enableExecuteCommand ?? true; if (props.taskDefinition && props.taskImageOptions) { throw new Error('You must specify either a taskDefinition or an image, not both.'); @@ -149,6 +161,7 @@ export class NetworkLoadBalancedFargateService extends NetworkLoadBalancedServic desiredCount: desiredCount, taskDefinition: this.taskDefinition, assignPublicIp: this.assignPublicIp, + enableExecuteCommand: this.enableExecuteCommand, serviceName: props.serviceName, healthCheckGracePeriod: props.healthCheckGracePeriod, minHealthyPercent: props.minHealthyPercent, diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/network-multiple-target-groups-fargate-service.ts b/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/network-multiple-target-groups-fargate-service.ts index 1a185f642a558..d857a556d1d2f 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/network-multiple-target-groups-fargate-service.ts +++ b/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/network-multiple-target-groups-fargate-service.ts @@ -81,6 +81,13 @@ export interface NetworkMultipleTargetGroupsFargateServiceProps extends NetworkM * @default Latest */ readonly platformVersion?: FargatePlatformVersion; + + /** + * Whether to enable the ability to execute into a container. + * + * @default true + */ + readonly enableExecuteCommand?: boolean; } /** @@ -108,6 +115,11 @@ export class NetworkMultipleTargetGroupsFargateService extends NetworkMultipleTa */ public readonly targetGroup: NetworkTargetGroup; + /** + * Whether enableExecuteCommand is enabled. + */ + public readonly enableExecuteCommand: boolean; + /** * Constructs a new instance of the NetworkMultipleTargetGroupsFargateService class. */ @@ -115,6 +127,7 @@ export class NetworkMultipleTargetGroupsFargateService extends NetworkMultipleTa super(scope, id, props); this.assignPublicIp = props.assignPublicIp ?? false; + this.enableExecuteCommand = props.enableExecuteCommand ?? true; if (props.taskDefinition && props.taskImageOptions) { throw new Error('You must specify only one of TaskDefinition or TaskImageOptions.'); @@ -177,6 +190,7 @@ export class NetworkMultipleTargetGroupsFargateService extends NetworkMultipleTa desiredCount: desiredCount, taskDefinition: this.taskDefinition, assignPublicIp: this.assignPublicIp, + enableExecuteCommand: this.enableExecuteCommand, serviceName: props.serviceName, healthCheckGracePeriod: props.healthCheckGracePeriod, propagateTags: props.propagateTags, diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/queue-processing-fargate-service.ts b/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/queue-processing-fargate-service.ts index ff63c4a3502d8..06d5cd907144a 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/queue-processing-fargate-service.ts +++ b/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/queue-processing-fargate-service.ts @@ -98,6 +98,13 @@ export interface QueueProcessingFargateServiceProps extends QueueProcessingServi * @default false */ readonly assignPublicIp?: boolean; + + /** + * Whether to enable the ability to execute into a container. + * + * @default true + */ + readonly enableExecuteCommand?: boolean; } /** @@ -112,6 +119,10 @@ export class QueueProcessingFargateService extends QueueProcessingServiceBase { * The Fargate task definition in this construct. */ public readonly taskDefinition: FargateTaskDefinition; + /** + * Whether enableExecuteCommand is enabled. + */ + public readonly enableExecuteCommand: boolean; /** * Constructs a new instance of the QueueProcessingFargateService class. @@ -119,6 +130,8 @@ export class QueueProcessingFargateService extends QueueProcessingServiceBase { constructor(scope: Construct, id: string, props: QueueProcessingFargateServiceProps) { super(scope, id, props); + this.enableExecuteCommand = props.enableExecuteCommand ?? true; + // Create a Task Definition for the container to start this.taskDefinition = new FargateTaskDefinition(this, 'QueueProcessingTaskDef', { memoryLimitMiB: props.memoryLimitMiB || 512, @@ -146,6 +159,7 @@ export class QueueProcessingFargateService extends QueueProcessingServiceBase { cluster: this.cluster, desiredCount: desiredCount, taskDefinition: this.taskDefinition, + enableExecuteCommand: this.enableExecuteCommand, serviceName: props.serviceName, minHealthyPercent: props.minHealthyPercent, maxHealthyPercent: props.maxHealthyPercent,