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 1b48633bdcde2..b440f393a859b 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 @@ -82,11 +82,9 @@ export class ApplicationLoadBalancedFargateService extends ApplicationLoadBalanc const containerName = taskImageOptions.containerName ?? 'web'; const container = this.taskDefinition.addContainer(containerName, { image: taskImageOptions.image, - cpu: props.cpu, - memoryLimitMiB: props.memoryLimitMiB, + logging: logDriver, environment: taskImageOptions.environment, secrets: taskImageOptions.secrets, - logging: logDriver, dockerLabels: taskImageOptions.dockerLabels, }); container.addPortMappings({ 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 2c6bec4878c59..bc72872102ef3 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 @@ -74,11 +74,9 @@ export class ApplicationMultipleTargetGroupsFargateService extends ApplicationMu const containerName = taskImageOptions.containerName ?? 'web'; const container = this.taskDefinition.addContainer(containerName, { image: taskImageOptions.image, - cpu: props.cpu, - memoryLimitMiB: props.memoryLimitMiB, + logging: this.logDriver, environment: taskImageOptions.environment, secrets: taskImageOptions.secrets, - logging: this.logDriver, dockerLabels: taskImageOptions.dockerLabels, }); if (taskImageOptions.containerPorts) { 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 906271f86704c..1e09e4ebf03c8 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 @@ -72,11 +72,9 @@ export class NetworkLoadBalancedFargateService extends NetworkLoadBalancedServic const containerName = taskImageOptions.containerName ?? 'web'; const container = this.taskDefinition.addContainer(containerName, { image: taskImageOptions.image, - cpu: props.cpu, - memoryLimitMiB: props.memoryLimitMiB, + logging: logDriver, environment: taskImageOptions.environment, secrets: taskImageOptions.secrets, - logging: logDriver, dockerLabels: taskImageOptions.dockerLabels, }); container.addPortMappings({ 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 63f23824ad702..582a417c2ac15 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 @@ -74,11 +74,9 @@ export class NetworkMultipleTargetGroupsFargateService extends NetworkMultipleTa const containerName = taskImageOptions.containerName ?? 'web'; const container = this.taskDefinition.addContainer(containerName, { image: taskImageOptions.image, - cpu: props.cpu, - memoryLimitMiB: props.memoryLimitMiB, + logging: this.logDriver, environment: taskImageOptions.environment, secrets: taskImageOptions.secrets, - logging: this.logDriver, dockerLabels: taskImageOptions.dockerLabels, }); if (taskImageOptions.containerPorts) { 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 6d96eff0fa05f..812478b9dba96 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 @@ -68,13 +68,10 @@ export class QueueProcessingFargateService extends QueueProcessingServiceBase { constructor(scope: Construct, id: string, props: QueueProcessingFargateServiceProps) { super(scope, id, props); - const cpu = props.cpu || 256; - const memoryLimitMiB = props.memoryLimitMiB || 512; - // Create a Task Definition for the container to start this.taskDefinition = new FargateTaskDefinition(this, 'QueueProcessingTaskDef', { - cpu, - memoryLimitMiB, + memoryLimitMiB: props.memoryLimitMiB || 512, + cpu: props.cpu || 256, family: props.family, runtimePlatform: props.runtimePlatform, }); @@ -83,8 +80,6 @@ export class QueueProcessingFargateService extends QueueProcessingServiceBase { this.taskDefinition.addContainer(containerName, { image: props.image, - cpu, - memoryLimitMiB, command: props.command, environment: this.environment, secrets: this.secrets, diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/scheduled-fargate-task.ts b/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/scheduled-fargate-task.ts index 1baa83534c92e..e508b44bade4a 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/scheduled-fargate-task.ts +++ b/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/scheduled-fargate-task.ts @@ -73,18 +73,12 @@ export class ScheduledFargateTask extends ScheduledTaskBase { this.taskDefinition = props.scheduledFargateTaskDefinitionOptions.taskDefinition; } else if (props.scheduledFargateTaskImageOptions) { const taskImageOptions = props.scheduledFargateTaskImageOptions; - const cpu = taskImageOptions.cpu || 256; - const memoryLimitMiB = taskImageOptions.memoryLimitMiB || 512; - this.taskDefinition = new FargateTaskDefinition(this, 'ScheduledTaskDef', { - memoryLimitMiB, - cpu, - runtimePlatform: props.runtimePlatform, + memoryLimitMiB: taskImageOptions.memoryLimitMiB || 512, + cpu: taskImageOptions.cpu || 256, }); this.taskDefinition.addContainer('ScheduledContainer', { image: taskImageOptions.image, - memoryLimitMiB, - cpu, command: taskImageOptions.command, environment: taskImageOptions.environment, secrets: taskImageOptions.secrets, diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/l3s.test.ts b/packages/@aws-cdk/aws-ecs-patterns/test/ec2/l3s.test.ts index c28b3071c8263..1766e008eae3f 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/l3s.test.ts +++ b/packages/@aws-cdk/aws-ecs-patterns/test/ec2/l3s.test.ts @@ -500,8 +500,6 @@ test('test Fargate loadbalanced construct', () => { // WHEN new ecsPatterns.ApplicationLoadBalancedFargateService(stack, 'Service', { cluster, - cpu: 1024, - memoryLimitMiB: 2048, taskImageOptions: { image: ecs.ContainerImage.fromRegistry('test'), environment: { @@ -518,11 +516,6 @@ test('test Fargate loadbalanced construct', () => { Template.fromStack(stack).hasResourceProperties('AWS::ECS::TaskDefinition', { ContainerDefinitions: [ Match.objectLike({ - Cpu: 1024, - DockerLabels: { - label1: 'labelValue1', - label2: 'labelValue2', - }, Environment: [ { Name: 'TEST_ENVIRONMENT_VARIABLE1', @@ -533,7 +526,6 @@ test('test Fargate loadbalanced construct', () => { Value: 'test environment variable 2 value', }, ], - Image: 'test', LogConfiguration: { LogDriver: 'awslogs', Options: { @@ -542,11 +534,12 @@ test('test Fargate loadbalanced construct', () => { 'awslogs-region': { Ref: 'AWS::Region' }, }, }, - Memory: 2048, + DockerLabels: { + label1: 'labelValue1', + label2: 'labelValue2', + }, }), ], - Cpu: '1024', - Memory: '2048', }); Template.fromStack(stack).hasResourceProperties('AWS::ECS::Service', { diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/alb-fargate-service-https.integ.snapshot/aws-ecs-integ-alb-fg-https.template.json b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/alb-fargate-service-https.integ.snapshot/aws-ecs-integ-alb-fg-https.template.json index 59f9681d49745..b43512a5773e7 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/alb-fargate-service-https.integ.snapshot/aws-ecs-integ-alb-fg-https.template.json +++ b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/alb-fargate-service-https.integ.snapshot/aws-ecs-integ-alb-fg-https.template.json @@ -636,7 +636,6 @@ } } }, - "Memory": 512, "Name": "web", "PortMappings": [ { diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/circuit-breaker-load-balanced-fargate-service.integ.snapshot/aws-ecs-integ.template.json b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/circuit-breaker-load-balanced-fargate-service.integ.snapshot/aws-ecs-integ.template.json index 800bc588a7f46..972b0642021bd 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/circuit-breaker-load-balanced-fargate-service.integ.snapshot/aws-ecs-integ.template.json +++ b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/circuit-breaker-load-balanced-fargate-service.integ.snapshot/aws-ecs-integ.template.json @@ -529,7 +529,6 @@ } } }, - "Memory": 512, "Name": "web", "PortMappings": [ { diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/circuit-breaker-queue-processing-fargate-service.integ.snapshot/aws-ecs-patterns-queue.template.json b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/circuit-breaker-queue-processing-fargate-service.integ.snapshot/aws-ecs-patterns-queue.template.json index f2afafcbc61e4..64ce41f985ed3 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/circuit-breaker-queue-processing-fargate-service.integ.snapshot/aws-ecs-patterns-queue.template.json +++ b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/circuit-breaker-queue-processing-fargate-service.integ.snapshot/aws-ecs-patterns-queue.template.json @@ -461,7 +461,6 @@ "Properties": { "ContainerDefinitions": [ { - "Cpu": 256, "Environment": [ { "Name": "QUEUE_NAME", @@ -505,7 +504,6 @@ } } }, - "Memory": 512, "Name": "QueueProcessingContainer" } ], diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/executionrole.integ.snapshot/aws-ecs-integ.template.json b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/executionrole.integ.snapshot/aws-ecs-integ.template.json index e71893a8f3063..b8aca663dd829 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/executionrole.integ.snapshot/aws-ecs-integ.template.json +++ b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/executionrole.integ.snapshot/aws-ecs-integ.template.json @@ -564,7 +564,6 @@ "Properties": { "ContainerDefinitions": [ { - "Cpu": 512, "Essential": true, "Image": "amazon/amazon-ecs-sample", "LogConfiguration": { @@ -579,7 +578,6 @@ } } }, - "Memory": 1024, "Name": "web", "PortMappings": [ { diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/l3-autocreate.integ.snapshot/aws-ecs-integ-l3-autocreate.template.json b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/l3-autocreate.integ.snapshot/aws-ecs-integ-l3-autocreate.template.json index 5efb07639c727..1f9ca9150aa38 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/l3-autocreate.integ.snapshot/aws-ecs-integ-l3-autocreate.template.json +++ b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/l3-autocreate.integ.snapshot/aws-ecs-integ-l3-autocreate.template.json @@ -129,7 +129,6 @@ "Properties": { "ContainerDefinitions": [ { - "Cpu": 512, "Essential": true, "Image": "amazon/amazon-ecs-sample", "LogConfiguration": { @@ -144,7 +143,6 @@ } } }, - "Memory": 1024, "Name": "web", "PortMappings": [ { @@ -777,7 +775,6 @@ "Properties": { "ContainerDefinitions": [ { - "Cpu": 512, "Essential": true, "Image": "amazon/amazon-ecs-sample", "LogConfiguration": { @@ -792,7 +789,6 @@ } } }, - "Memory": 1024, "Name": "web", "PortMappings": [ { diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/l3-capacity-provider-strategies.integ.snapshot/aws-ecs-integ-lb-fargate.template.json b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/l3-capacity-provider-strategies.integ.snapshot/aws-ecs-integ-lb-fargate.template.json index 41f957c530db4..78a971a6fc95e 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/l3-capacity-provider-strategies.integ.snapshot/aws-ecs-integ-lb-fargate.template.json +++ b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/l3-capacity-provider-strategies.integ.snapshot/aws-ecs-integ-lb-fargate.template.json @@ -528,7 +528,6 @@ "Properties": { "ContainerDefinitions": [ { - "Cpu": 512, "Essential": true, "Image": "amazon/amazon-ecs-sample", "LogConfiguration": { @@ -543,7 +542,6 @@ } } }, - "Memory": 1024, "Name": "web", "PortMappings": [ { @@ -801,7 +799,6 @@ "Properties": { "ContainerDefinitions": [ { - "Cpu": 512, "Essential": true, "Image": "amazon/amazon-ecs-sample", "LogConfiguration": { @@ -816,7 +813,6 @@ } } }, - "Memory": 1024, "Name": "web", "PortMappings": [ { diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/l3-vpconly.integ.snapshot/aws-ecs-integ-l3-vpconly.template.json b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/l3-vpconly.integ.snapshot/aws-ecs-integ-l3-vpconly.template.json index 017474dfeb2d3..ba315a320a5fc 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/l3-vpconly.integ.snapshot/aws-ecs-integ-l3-vpconly.template.json +++ b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/l3-vpconly.integ.snapshot/aws-ecs-integ-l3-vpconly.template.json @@ -512,7 +512,6 @@ "Properties": { "ContainerDefinitions": [ { - "Cpu": 512, "Essential": true, "Image": "amazon/amazon-ecs-sample", "LogConfiguration": { @@ -527,7 +526,6 @@ } } }, - "Memory": 1024, "Name": "web", "PortMappings": [ { @@ -777,7 +775,6 @@ "Properties": { "ContainerDefinitions": [ { - "Cpu": 512, "Essential": true, "Image": "amazon/amazon-ecs-sample", "LogConfiguration": { @@ -792,7 +789,6 @@ } } }, - "Memory": 1024, "Name": "web", "PortMappings": [ { diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/l3.integ.snapshot/aws-ecs-integ-lb-fargate.template.json b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/l3.integ.snapshot/aws-ecs-integ-lb-fargate.template.json index 5055f98fddfed..5d9f94b76397a 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/l3.integ.snapshot/aws-ecs-integ-lb-fargate.template.json +++ b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/l3.integ.snapshot/aws-ecs-integ-lb-fargate.template.json @@ -515,7 +515,6 @@ "Properties": { "ContainerDefinitions": [ { - "Cpu": 512, "Essential": true, "Image": "amazon/amazon-ecs-sample", "LogConfiguration": { @@ -530,7 +529,6 @@ } } }, - "Memory": 1024, "Name": "web", "PortMappings": [ { @@ -777,7 +775,6 @@ "Properties": { "ContainerDefinitions": [ { - "Cpu": 512, "Essential": true, "Image": "amazon/amazon-ecs-sample", "LogConfiguration": { @@ -792,7 +789,6 @@ } } }, - "Memory": 1024, "Name": "web", "PortMappings": [ { diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/multiple-network-load-balanced-fargate-service.integ.snapshot/aws-ecs-integ.template.json b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/multiple-network-load-balanced-fargate-service.integ.snapshot/aws-ecs-integ.template.json index 45e3fbfbb202a..2a503a6b25d24 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/multiple-network-load-balanced-fargate-service.integ.snapshot/aws-ecs-integ.template.json +++ b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/multiple-network-load-balanced-fargate-service.integ.snapshot/aws-ecs-integ.template.json @@ -530,7 +530,6 @@ } } }, - "Memory": 512, "Name": "web", "PortMappings": [ { diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/queue-processing-fargate-service-isolated.integ.snapshot/aws-ecs-patterns-queue-isolated.template.json b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/queue-processing-fargate-service-isolated.integ.snapshot/aws-ecs-patterns-queue-isolated.template.json index 01f170e4ad3c5..930d342cdb091 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/queue-processing-fargate-service-isolated.integ.snapshot/aws-ecs-patterns-queue-isolated.template.json +++ b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/queue-processing-fargate-service-isolated.integ.snapshot/aws-ecs-patterns-queue-isolated.template.json @@ -770,7 +770,6 @@ "Properties": { "ContainerDefinitions": [ { - "Cpu": 256, "Environment": [ { "Name": "QUEUE_NAME", @@ -814,7 +813,6 @@ } } }, - "Memory": 512, "Name": "QueueProcessingContainer" } ], diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/queue-processing-fargate-service-public.integ.snapshot/aws-ecs-patterns-queue-public.template.json b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/queue-processing-fargate-service-public.integ.snapshot/aws-ecs-patterns-queue-public.template.json index 68c10a9aac5e8..1bff926aba21a 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/queue-processing-fargate-service-public.integ.snapshot/aws-ecs-patterns-queue-public.template.json +++ b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/queue-processing-fargate-service-public.integ.snapshot/aws-ecs-patterns-queue-public.template.json @@ -461,7 +461,6 @@ "Properties": { "ContainerDefinitions": [ { - "Cpu": 256, "Environment": [ { "Name": "QUEUE_NAME", @@ -514,7 +513,6 @@ } } }, - "Memory": 512, "Name": "QueueProcessingContainer" } ], diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/queue-processing-fargate-service.integ.snapshot/aws-ecs-patterns-queue.template.json b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/queue-processing-fargate-service.integ.snapshot/aws-ecs-patterns-queue.template.json index d635ba9043349..4a91c2fabee6f 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/queue-processing-fargate-service.integ.snapshot/aws-ecs-patterns-queue.template.json +++ b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/queue-processing-fargate-service.integ.snapshot/aws-ecs-patterns-queue.template.json @@ -461,7 +461,6 @@ "Properties": { "ContainerDefinitions": [ { - "Cpu": 256, "Environment": [ { "Name": "QUEUE_NAME", @@ -505,7 +504,6 @@ } } }, - "Memory": 512, "Name": "QueueProcessingContainer" } ], diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/scheduled-fargate-task.integ.snapshot/aws-fargate-integ.template.json b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/scheduled-fargate-task.integ.snapshot/aws-fargate-integ.template.json index 3fb1642063cf0..669810a5d8785 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/scheduled-fargate-task.integ.snapshot/aws-fargate-integ.template.json +++ b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/scheduled-fargate-task.integ.snapshot/aws-fargate-integ.template.json @@ -285,7 +285,6 @@ "Properties": { "ContainerDefinitions": [ { - "Cpu": 256, "Environment": [ { "Name": "TRIGGER", @@ -324,7 +323,6 @@ } } }, - "Memory": 512, "Name": "ScheduledContainer" } ], diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/aws-fargate-integ.template.json b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/aws-fargate-integ.template.json index 3fb1642063cf0..669810a5d8785 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/aws-fargate-integ.template.json +++ b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/aws-fargate-integ.template.json @@ -285,7 +285,6 @@ "Properties": { "ContainerDefinitions": [ { - "Cpu": 256, "Environment": [ { "Name": "TRIGGER", @@ -324,7 +323,6 @@ } } }, - "Memory": 512, "Name": "ScheduledContainer" } ],