From 90d1ac08d6b94e6c614687308296678064d20d7e Mon Sep 17 00:00:00 2001 From: Naumel <104374999+Naumel@users.noreply.github.com> Date: Wed, 22 Feb 2023 20:43:45 +0100 Subject: [PATCH 01/11] fix: Correct SamlConsolePrincipal for non-China (#24277) Closes #24243. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/@aws-cdk/aws-iam/lib/principals.ts | 2 +- .../cdk-saml-provider.assets.json | 6 +++--- .../cdk-saml-provider.template.json | 16 ++-------------- .../test/integ.saml-provider.js.snapshot/cdk.out | 2 +- .../integ.saml-provider.js.snapshot/integ.json | 2 +- .../manifest.json | 4 ++-- ...stDefaultTestDeployAssert29A1AF64.assets.json | 2 +- .../integ.saml-provider.js.snapshot/tree.json | 16 ++-------------- .../@aws-cdk/aws-iam/test/integ.saml-provider.ts | 1 - .../@aws-cdk/aws-iam/test/principals.test.ts | 4 +--- 10 files changed, 14 insertions(+), 41 deletions(-) diff --git a/packages/@aws-cdk/aws-iam/lib/principals.ts b/packages/@aws-cdk/aws-iam/lib/principals.ts index db6b404cfc6e1..72c7ec400714d 100644 --- a/packages/@aws-cdk/aws-iam/lib/principals.ts +++ b/packages/@aws-cdk/aws-iam/lib/principals.ts @@ -737,7 +737,7 @@ export class SamlConsolePrincipal extends SamlPrincipal { super(samlProvider, { ...conditions, StringEquals: { - 'SAML:aud': cdk.Aws.PARTITION==='aws-cn'? 'https://signin.amazonaws.cn/saml': `https://signin.${cdk.Aws.URL_SUFFIX}/saml`, + 'SAML:aud': cdk.Aws.PARTITION==='aws-cn'? 'https://signin.amazonaws.cn/saml': 'https://signin.aws.amazon.com/saml', }, }); } diff --git a/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/cdk-saml-provider.assets.json b/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/cdk-saml-provider.assets.json index 44e4011015dfe..80d435eda0cd6 100644 --- a/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/cdk-saml-provider.assets.json +++ b/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/cdk-saml-provider.assets.json @@ -1,7 +1,7 @@ { - "version": "30.0.0", + "version": "30.1.0", "files": { - "adc0eedec883653ef9cbd8c66ae68791bf952df8f678cf586e78e02997e2674c": { + "3b60cda5eb73f658ff1ab1a242bd0e399cc5307d4d6493cea0171e543c6f1cc8": { "source": { "path": "cdk-saml-provider.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "adc0eedec883653ef9cbd8c66ae68791bf952df8f678cf586e78e02997e2674c.json", + "objectKey": "3b60cda5eb73f658ff1ab1a242bd0e399cc5307d4d6493cea0171e543c6f1cc8.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/cdk-saml-provider.template.json b/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/cdk-saml-provider.template.json index 7ec8d4d2699c0..ed4f4af28415f 100644 --- a/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/cdk-saml-provider.template.json +++ b/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/cdk-saml-provider.template.json @@ -15,18 +15,7 @@ "Action": "sts:AssumeRoleWithSAML", "Condition": { "StringEquals": { - "SAML:aud": { - "Fn::Join": [ - "", - [ - "https://signin.", - { - "Ref": "AWS::URLSuffix" - }, - "/saml" - ] - ] - } + "SAML:aud": "https://signin.aws.amazon.com/saml" } }, "Effect": "Allow", @@ -38,8 +27,7 @@ } ], "Version": "2012-10-17" - }, - "Description": "fix the partition issue" + } } } }, diff --git a/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/cdk.out b/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/cdk.out index ae4b03c54e770..b72fef144f05c 100644 --- a/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"30.0.0"} \ No newline at end of file +{"version":"30.1.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/integ.json b/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/integ.json index dccacdf14329b..f32815f8dd836 100644 --- a/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/integ.json +++ b/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "30.0.0", + "version": "30.1.0", "testCases": { "saml-provider-test/DefaultTest": { "stacks": [ diff --git a/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/manifest.json b/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/manifest.json index 4e8a9d11b6371..222a89e020c12 100644 --- a/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "30.0.0", + "version": "30.1.0", "artifacts": { "cdk-saml-provider.assets": { "type": "cdk:asset-manifest", @@ -17,7 +17,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/adc0eedec883653ef9cbd8c66ae68791bf952df8f678cf586e78e02997e2674c.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/3b60cda5eb73f658ff1ab1a242bd0e399cc5307d4d6493cea0171e543c6f1cc8.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ diff --git a/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/samlprovidertestDefaultTestDeployAssert29A1AF64.assets.json b/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/samlprovidertestDefaultTestDeployAssert29A1AF64.assets.json index ce9c5f512bafd..4c340e118f1d5 100644 --- a/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/samlprovidertestDefaultTestDeployAssert29A1AF64.assets.json +++ b/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/samlprovidertestDefaultTestDeployAssert29A1AF64.assets.json @@ -1,5 +1,5 @@ { - "version": "30.0.0", + "version": "30.1.0", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/tree.json b/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/tree.json index e6fcd91ade7c9..da6df90bfebae 100644 --- a/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/tree.json +++ b/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/tree.json @@ -56,18 +56,7 @@ "Action": "sts:AssumeRoleWithSAML", "Condition": { "StringEquals": { - "SAML:aud": { - "Fn::Join": [ - "", - [ - "https://signin.", - { - "Ref": "AWS::URLSuffix" - }, - "/saml" - ] - ] - } + "SAML:aud": "https://signin.aws.amazon.com/saml" } }, "Effect": "Allow", @@ -79,8 +68,7 @@ } ], "Version": "2012-10-17" - }, - "description": "fix the partition issue" + } } }, "constructInfo": { diff --git a/packages/@aws-cdk/aws-iam/test/integ.saml-provider.ts b/packages/@aws-cdk/aws-iam/test/integ.saml-provider.ts index efaadeffe9e1f..2866e4d3e8e09 100644 --- a/packages/@aws-cdk/aws-iam/test/integ.saml-provider.ts +++ b/packages/@aws-cdk/aws-iam/test/integ.saml-provider.ts @@ -14,7 +14,6 @@ class TestStack extends Stack { new iam.Role(this, 'Role', { assumedBy: new iam.SamlConsolePrincipal(provider), - description: 'fix the partition issue', }); } } diff --git a/packages/@aws-cdk/aws-iam/test/principals.test.ts b/packages/@aws-cdk/aws-iam/test/principals.test.ts index 5114a55bf16ac..80e9efe10d5fb 100644 --- a/packages/@aws-cdk/aws-iam/test/principals.test.ts +++ b/packages/@aws-cdk/aws-iam/test/principals.test.ts @@ -166,9 +166,7 @@ test('SAML principal', () => { Action: 'sts:AssumeRoleWithSAML', Condition: { StringEquals: { - 'SAML:aud': { - 'Fn::Join': ['', ['https://signin.', { Ref: 'AWS::URLSuffix' }, '/saml']], - }, + 'SAML:aud': 'https://signin.aws.amazon.com/saml', }, }, Effect: 'Allow', From 101f3c561fd6dfd843953510881faaf1bf3c7dd0 Mon Sep 17 00:00:00 2001 From: homakk Date: Wed, 12 Apr 2023 19:01:34 +0000 Subject: [PATCH 02/11] feat(ecs-patterns): Add Ephemeral Storage Support For Ecs Patterns --- .../Dockerfile | 10 + .../index.py | 22 + .../aws-ecs-patterns-queue-es.assets.json | 32 + .../aws-ecs-patterns-queue-es.template.json | 901 +++++++++ .../cdk.out | 1 + .../integ.json | 12 + .../manifest.json | 369 ++++ ...efaultTestDeployAssert072B4E4C.assets.json | 19 + ...aultTestDeployAssert072B4E4C.template.json | 36 + .../tree.json | 1606 +++++++++++++++++ ...ssing-fargate-service-ephemeral-storage.ts | 26 + ...cProduct3B51CF591.v1.product.template.json | 7 + .../@aws-cdk/cli-lib/THIRD_PARTY_LICENSES | 2 +- .../aws-cdk-lib/aws-ecs-patterns/README.md | 146 ++ .../application-load-balanced-service-base.ts | 9 + ...ion-multiple-target-groups-service-base.ts | 9 + .../network-load-balanced-service-base.ts | 9 + ...ork-multiple-target-groups-service-base.ts | 8 + .../lib/base/scheduled-task-base.ts | 9 + .../application-load-balanced-ecs-service.ts | 3 + ...tion-multiple-target-groups-ecs-service.ts | 3 + .../ecs/network-load-balanced-ecs-service.ts | 3 + ...work-multiple-target-groups-ecs-service.ts | 3 + .../lib/ecs/scheduled-ecs-task.ts | 3 + ...plication-load-balanced-fargate-service.ts | 1 + ...-multiple-target-groups-fargate-service.ts | 1 + .../network-load-balanced-fargate-service.ts | 1 + ...-multiple-target-groups-fargate-service.ts | 1 + .../queue-processing-fargate-service.ts | 10 + .../lib/fargate/scheduled-fargate-task.ts | 1 + .../test/ec2/scheduled-ecs-task.test.ts | 20 + .../load-balanced-fargate-service.test.ts | 2 + .../queue-processing-fargate-service.test.ts | 1 + .../fargate/scheduled-fargate-task.test.ts | 1 + 34 files changed, 3286 insertions(+), 1 deletion(-) create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/Dockerfile create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/index.py create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/aws-ecs-patterns-queue-es.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/aws-ecs-patterns-queue-es.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/cdk.out create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/integ.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/manifest.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/queueProcessingFargateServiceTestWithEphemeralStorageTestDefaultTestDeployAssert072B4E4C.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/queueProcessingFargateServiceTestWithEphemeralStorageTestDefaultTestDeployAssert072B4E4C.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/tree.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.ts create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/product-stack-snapshots/integservicecatalogproductProductStackHistory4D520FF1.integservicecatalogproductSNSTopicProduct3B51CF591.v1.product.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/Dockerfile new file mode 100644 index 0000000000000..919fabfc3f637 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/Dockerfile @@ -0,0 +1,10 @@ +FROM public.ecr.aws/lambda/python:3.6 + +RUN pip3 install boto3 + +ENV QUEUE_NAME $QUEUE_NAME + +WORKDIR /src +ADD . /src + +CMD python3 index.py diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/index.py new file mode 100644 index 0000000000000..8b53f5149cb24 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/index.py @@ -0,0 +1,22 @@ +#!/usr/bin/python +import os +import boto3 + +QUEUE_NAME = os.environ.get('QUEUE_NAME') +print('QUEUE_NAME ' + QUEUE_NAME) + +if __name__ == '__main__': + client = boto3.client('sqs') + queue_url = client.get_queue_url(QueueName=QUEUE_NAME)['QueueUrl'] + print('queue_url ' + queue_url) + while True: + response = client.receive_message( + QueueUrl=queue_url, + WaitTimeSeconds=10, + ) + if response and 'Messages' in response: + for msg in response['Messages']: + print(msg['Body']) + entries = [{'Id': x['MessageId'], 'ReceiptHandle': x['ReceiptHandle']} for x in response['Messages']] + client.delete_message_batch(QueueUrl=queue_url, Entries=entries) + diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/aws-ecs-patterns-queue-es.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/aws-ecs-patterns-queue-es.assets.json new file mode 100644 index 0000000000000..62a84d6afb941 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/aws-ecs-patterns-queue-es.assets.json @@ -0,0 +1,32 @@ +{ + "version": "31.0.0", + "files": { + "142d613070f1f13a0082f9d64ee0beeabb38849e33a01c6c7298a69f8291b340": { + "source": { + "path": "aws-ecs-patterns-queue-es.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "142d613070f1f13a0082f9d64ee0beeabb38849e33a01c6c7298a69f8291b340.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": { + "95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417": { + "source": { + "directory": "asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417" + }, + "destinations": { + "current_account-current_region": { + "repositoryName": "cdk-hnb659fds-container-assets-${AWS::AccountId}-${AWS::Region}", + "imageTag": "95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-image-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/aws-ecs-patterns-queue-es.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/aws-ecs-patterns-queue-es.template.json new file mode 100644 index 0000000000000..022983507d81f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/aws-ecs-patterns-queue-es.template.json @@ -0,0 +1,901 @@ +{ + "Resources": { + "VPCB9E5F0B4": { + "Type": "AWS::EC2::VPC", + "Properties": { + "CidrBlock": "10.0.0.0/16", + "EnableDnsHostnames": true, + "EnableDnsSupport": true, + "InstanceTenancy": "default", + "Tags": [ + { + "Key": "Name", + "Value": "aws-ecs-patterns-queue-es/VPC" + } + ] + } + }, + "VPCPublicSubnet1SubnetB4246D30": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "VPCB9E5F0B4" + }, + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.0.0/18", + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + }, + { + "Key": "Name", + "Value": "aws-ecs-patterns-queue-es/VPC/PublicSubnet1" + } + ] + } + }, + "VPCPublicSubnet1RouteTableFEE4B781": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "VPCB9E5F0B4" + }, + "Tags": [ + { + "Key": "Name", + "Value": "aws-ecs-patterns-queue-es/VPC/PublicSubnet1" + } + ] + } + }, + "VPCPublicSubnet1RouteTableAssociation0B0896DC": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VPCPublicSubnet1RouteTableFEE4B781" + }, + "SubnetId": { + "Ref": "VPCPublicSubnet1SubnetB4246D30" + } + } + }, + "VPCPublicSubnet1DefaultRoute91CEF279": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "VPCPublicSubnet1RouteTableFEE4B781" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "VPCIGWB7E252D3" + } + }, + "DependsOn": [ + "VPCVPCGW99B986DC" + ] + }, + "VPCPublicSubnet1EIP6AD938E8": { + "Type": "AWS::EC2::EIP", + "Properties": { + "Domain": "vpc", + "Tags": [ + { + "Key": "Name", + "Value": "aws-ecs-patterns-queue-es/VPC/PublicSubnet1" + } + ] + } + }, + "VPCPublicSubnet1NATGatewayE0556630": { + "Type": "AWS::EC2::NatGateway", + "Properties": { + "SubnetId": { + "Ref": "VPCPublicSubnet1SubnetB4246D30" + }, + "AllocationId": { + "Fn::GetAtt": [ + "VPCPublicSubnet1EIP6AD938E8", + "AllocationId" + ] + }, + "Tags": [ + { + "Key": "Name", + "Value": "aws-ecs-patterns-queue-es/VPC/PublicSubnet1" + } + ] + }, + "DependsOn": [ + "VPCPublicSubnet1DefaultRoute91CEF279", + "VPCPublicSubnet1RouteTableAssociation0B0896DC" + ] + }, + "VPCPublicSubnet2Subnet74179F39": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "VPCB9E5F0B4" + }, + "AvailabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.64.0/18", + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + }, + { + "Key": "Name", + "Value": "aws-ecs-patterns-queue-es/VPC/PublicSubnet2" + } + ] + } + }, + "VPCPublicSubnet2RouteTable6F1A15F1": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "VPCB9E5F0B4" + }, + "Tags": [ + { + "Key": "Name", + "Value": "aws-ecs-patterns-queue-es/VPC/PublicSubnet2" + } + ] + } + }, + "VPCPublicSubnet2RouteTableAssociation5A808732": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VPCPublicSubnet2RouteTable6F1A15F1" + }, + "SubnetId": { + "Ref": "VPCPublicSubnet2Subnet74179F39" + } + } + }, + "VPCPublicSubnet2DefaultRouteB7481BBA": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "VPCPublicSubnet2RouteTable6F1A15F1" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "VPCIGWB7E252D3" + } + }, + "DependsOn": [ + "VPCVPCGW99B986DC" + ] + }, + "VPCPublicSubnet2EIP4947BC00": { + "Type": "AWS::EC2::EIP", + "Properties": { + "Domain": "vpc", + "Tags": [ + { + "Key": "Name", + "Value": "aws-ecs-patterns-queue-es/VPC/PublicSubnet2" + } + ] + } + }, + "VPCPublicSubnet2NATGateway3C070193": { + "Type": "AWS::EC2::NatGateway", + "Properties": { + "SubnetId": { + "Ref": "VPCPublicSubnet2Subnet74179F39" + }, + "AllocationId": { + "Fn::GetAtt": [ + "VPCPublicSubnet2EIP4947BC00", + "AllocationId" + ] + }, + "Tags": [ + { + "Key": "Name", + "Value": "aws-ecs-patterns-queue-es/VPC/PublicSubnet2" + } + ] + }, + "DependsOn": [ + "VPCPublicSubnet2DefaultRouteB7481BBA", + "VPCPublicSubnet2RouteTableAssociation5A808732" + ] + }, + "VPCPrivateSubnet1Subnet8BCA10E0": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "VPCB9E5F0B4" + }, + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.128.0/18", + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Private" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Private" + }, + { + "Key": "Name", + "Value": "aws-ecs-patterns-queue-es/VPC/PrivateSubnet1" + } + ] + } + }, + "VPCPrivateSubnet1RouteTableBE8A6027": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "VPCB9E5F0B4" + }, + "Tags": [ + { + "Key": "Name", + "Value": "aws-ecs-patterns-queue-es/VPC/PrivateSubnet1" + } + ] + } + }, + "VPCPrivateSubnet1RouteTableAssociation347902D1": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VPCPrivateSubnet1RouteTableBE8A6027" + }, + "SubnetId": { + "Ref": "VPCPrivateSubnet1Subnet8BCA10E0" + } + } + }, + "VPCPrivateSubnet1DefaultRouteAE1D6490": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "VPCPrivateSubnet1RouteTableBE8A6027" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "VPCPublicSubnet1NATGatewayE0556630" + } + } + }, + "VPCPrivateSubnet2SubnetCFCDAA7A": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "VPCB9E5F0B4" + }, + "AvailabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.192.0/18", + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Private" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Private" + }, + { + "Key": "Name", + "Value": "aws-ecs-patterns-queue-es/VPC/PrivateSubnet2" + } + ] + } + }, + "VPCPrivateSubnet2RouteTable0A19E10E": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "VPCB9E5F0B4" + }, + "Tags": [ + { + "Key": "Name", + "Value": "aws-ecs-patterns-queue-es/VPC/PrivateSubnet2" + } + ] + } + }, + "VPCPrivateSubnet2RouteTableAssociation0C73D413": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VPCPrivateSubnet2RouteTable0A19E10E" + }, + "SubnetId": { + "Ref": "VPCPrivateSubnet2SubnetCFCDAA7A" + } + } + }, + "VPCPrivateSubnet2DefaultRouteF4F5CFD2": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "VPCPrivateSubnet2RouteTable0A19E10E" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "VPCPublicSubnet2NATGateway3C070193" + } + } + }, + "VPCIGWB7E252D3": { + "Type": "AWS::EC2::InternetGateway", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "aws-ecs-patterns-queue-es/VPC" + } + ] + } + }, + "VPCVPCGW99B986DC": { + "Type": "AWS::EC2::VPCGatewayAttachment", + "Properties": { + "VpcId": { + "Ref": "VPCB9E5F0B4" + }, + "InternetGatewayId": { + "Ref": "VPCIGWB7E252D3" + } + } + }, + "QueueProcessingServiceEcsProcessingDeadLetterQueueD47A7C6B": { + "Type": "AWS::SQS::Queue", + "Properties": { + "MessageRetentionPeriod": 1209600 + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "QueueProcessingServiceEcsProcessingQueue552F0B37": { + "Type": "AWS::SQS::Queue", + "Properties": { + "RedrivePolicy": { + "deadLetterTargetArn": { + "Fn::GetAtt": [ + "QueueProcessingServiceEcsProcessingDeadLetterQueueD47A7C6B", + "Arn" + ] + }, + "maxReceiveCount": 3 + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "QueueProcessingServiceQueueProcessingTaskDefTaskRole782B79A6": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "ecs-tasks.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "QueueProcessingServiceQueueProcessingTaskDefTaskRoleDefaultPolicyAE808B19": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "sqs:ChangeMessageVisibility", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:GetQueueUrl", + "sqs:ReceiveMessage" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "QueueProcessingServiceEcsProcessingQueue552F0B37", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "QueueProcessingServiceQueueProcessingTaskDefTaskRoleDefaultPolicyAE808B19", + "Roles": [ + { + "Ref": "QueueProcessingServiceQueueProcessingTaskDefTaskRole782B79A6" + } + ] + } + }, + "QueueProcessingServiceQueueProcessingTaskDef4982F68B": { + "Type": "AWS::ECS::TaskDefinition", + "Properties": { + "ContainerDefinitions": [ + { + "Environment": [ + { + "Name": "QUEUE_NAME", + "Value": { + "Fn::GetAtt": [ + "QueueProcessingServiceEcsProcessingQueue552F0B37", + "QueueName" + ] + } + } + ], + "Essential": true, + "Image": { + "Fn::Sub": "${AWS::AccountId}.dkr.ecr.${AWS::Region}.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-${AWS::AccountId}-${AWS::Region}:95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417" + }, + "LogConfiguration": { + "LogDriver": "awslogs", + "Options": { + "awslogs-group": { + "Ref": "QueueProcessingServiceQueueProcessingTaskDefQueueProcessingContainerLogGroupCC92448A" + }, + "awslogs-stream-prefix": "QueueProcessingService", + "awslogs-region": { + "Ref": "AWS::Region" + } + } + }, + "Name": "QueueProcessingContainer" + } + ], + "Cpu": "256", + "EphemeralStorage": { + "SizeInGiB": 50 + }, + "ExecutionRoleArn": { + "Fn::GetAtt": [ + "QueueProcessingServiceQueueProcessingTaskDefExecutionRole37838985", + "Arn" + ] + }, + "Family": "awsecspatternsqueueesQueueProcessingServiceQueueProcessingTaskDef80674093", + "Memory": "512", + "NetworkMode": "awsvpc", + "RequiresCompatibilities": [ + "FARGATE" + ], + "TaskRoleArn": { + "Fn::GetAtt": [ + "QueueProcessingServiceQueueProcessingTaskDefTaskRole782B79A6", + "Arn" + ] + } + } + }, + "QueueProcessingServiceQueueProcessingTaskDefQueueProcessingContainerLogGroupCC92448A": { + "Type": "AWS::Logs::LogGroup", + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" + }, + "QueueProcessingServiceQueueProcessingTaskDefExecutionRole37838985": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "ecs-tasks.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "QueueProcessingServiceQueueProcessingTaskDefExecutionRoleDefaultPolicyA83D332D": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "ecr:BatchCheckLayerAvailability", + "ecr:BatchGetImage", + "ecr:GetDownloadUrlForLayer" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ecr:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":repository/", + { + "Fn::Sub": "cdk-hnb659fds-container-assets-${AWS::AccountId}-${AWS::Region}" + } + ] + ] + } + }, + { + "Action": "ecr:GetAuthorizationToken", + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "QueueProcessingServiceQueueProcessingTaskDefQueueProcessingContainerLogGroupCC92448A", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "QueueProcessingServiceQueueProcessingTaskDefExecutionRoleDefaultPolicyA83D332D", + "Roles": [ + { + "Ref": "QueueProcessingServiceQueueProcessingTaskDefExecutionRole37838985" + } + ] + } + }, + "QueueProcessingServiceQueueProcessingFargateService0340DB9F": { + "Type": "AWS::ECS::Service", + "Properties": { + "Cluster": { + "Ref": "EcsDefaultClusterMnL3mNNYNVPC9C1EC7A3" + }, + "DeploymentConfiguration": { + "MaximumPercent": 200, + "MinimumHealthyPercent": 50 + }, + "EnableECSManagedTags": false, + "LaunchType": "FARGATE", + "NetworkConfiguration": { + "AwsvpcConfiguration": { + "AssignPublicIp": "DISABLED", + "SecurityGroups": [ + { + "Fn::GetAtt": [ + "QueueProcessingServiceQueueProcessingFargateServiceSecurityGroup8FDF413D", + "GroupId" + ] + } + ], + "Subnets": [ + { + "Ref": "VPCPrivateSubnet1Subnet8BCA10E0" + }, + { + "Ref": "VPCPrivateSubnet2SubnetCFCDAA7A" + } + ] + } + }, + "TaskDefinition": { + "Ref": "QueueProcessingServiceQueueProcessingTaskDef4982F68B" + } + } + }, + "QueueProcessingServiceQueueProcessingFargateServiceSecurityGroup8FDF413D": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService/SecurityGroup", + "SecurityGroupEgress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "Allow all outbound traffic by default", + "IpProtocol": "-1" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "QueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetA9D54444": { + "Type": "AWS::ApplicationAutoScaling::ScalableTarget", + "Properties": { + "MaxCapacity": 2, + "MinCapacity": 0, + "ResourceId": { + "Fn::Join": [ + "", + [ + "service/", + { + "Ref": "EcsDefaultClusterMnL3mNNYNVPC9C1EC7A3" + }, + "/", + { + "Fn::GetAtt": [ + "QueueProcessingServiceQueueProcessingFargateService0340DB9F", + "Name" + ] + } + ] + ] + }, + "RoleARN": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/aws-service-role/ecs.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_ECSService" + ] + ] + }, + "ScalableDimension": "ecs:service:DesiredCount", + "ServiceNamespace": "ecs" + } + }, + "QueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetCpuScaling330150E9": { + "Type": "AWS::ApplicationAutoScaling::ScalingPolicy", + "Properties": { + "PolicyName": "awsecspatternsqueueesQueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetCpuScaling83DE8898", + "PolicyType": "TargetTrackingScaling", + "ScalingTargetId": { + "Ref": "QueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetA9D54444" + }, + "TargetTrackingScalingPolicyConfiguration": { + "PredefinedMetricSpecification": { + "PredefinedMetricType": "ECSServiceAverageCPUUtilization" + }, + "TargetValue": 50 + } + } + }, + "QueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetQueueMessagesVisibleScalingLowerPolicy332E2644": { + "Type": "AWS::ApplicationAutoScaling::ScalingPolicy", + "Properties": { + "PolicyName": "awsecspatternsqueueesQueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetQueueMessagesVisibleScalingLowerPolicyE9AD74AB", + "PolicyType": "StepScaling", + "ScalingTargetId": { + "Ref": "QueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetA9D54444" + }, + "StepScalingPolicyConfiguration": { + "AdjustmentType": "ChangeInCapacity", + "MetricAggregationType": "Maximum", + "StepAdjustments": [ + { + "MetricIntervalUpperBound": 0, + "ScalingAdjustment": -1 + } + ] + } + } + }, + "QueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetQueueMessagesVisibleScalingLowerAlarm20C30A06": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ComparisonOperator": "LessThanOrEqualToThreshold", + "EvaluationPeriods": 1, + "AlarmActions": [ + { + "Ref": "QueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetQueueMessagesVisibleScalingLowerPolicy332E2644" + } + ], + "AlarmDescription": "Lower threshold scaling alarm", + "Dimensions": [ + { + "Name": "QueueName", + "Value": { + "Fn::GetAtt": [ + "QueueProcessingServiceEcsProcessingQueue552F0B37", + "QueueName" + ] + } + } + ], + "MetricName": "ApproximateNumberOfMessagesVisible", + "Namespace": "AWS/SQS", + "Period": 300, + "Statistic": "Maximum", + "Threshold": 0 + } + }, + "QueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetQueueMessagesVisibleScalingUpperPolicy84DD739A": { + "Type": "AWS::ApplicationAutoScaling::ScalingPolicy", + "Properties": { + "PolicyName": "awsecspatternsqueueesQueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetQueueMessagesVisibleScalingUpperPolicyDEC4E27C", + "PolicyType": "StepScaling", + "ScalingTargetId": { + "Ref": "QueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetA9D54444" + }, + "StepScalingPolicyConfiguration": { + "AdjustmentType": "ChangeInCapacity", + "MetricAggregationType": "Maximum", + "StepAdjustments": [ + { + "MetricIntervalLowerBound": 0, + "MetricIntervalUpperBound": 400, + "ScalingAdjustment": 1 + }, + { + "MetricIntervalLowerBound": 400, + "ScalingAdjustment": 5 + } + ] + } + } + }, + "QueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetQueueMessagesVisibleScalingUpperAlarm2660BEDF": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "EvaluationPeriods": 1, + "AlarmActions": [ + { + "Ref": "QueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetQueueMessagesVisibleScalingUpperPolicy84DD739A" + } + ], + "AlarmDescription": "Upper threshold scaling alarm", + "Dimensions": [ + { + "Name": "QueueName", + "Value": { + "Fn::GetAtt": [ + "QueueProcessingServiceEcsProcessingQueue552F0B37", + "QueueName" + ] + } + } + ], + "MetricName": "ApproximateNumberOfMessagesVisible", + "Namespace": "AWS/SQS", + "Period": 300, + "Statistic": "Maximum", + "Threshold": 100 + } + }, + "EcsDefaultClusterMnL3mNNYNVPC9C1EC7A3": { + "Type": "AWS::ECS::Cluster" + } + }, + "Outputs": { + "QueueProcessingServiceSQSDeadLetterQueueE9058015": { + "Value": { + "Fn::GetAtt": [ + "QueueProcessingServiceEcsProcessingDeadLetterQueueD47A7C6B", + "QueueName" + ] + } + }, + "QueueProcessingServiceSQSDeadLetterQueueArnF7C6D3A8": { + "Value": { + "Fn::GetAtt": [ + "QueueProcessingServiceEcsProcessingDeadLetterQueueD47A7C6B", + "Arn" + ] + } + }, + "QueueProcessingServiceSQSQueue1AD9CD9C": { + "Value": { + "Fn::GetAtt": [ + "QueueProcessingServiceEcsProcessingQueue552F0B37", + "QueueName" + ] + } + }, + "QueueProcessingServiceSQSQueueArn8C4AE4AE": { + "Value": { + "Fn::GetAtt": [ + "QueueProcessingServiceEcsProcessingQueue552F0B37", + "Arn" + ] + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/cdk.out new file mode 100644 index 0000000000000..7925065efbcc4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"31.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/integ.json new file mode 100644 index 0000000000000..2e7ae4426fe0a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "31.0.0", + "testCases": { + "queueProcessingFargateServiceTestWithEphemeralStorageTest/DefaultTest": { + "stacks": [ + "aws-ecs-patterns-queue-es" + ], + "assertionStack": "queueProcessingFargateServiceTestWithEphemeralStorageTest/DefaultTest/DeployAssert", + "assertionStackName": "queueProcessingFargateServiceTestWithEphemeralStorageTestDefaultTestDeployAssert072B4E4C" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/manifest.json new file mode 100644 index 0000000000000..7970364b8a8c6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/manifest.json @@ -0,0 +1,369 @@ +{ + "version": "31.0.0", + "artifacts": { + "aws-ecs-patterns-queue-es.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "aws-ecs-patterns-queue-es.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "aws-ecs-patterns-queue-es": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "aws-ecs-patterns-queue-es.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/142d613070f1f13a0082f9d64ee0beeabb38849e33a01c6c7298a69f8291b340.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "aws-ecs-patterns-queue-es.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "aws-ecs-patterns-queue-es.assets" + ], + "metadata": { + "/aws-ecs-patterns-queue-es/VPC/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCB9E5F0B4" + } + ], + "/aws-ecs-patterns-queue-es/VPC/PublicSubnet1/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet1SubnetB4246D30" + } + ], + "/aws-ecs-patterns-queue-es/VPC/PublicSubnet1/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet1RouteTableFEE4B781" + } + ], + "/aws-ecs-patterns-queue-es/VPC/PublicSubnet1/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet1RouteTableAssociation0B0896DC" + } + ], + "/aws-ecs-patterns-queue-es/VPC/PublicSubnet1/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet1DefaultRoute91CEF279" + } + ], + "/aws-ecs-patterns-queue-es/VPC/PublicSubnet1/EIP": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet1EIP6AD938E8" + } + ], + "/aws-ecs-patterns-queue-es/VPC/PublicSubnet1/NATGateway": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet1NATGatewayE0556630" + } + ], + "/aws-ecs-patterns-queue-es/VPC/PublicSubnet2/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet2Subnet74179F39" + } + ], + "/aws-ecs-patterns-queue-es/VPC/PublicSubnet2/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet2RouteTable6F1A15F1" + } + ], + "/aws-ecs-patterns-queue-es/VPC/PublicSubnet2/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet2RouteTableAssociation5A808732" + } + ], + "/aws-ecs-patterns-queue-es/VPC/PublicSubnet2/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet2DefaultRouteB7481BBA" + } + ], + "/aws-ecs-patterns-queue-es/VPC/PublicSubnet2/EIP": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet2EIP4947BC00" + } + ], + "/aws-ecs-patterns-queue-es/VPC/PublicSubnet2/NATGateway": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet2NATGateway3C070193" + } + ], + "/aws-ecs-patterns-queue-es/VPC/PrivateSubnet1/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet1Subnet8BCA10E0" + } + ], + "/aws-ecs-patterns-queue-es/VPC/PrivateSubnet1/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet1RouteTableBE8A6027" + } + ], + "/aws-ecs-patterns-queue-es/VPC/PrivateSubnet1/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet1RouteTableAssociation347902D1" + } + ], + "/aws-ecs-patterns-queue-es/VPC/PrivateSubnet1/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet1DefaultRouteAE1D6490" + } + ], + "/aws-ecs-patterns-queue-es/VPC/PrivateSubnet2/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet2SubnetCFCDAA7A" + } + ], + "/aws-ecs-patterns-queue-es/VPC/PrivateSubnet2/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet2RouteTable0A19E10E" + } + ], + "/aws-ecs-patterns-queue-es/VPC/PrivateSubnet2/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet2RouteTableAssociation0C73D413" + } + ], + "/aws-ecs-patterns-queue-es/VPC/PrivateSubnet2/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet2DefaultRouteF4F5CFD2" + } + ], + "/aws-ecs-patterns-queue-es/VPC/IGW": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCIGWB7E252D3" + } + ], + "/aws-ecs-patterns-queue-es/VPC/VPCGW": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCVPCGW99B986DC" + } + ], + "/aws-ecs-patterns-queue-es/QueueProcessingService/EcsProcessingDeadLetterQueue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "QueueProcessingServiceEcsProcessingDeadLetterQueueD47A7C6B" + } + ], + "/aws-ecs-patterns-queue-es/QueueProcessingService/EcsProcessingQueue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "QueueProcessingServiceEcsProcessingQueue552F0B37" + } + ], + "/aws-ecs-patterns-queue-es/QueueProcessingService/SQSDeadLetterQueue": [ + { + "type": "aws:cdk:logicalId", + "data": "QueueProcessingServiceSQSDeadLetterQueueE9058015" + } + ], + "/aws-ecs-patterns-queue-es/QueueProcessingService/SQSDeadLetterQueueArn": [ + { + "type": "aws:cdk:logicalId", + "data": "QueueProcessingServiceSQSDeadLetterQueueArnF7C6D3A8" + } + ], + "/aws-ecs-patterns-queue-es/QueueProcessingService/SQSQueue": [ + { + "type": "aws:cdk:logicalId", + "data": "QueueProcessingServiceSQSQueue1AD9CD9C" + } + ], + "/aws-ecs-patterns-queue-es/QueueProcessingService/SQSQueueArn": [ + { + "type": "aws:cdk:logicalId", + "data": "QueueProcessingServiceSQSQueueArn8C4AE4AE" + } + ], + "/aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingTaskDef/TaskRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "QueueProcessingServiceQueueProcessingTaskDefTaskRole782B79A6" + } + ], + "/aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingTaskDef/TaskRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "QueueProcessingServiceQueueProcessingTaskDefTaskRoleDefaultPolicyAE808B19" + } + ], + "/aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingTaskDef/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "QueueProcessingServiceQueueProcessingTaskDef4982F68B" + } + ], + "/aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingTaskDef/QueueProcessingContainer/LogGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "QueueProcessingServiceQueueProcessingTaskDefQueueProcessingContainerLogGroupCC92448A" + } + ], + "/aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingTaskDef/ExecutionRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "QueueProcessingServiceQueueProcessingTaskDefExecutionRole37838985" + } + ], + "/aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingTaskDef/ExecutionRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "QueueProcessingServiceQueueProcessingTaskDefExecutionRoleDefaultPolicyA83D332D" + } + ], + "/aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService/Service": [ + { + "type": "aws:cdk:logicalId", + "data": "QueueProcessingServiceQueueProcessingFargateService0340DB9F" + } + ], + "/aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService/SecurityGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "QueueProcessingServiceQueueProcessingFargateServiceSecurityGroup8FDF413D" + } + ], + "/aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService/TaskCount/Target/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "QueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetA9D54444" + } + ], + "/aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService/TaskCount/Target/CpuScaling/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "QueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetCpuScaling330150E9" + } + ], + "/aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService/TaskCount/Target/QueueMessagesVisibleScaling/LowerPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "QueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetQueueMessagesVisibleScalingLowerPolicy332E2644" + } + ], + "/aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService/TaskCount/Target/QueueMessagesVisibleScaling/LowerAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "QueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetQueueMessagesVisibleScalingLowerAlarm20C30A06" + } + ], + "/aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService/TaskCount/Target/QueueMessagesVisibleScaling/UpperPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "QueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetQueueMessagesVisibleScalingUpperPolicy84DD739A" + } + ], + "/aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService/TaskCount/Target/QueueMessagesVisibleScaling/UpperAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "QueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetQueueMessagesVisibleScalingUpperAlarm2660BEDF" + } + ], + "/aws-ecs-patterns-queue-es/EcsDefaultClusterMnL3mNNYNVPC/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "EcsDefaultClusterMnL3mNNYNVPC9C1EC7A3" + } + ], + "/aws-ecs-patterns-queue-es/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/aws-ecs-patterns-queue-es/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "aws-ecs-patterns-queue-es" + }, + "queueProcessingFargateServiceTestWithEphemeralStorageTestDefaultTestDeployAssert072B4E4C.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "queueProcessingFargateServiceTestWithEphemeralStorageTestDefaultTestDeployAssert072B4E4C.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "queueProcessingFargateServiceTestWithEphemeralStorageTestDefaultTestDeployAssert072B4E4C": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "queueProcessingFargateServiceTestWithEphemeralStorageTestDefaultTestDeployAssert072B4E4C.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "queueProcessingFargateServiceTestWithEphemeralStorageTestDefaultTestDeployAssert072B4E4C.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "queueProcessingFargateServiceTestWithEphemeralStorageTestDefaultTestDeployAssert072B4E4C.assets" + ], + "metadata": { + "/queueProcessingFargateServiceTestWithEphemeralStorageTest/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/queueProcessingFargateServiceTestWithEphemeralStorageTest/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "queueProcessingFargateServiceTestWithEphemeralStorageTest/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/queueProcessingFargateServiceTestWithEphemeralStorageTestDefaultTestDeployAssert072B4E4C.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/queueProcessingFargateServiceTestWithEphemeralStorageTestDefaultTestDeployAssert072B4E4C.assets.json new file mode 100644 index 0000000000000..7688f63fc726a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/queueProcessingFargateServiceTestWithEphemeralStorageTestDefaultTestDeployAssert072B4E4C.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "queueProcessingFargateServiceTestWithEphemeralStorageTestDefaultTestDeployAssert072B4E4C.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/queueProcessingFargateServiceTestWithEphemeralStorageTestDefaultTestDeployAssert072B4E4C.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/queueProcessingFargateServiceTestWithEphemeralStorageTestDefaultTestDeployAssert072B4E4C.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/queueProcessingFargateServiceTestWithEphemeralStorageTestDefaultTestDeployAssert072B4E4C.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/tree.json new file mode 100644 index 0000000000000..d0d0e60313876 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.js.snapshot/tree.json @@ -0,0 +1,1606 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "aws-ecs-patterns-queue-es": { + "id": "aws-ecs-patterns-queue-es", + "path": "aws-ecs-patterns-queue-es", + "children": { + "VPC": { + "id": "VPC", + "path": "aws-ecs-patterns-queue-es/VPC", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-ecs-patterns-queue-es/VPC/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::VPC", + "aws:cdk:cloudformation:props": { + "cidrBlock": "10.0.0.0/16", + "enableDnsHostnames": true, + "enableDnsSupport": true, + "instanceTenancy": "default", + "tags": [ + { + "key": "Name", + "value": "aws-ecs-patterns-queue-es/VPC" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnVPC", + "version": "0.0.0" + } + }, + "PublicSubnet1": { + "id": "PublicSubnet1", + "path": "aws-ecs-patterns-queue-es/VPC/PublicSubnet1", + "children": { + "Subnet": { + "id": "Subnet", + "path": "aws-ecs-patterns-queue-es/VPC/PublicSubnet1/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "VPCB9E5F0B4" + }, + "availabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.0.0/18", + "mapPublicIpOnLaunch": true, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Public" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Public" + }, + { + "key": "Name", + "value": "aws-ecs-patterns-queue-es/VPC/PublicSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" + } + }, + "Acl": { + "id": "Acl", + "path": "aws-ecs-patterns-queue-es/VPC/PublicSubnet1/Acl", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "aws-ecs-patterns-queue-es/VPC/PublicSubnet1/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "VPCB9E5F0B4" + }, + "tags": [ + { + "key": "Name", + "value": "aws-ecs-patterns-queue-es/VPC/PublicSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "aws-ecs-patterns-queue-es/VPC/PublicSubnet1/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VPCPublicSubnet1RouteTableFEE4B781" + }, + "subnetId": { + "Ref": "VPCPublicSubnet1SubnetB4246D30" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "aws-ecs-patterns-queue-es/VPC/PublicSubnet1/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VPCPublicSubnet1RouteTableFEE4B781" + }, + "destinationCidrBlock": "0.0.0.0/0", + "gatewayId": { + "Ref": "VPCIGWB7E252D3" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + }, + "EIP": { + "id": "EIP", + "path": "aws-ecs-patterns-queue-es/VPC/PublicSubnet1/EIP", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::EIP", + "aws:cdk:cloudformation:props": { + "domain": "vpc", + "tags": [ + { + "key": "Name", + "value": "aws-ecs-patterns-queue-es/VPC/PublicSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnEIP", + "version": "0.0.0" + } + }, + "NATGateway": { + "id": "NATGateway", + "path": "aws-ecs-patterns-queue-es/VPC/PublicSubnet1/NATGateway", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", + "aws:cdk:cloudformation:props": { + "subnetId": { + "Ref": "VPCPublicSubnet1SubnetB4246D30" + }, + "allocationId": { + "Fn::GetAtt": [ + "VPCPublicSubnet1EIP6AD938E8", + "AllocationId" + ] + }, + "tags": [ + { + "key": "Name", + "value": "aws-ecs-patterns-queue-es/VPC/PublicSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnNatGateway", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PublicSubnet", + "version": "0.0.0" + } + }, + "PublicSubnet2": { + "id": "PublicSubnet2", + "path": "aws-ecs-patterns-queue-es/VPC/PublicSubnet2", + "children": { + "Subnet": { + "id": "Subnet", + "path": "aws-ecs-patterns-queue-es/VPC/PublicSubnet2/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "VPCB9E5F0B4" + }, + "availabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.64.0/18", + "mapPublicIpOnLaunch": true, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Public" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Public" + }, + { + "key": "Name", + "value": "aws-ecs-patterns-queue-es/VPC/PublicSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" + } + }, + "Acl": { + "id": "Acl", + "path": "aws-ecs-patterns-queue-es/VPC/PublicSubnet2/Acl", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "aws-ecs-patterns-queue-es/VPC/PublicSubnet2/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "VPCB9E5F0B4" + }, + "tags": [ + { + "key": "Name", + "value": "aws-ecs-patterns-queue-es/VPC/PublicSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "aws-ecs-patterns-queue-es/VPC/PublicSubnet2/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VPCPublicSubnet2RouteTable6F1A15F1" + }, + "subnetId": { + "Ref": "VPCPublicSubnet2Subnet74179F39" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "aws-ecs-patterns-queue-es/VPC/PublicSubnet2/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VPCPublicSubnet2RouteTable6F1A15F1" + }, + "destinationCidrBlock": "0.0.0.0/0", + "gatewayId": { + "Ref": "VPCIGWB7E252D3" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + }, + "EIP": { + "id": "EIP", + "path": "aws-ecs-patterns-queue-es/VPC/PublicSubnet2/EIP", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::EIP", + "aws:cdk:cloudformation:props": { + "domain": "vpc", + "tags": [ + { + "key": "Name", + "value": "aws-ecs-patterns-queue-es/VPC/PublicSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnEIP", + "version": "0.0.0" + } + }, + "NATGateway": { + "id": "NATGateway", + "path": "aws-ecs-patterns-queue-es/VPC/PublicSubnet2/NATGateway", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", + "aws:cdk:cloudformation:props": { + "subnetId": { + "Ref": "VPCPublicSubnet2Subnet74179F39" + }, + "allocationId": { + "Fn::GetAtt": [ + "VPCPublicSubnet2EIP4947BC00", + "AllocationId" + ] + }, + "tags": [ + { + "key": "Name", + "value": "aws-ecs-patterns-queue-es/VPC/PublicSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnNatGateway", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PublicSubnet", + "version": "0.0.0" + } + }, + "PrivateSubnet1": { + "id": "PrivateSubnet1", + "path": "aws-ecs-patterns-queue-es/VPC/PrivateSubnet1", + "children": { + "Subnet": { + "id": "Subnet", + "path": "aws-ecs-patterns-queue-es/VPC/PrivateSubnet1/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "VPCB9E5F0B4" + }, + "availabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.128.0/18", + "mapPublicIpOnLaunch": false, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Private" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Private" + }, + { + "key": "Name", + "value": "aws-ecs-patterns-queue-es/VPC/PrivateSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" + } + }, + "Acl": { + "id": "Acl", + "path": "aws-ecs-patterns-queue-es/VPC/PrivateSubnet1/Acl", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "aws-ecs-patterns-queue-es/VPC/PrivateSubnet1/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "VPCB9E5F0B4" + }, + "tags": [ + { + "key": "Name", + "value": "aws-ecs-patterns-queue-es/VPC/PrivateSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "aws-ecs-patterns-queue-es/VPC/PrivateSubnet1/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VPCPrivateSubnet1RouteTableBE8A6027" + }, + "subnetId": { + "Ref": "VPCPrivateSubnet1Subnet8BCA10E0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "aws-ecs-patterns-queue-es/VPC/PrivateSubnet1/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VPCPrivateSubnet1RouteTableBE8A6027" + }, + "destinationCidrBlock": "0.0.0.0/0", + "natGatewayId": { + "Ref": "VPCPublicSubnet1NATGatewayE0556630" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PrivateSubnet", + "version": "0.0.0" + } + }, + "PrivateSubnet2": { + "id": "PrivateSubnet2", + "path": "aws-ecs-patterns-queue-es/VPC/PrivateSubnet2", + "children": { + "Subnet": { + "id": "Subnet", + "path": "aws-ecs-patterns-queue-es/VPC/PrivateSubnet2/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "VPCB9E5F0B4" + }, + "availabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.192.0/18", + "mapPublicIpOnLaunch": false, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Private" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Private" + }, + { + "key": "Name", + "value": "aws-ecs-patterns-queue-es/VPC/PrivateSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" + } + }, + "Acl": { + "id": "Acl", + "path": "aws-ecs-patterns-queue-es/VPC/PrivateSubnet2/Acl", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "aws-ecs-patterns-queue-es/VPC/PrivateSubnet2/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "VPCB9E5F0B4" + }, + "tags": [ + { + "key": "Name", + "value": "aws-ecs-patterns-queue-es/VPC/PrivateSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "aws-ecs-patterns-queue-es/VPC/PrivateSubnet2/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VPCPrivateSubnet2RouteTable0A19E10E" + }, + "subnetId": { + "Ref": "VPCPrivateSubnet2SubnetCFCDAA7A" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "aws-ecs-patterns-queue-es/VPC/PrivateSubnet2/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VPCPrivateSubnet2RouteTable0A19E10E" + }, + "destinationCidrBlock": "0.0.0.0/0", + "natGatewayId": { + "Ref": "VPCPublicSubnet2NATGateway3C070193" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PrivateSubnet", + "version": "0.0.0" + } + }, + "IGW": { + "id": "IGW", + "path": "aws-ecs-patterns-queue-es/VPC/IGW", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::InternetGateway", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "aws-ecs-patterns-queue-es/VPC" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnInternetGateway", + "version": "0.0.0" + } + }, + "VPCGW": { + "id": "VPCGW", + "path": "aws-ecs-patterns-queue-es/VPC/VPCGW", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "VPCB9E5F0B4" + }, + "internetGatewayId": { + "Ref": "VPCIGWB7E252D3" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnVPCGatewayAttachment", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.Vpc", + "version": "0.0.0" + } + }, + "QueueProcessingService": { + "id": "QueueProcessingService", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService", + "children": { + "EcsProcessingDeadLetterQueue": { + "id": "EcsProcessingDeadLetterQueue", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/EcsProcessingDeadLetterQueue", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/EcsProcessingDeadLetterQueue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "messageRetentionPeriod": 1209600 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "EcsProcessingQueue": { + "id": "EcsProcessingQueue", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/EcsProcessingQueue", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/EcsProcessingQueue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "redrivePolicy": { + "deadLetterTargetArn": { + "Fn::GetAtt": [ + "QueueProcessingServiceEcsProcessingDeadLetterQueueD47A7C6B", + "Arn" + ] + }, + "maxReceiveCount": 3 + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "SQSDeadLetterQueue": { + "id": "SQSDeadLetterQueue", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/SQSDeadLetterQueue", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnOutput", + "version": "0.0.0" + } + }, + "SQSDeadLetterQueueArn": { + "id": "SQSDeadLetterQueueArn", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/SQSDeadLetterQueueArn", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnOutput", + "version": "0.0.0" + } + }, + "SQSQueue": { + "id": "SQSQueue", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/SQSQueue", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnOutput", + "version": "0.0.0" + } + }, + "SQSQueueArn": { + "id": "SQSQueueArn", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/SQSQueueArn", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnOutput", + "version": "0.0.0" + } + }, + "QueueProcessingTaskDef": { + "id": "QueueProcessingTaskDef", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingTaskDef", + "children": { + "TaskRole": { + "id": "TaskRole", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingTaskDef/TaskRole", + "children": { + "ImportTaskRole": { + "id": "ImportTaskRole", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingTaskDef/TaskRole/ImportTaskRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingTaskDef/TaskRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "ecs-tasks.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingTaskDef/TaskRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingTaskDef/TaskRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "sqs:ChangeMessageVisibility", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:GetQueueUrl", + "sqs:ReceiveMessage" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "QueueProcessingServiceEcsProcessingQueue552F0B37", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "QueueProcessingServiceQueueProcessingTaskDefTaskRoleDefaultPolicyAE808B19", + "roles": [ + { + "Ref": "QueueProcessingServiceQueueProcessingTaskDefTaskRole782B79A6" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingTaskDef/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ECS::TaskDefinition", + "aws:cdk:cloudformation:props": { + "containerDefinitions": [ + { + "essential": true, + "image": { + "Fn::Sub": "${AWS::AccountId}.dkr.ecr.${AWS::Region}.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-${AWS::AccountId}-${AWS::Region}:95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417" + }, + "name": "QueueProcessingContainer", + "logConfiguration": { + "logDriver": "awslogs", + "options": { + "awslogs-group": { + "Ref": "QueueProcessingServiceQueueProcessingTaskDefQueueProcessingContainerLogGroupCC92448A" + }, + "awslogs-stream-prefix": "QueueProcessingService", + "awslogs-region": { + "Ref": "AWS::Region" + } + } + }, + "environment": [ + { + "name": "QUEUE_NAME", + "value": { + "Fn::GetAtt": [ + "QueueProcessingServiceEcsProcessingQueue552F0B37", + "QueueName" + ] + } + } + ] + } + ], + "cpu": "256", + "ephemeralStorage": { + "sizeInGiB": 50 + }, + "executionRoleArn": { + "Fn::GetAtt": [ + "QueueProcessingServiceQueueProcessingTaskDefExecutionRole37838985", + "Arn" + ] + }, + "family": "awsecspatternsqueueesQueueProcessingServiceQueueProcessingTaskDef80674093", + "memory": "512", + "networkMode": "awsvpc", + "requiresCompatibilities": [ + "FARGATE" + ], + "taskRoleArn": { + "Fn::GetAtt": [ + "QueueProcessingServiceQueueProcessingTaskDefTaskRole782B79A6", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ecs.CfnTaskDefinition", + "version": "0.0.0" + } + }, + "QueueProcessingContainer": { + "id": "QueueProcessingContainer", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingTaskDef/QueueProcessingContainer", + "children": { + "AssetImage": { + "id": "AssetImage", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingTaskDef/QueueProcessingContainer/AssetImage", + "children": { + "Staging": { + "id": "Staging", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingTaskDef/QueueProcessingContainer/AssetImage/Staging", + "constructInfo": { + "fqn": "aws-cdk-lib.AssetStaging", + "version": "0.0.0" + } + }, + "Repository": { + "id": "Repository", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingTaskDef/QueueProcessingContainer/AssetImage/Repository", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ecr.RepositoryBase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ecr_assets.DockerImageAsset", + "version": "0.0.0" + } + }, + "LogGroup": { + "id": "LogGroup", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingTaskDef/QueueProcessingContainer/LogGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingTaskDef/QueueProcessingContainer/LogGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", + "aws:cdk:cloudformation:props": {} + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.LogGroup", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ecs.ContainerDefinition", + "version": "0.0.0" + } + }, + "ExecutionRole": { + "id": "ExecutionRole", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingTaskDef/ExecutionRole", + "children": { + "ImportExecutionRole": { + "id": "ImportExecutionRole", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingTaskDef/ExecutionRole/ImportExecutionRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingTaskDef/ExecutionRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "ecs-tasks.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingTaskDef/ExecutionRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingTaskDef/ExecutionRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "ecr:BatchCheckLayerAvailability", + "ecr:BatchGetImage", + "ecr:GetDownloadUrlForLayer" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ecr:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":repository/", + { + "Fn::Sub": "cdk-hnb659fds-container-assets-${AWS::AccountId}-${AWS::Region}" + } + ] + ] + } + }, + { + "Action": "ecr:GetAuthorizationToken", + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "QueueProcessingServiceQueueProcessingTaskDefQueueProcessingContainerLogGroupCC92448A", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "QueueProcessingServiceQueueProcessingTaskDefExecutionRoleDefaultPolicyA83D332D", + "roles": [ + { + "Ref": "QueueProcessingServiceQueueProcessingTaskDefExecutionRole37838985" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ecs.FargateTaskDefinition", + "version": "0.0.0" + } + }, + "QueueProcessingFargateService": { + "id": "QueueProcessingFargateService", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService", + "children": { + "Service": { + "id": "Service", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService/Service", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ECS::Service", + "aws:cdk:cloudformation:props": { + "cluster": { + "Ref": "EcsDefaultClusterMnL3mNNYNVPC9C1EC7A3" + }, + "deploymentConfiguration": { + "maximumPercent": 200, + "minimumHealthyPercent": 50 + }, + "enableEcsManagedTags": false, + "launchType": "FARGATE", + "networkConfiguration": { + "awsvpcConfiguration": { + "assignPublicIp": "DISABLED", + "subnets": [ + { + "Ref": "VPCPrivateSubnet1Subnet8BCA10E0" + }, + { + "Ref": "VPCPrivateSubnet2SubnetCFCDAA7A" + } + ], + "securityGroups": [ + { + "Fn::GetAtt": [ + "QueueProcessingServiceQueueProcessingFargateServiceSecurityGroup8FDF413D", + "GroupId" + ] + } + ] + } + }, + "taskDefinition": { + "Ref": "QueueProcessingServiceQueueProcessingTaskDef4982F68B" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ecs.CfnService", + "version": "0.0.0" + } + }, + "SecurityGroup": { + "id": "SecurityGroup", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService/SecurityGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService/SecurityGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", + "aws:cdk:cloudformation:props": { + "groupDescription": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService/SecurityGroup", + "securityGroupEgress": [ + { + "cidrIp": "0.0.0.0/0", + "description": "Allow all outbound traffic by default", + "ipProtocol": "-1" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSecurityGroup", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.SecurityGroup", + "version": "0.0.0" + } + }, + "ScalingRole": { + "id": "ScalingRole", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService/ScalingRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "TaskCount": { + "id": "TaskCount", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService/TaskCount", + "children": { + "Target": { + "id": "Target", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService/TaskCount/Target", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService/TaskCount/Target/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApplicationAutoScaling::ScalableTarget", + "aws:cdk:cloudformation:props": { + "maxCapacity": 2, + "minCapacity": 0, + "resourceId": { + "Fn::Join": [ + "", + [ + "service/", + { + "Ref": "EcsDefaultClusterMnL3mNNYNVPC9C1EC7A3" + }, + "/", + { + "Fn::GetAtt": [ + "QueueProcessingServiceQueueProcessingFargateService0340DB9F", + "Name" + ] + } + ] + ] + }, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/aws-service-role/ecs.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_ECSService" + ] + ] + }, + "scalableDimension": "ecs:service:DesiredCount", + "serviceNamespace": "ecs" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_applicationautoscaling.CfnScalableTarget", + "version": "0.0.0" + } + }, + "CpuScaling": { + "id": "CpuScaling", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService/TaskCount/Target/CpuScaling", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService/TaskCount/Target/CpuScaling/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApplicationAutoScaling::ScalingPolicy", + "aws:cdk:cloudformation:props": { + "policyName": "awsecspatternsqueueesQueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetCpuScaling83DE8898", + "policyType": "TargetTrackingScaling", + "scalingTargetId": { + "Ref": "QueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetA9D54444" + }, + "targetTrackingScalingPolicyConfiguration": { + "predefinedMetricSpecification": { + "predefinedMetricType": "ECSServiceAverageCPUUtilization" + }, + "targetValue": 50 + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_applicationautoscaling.CfnScalingPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_applicationautoscaling.TargetTrackingScalingPolicy", + "version": "0.0.0" + } + }, + "QueueMessagesVisibleScaling": { + "id": "QueueMessagesVisibleScaling", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService/TaskCount/Target/QueueMessagesVisibleScaling", + "children": { + "LowerPolicy": { + "id": "LowerPolicy", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService/TaskCount/Target/QueueMessagesVisibleScaling/LowerPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService/TaskCount/Target/QueueMessagesVisibleScaling/LowerPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApplicationAutoScaling::ScalingPolicy", + "aws:cdk:cloudformation:props": { + "policyName": "awsecspatternsqueueesQueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetQueueMessagesVisibleScalingLowerPolicyE9AD74AB", + "policyType": "StepScaling", + "scalingTargetId": { + "Ref": "QueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetA9D54444" + }, + "stepScalingPolicyConfiguration": { + "adjustmentType": "ChangeInCapacity", + "metricAggregationType": "Maximum", + "stepAdjustments": [ + { + "metricIntervalUpperBound": 0, + "scalingAdjustment": -1 + } + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_applicationautoscaling.CfnScalingPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_applicationautoscaling.StepScalingAction", + "version": "0.0.0" + } + }, + "LowerAlarm": { + "id": "LowerAlarm", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService/TaskCount/Target/QueueMessagesVisibleScaling/LowerAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService/TaskCount/Target/QueueMessagesVisibleScaling/LowerAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "comparisonOperator": "LessThanOrEqualToThreshold", + "evaluationPeriods": 1, + "alarmActions": [ + { + "Ref": "QueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetQueueMessagesVisibleScalingLowerPolicy332E2644" + } + ], + "alarmDescription": "Lower threshold scaling alarm", + "dimensions": [ + { + "name": "QueueName", + "value": { + "Fn::GetAtt": [ + "QueueProcessingServiceEcsProcessingQueue552F0B37", + "QueueName" + ] + } + } + ], + "metricName": "ApproximateNumberOfMessagesVisible", + "namespace": "AWS/SQS", + "period": 300, + "statistic": "Maximum", + "threshold": 0 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "0.0.0" + } + }, + "UpperPolicy": { + "id": "UpperPolicy", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService/TaskCount/Target/QueueMessagesVisibleScaling/UpperPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService/TaskCount/Target/QueueMessagesVisibleScaling/UpperPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApplicationAutoScaling::ScalingPolicy", + "aws:cdk:cloudformation:props": { + "policyName": "awsecspatternsqueueesQueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetQueueMessagesVisibleScalingUpperPolicyDEC4E27C", + "policyType": "StepScaling", + "scalingTargetId": { + "Ref": "QueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetA9D54444" + }, + "stepScalingPolicyConfiguration": { + "adjustmentType": "ChangeInCapacity", + "metricAggregationType": "Maximum", + "stepAdjustments": [ + { + "metricIntervalLowerBound": 0, + "metricIntervalUpperBound": 400, + "scalingAdjustment": 1 + }, + { + "metricIntervalLowerBound": 400, + "scalingAdjustment": 5 + } + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_applicationautoscaling.CfnScalingPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_applicationautoscaling.StepScalingAction", + "version": "0.0.0" + } + }, + "UpperAlarm": { + "id": "UpperAlarm", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService/TaskCount/Target/QueueMessagesVisibleScaling/UpperAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-ecs-patterns-queue-es/QueueProcessingService/QueueProcessingFargateService/TaskCount/Target/QueueMessagesVisibleScaling/UpperAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "evaluationPeriods": 1, + "alarmActions": [ + { + "Ref": "QueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetQueueMessagesVisibleScalingUpperPolicy84DD739A" + } + ], + "alarmDescription": "Upper threshold scaling alarm", + "dimensions": [ + { + "name": "QueueName", + "value": { + "Fn::GetAtt": [ + "QueueProcessingServiceEcsProcessingQueue552F0B37", + "QueueName" + ] + } + } + ], + "metricName": "ApproximateNumberOfMessagesVisible", + "namespace": "AWS/SQS", + "period": 300, + "statistic": "Maximum", + "threshold": 100 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_applicationautoscaling.StepScalingPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_applicationautoscaling.ScalableTarget", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ecs.ScalableTaskCount", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ecs.FargateService", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ecs_patterns.QueueProcessingFargateService", + "version": "0.0.0" + } + }, + "EcsDefaultClusterMnL3mNNYNVPC": { + "id": "EcsDefaultClusterMnL3mNNYNVPC", + "path": "aws-ecs-patterns-queue-es/EcsDefaultClusterMnL3mNNYNVPC", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-ecs-patterns-queue-es/EcsDefaultClusterMnL3mNNYNVPC/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ECS::Cluster", + "aws:cdk:cloudformation:props": {} + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ecs.CfnCluster", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ecs.Cluster", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "aws-ecs-patterns-queue-es/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "aws-ecs-patterns-queue-es/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "queueProcessingFargateServiceTestWithEphemeralStorageTest": { + "id": "queueProcessingFargateServiceTestWithEphemeralStorageTest", + "path": "queueProcessingFargateServiceTestWithEphemeralStorageTest", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "queueProcessingFargateServiceTestWithEphemeralStorageTest/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "queueProcessingFargateServiceTestWithEphemeralStorageTest/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "queueProcessingFargateServiceTestWithEphemeralStorageTest/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "queueProcessingFargateServiceTestWithEphemeralStorageTest/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "queueProcessingFargateServiceTestWithEphemeralStorageTest/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.ts new file mode 100644 index 0000000000000..b36c28d1ed5aa --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-ephemeral-storage.ts @@ -0,0 +1,26 @@ +import * as path from 'path'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import { App, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { QueueProcessingFargateService } from 'aws-cdk-lib/aws-ecs-patterns'; + +const app = new App(); +const stack = new Stack(app, 'aws-ecs-patterns-queue-es'); +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 2, +}); + +new QueueProcessingFargateService(stack, 'QueueProcessingService', { + vpc, + memoryLimitMiB: 512, + image: new ecs.AssetImage(path.join(__dirname, '..', 'sqs-reader')), + minScalingCapacity: 0, + ephemeralStorageGiB: 50, +}); + +new integ.IntegTest(app, 'queueProcessingFargateServiceTestWithEphemeralStorageTest', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/product-stack-snapshots/integservicecatalogproductProductStackHistory4D520FF1.integservicecatalogproductSNSTopicProduct3B51CF591.v1.product.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/product-stack-snapshots/integservicecatalogproductProductStackHistory4D520FF1.integservicecatalogproductSNSTopicProduct3B51CF591.v1.product.template.json new file mode 100644 index 0000000000000..2f2f4704a22ad --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/product-stack-snapshots/integservicecatalogproductProductStackHistory4D520FF1.integservicecatalogproductSNSTopicProduct3B51CF591.v1.product.template.json @@ -0,0 +1,7 @@ +{ + "Resources": { + "TopicProductD757E287": { + "Type": "AWS::SNS::Topic" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/cli-lib/THIRD_PARTY_LICENSES b/packages/@aws-cdk/cli-lib/THIRD_PARTY_LICENSES index 5e46d018bc141..a716629dad040 100644 --- a/packages/@aws-cdk/cli-lib/THIRD_PARTY_LICENSES +++ b/packages/@aws-cdk/cli-lib/THIRD_PARTY_LICENSES @@ -1,4 +1,4 @@ -The @aws-cdk/cli-lib package includes the following third-party software/licensing: +The @aws-cdk/cli-lib-alpha package includes the following third-party software/licensing: ** @jsii/check-node@1.78.1 - https://www.npmjs.com/package/@jsii/check-node/v/1.78.1 | Apache-2.0 jsii diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/README.md b/packages/aws-cdk-lib/aws-ecs-patterns/README.md index b052fea3eec4c..72097ce015f4c 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/README.md +++ b/packages/aws-cdk-lib/aws-ecs-patterns/README.md @@ -48,6 +48,25 @@ const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargat }, }); +loadBalancedFargateService.targetGroup.configureHealthCheck({ + path: "/custom-health-path", +}); +``` +On Fargate Platform Version 1.4.0 or later, you may specify from 20GiB to 200GiB of [ephemeral storage](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/fargate-task-storage.html#fargate-task-storage-pv14): + +* `ApplicationLoadBalancedFargateService` + +```ts +declare const cluster: ecs.Cluster; +const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', { + cluster, + memoryLimitMiB: 1024, + cpu: 512, + ephemeralStorageGiB: 100, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + }, +}); loadBalancedFargateService.targetGroup.configureHealthCheck({ path: "/custom-health-path", }); @@ -120,7 +139,33 @@ const loadBalancedFargateService = new ecsPatterns.ApplicationMultipleTargetGrou ], }); ``` +On Fargate Platform Version 1.4.0 or later, you may specify from 20GiB to 200GiB of [ephemeral storage](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/fargate-task-storage.html#fargate-task-storage-pv14): +* `ApplicationMultipleTargetGroupsFargateService` + +```ts +/ One application load balancer with one listener and two target groups. +declare const cluster: ecs.Cluster; +const loadBalancedFargateService = new ecsPatterns.ApplicationMultipleTargetGroupsFargateService(this, 'Service', { + cluster, + memoryLimitMiB: 1024, + cpu: 512, + ephemeralStorageGiB: 100, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + }, + targetGroups: [ + { + containerPort: 80, + }, + { + containerPort: 90, + pathPattern: 'a/b/c', + priority: 10, + }, + ], +}); +``` ## Network Load Balanced Services To define an Amazon ECS service that is behind a network load balancer, instantiate one of the following: @@ -157,6 +202,23 @@ const loadBalancedFargateService = new ecsPatterns.NetworkLoadBalancedFargateSer }); ``` +On Fargate Platform Version 1.4.0 or later, you may specify from 20GiB to 200GiB of [ephemeral storage](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/fargate-task-storage.html#fargate-task-storage-pv14): + +* `NetworkLoadBalancedFargateService` + +```ts +declare const cluster: ecs.Cluster; +const loadBalancedFargateService = new ecsPatterns.NetworkLoadBalancedFargateService(this, 'Service', { + cluster, + memoryLimitMiB: 1024, + cpu: 512, + ephemeralStorageGiB: 100, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + }, +}); +``` + The CDK will create a new Amazon ECS cluster if you specify a VPC and omit `cluster`. If you deploy multiple services the CDK will only create one cluster per VPC. If `cluster` and `vpc` are omitted, the CDK creates a new VPC with subnets in two Availability Zones and a cluster within this VPC. @@ -248,6 +310,50 @@ const loadBalancedFargateService = new ecsPatterns.NetworkMultipleTargetGroupsFa ], }); ``` +On Fargate Platform Version 1.4.0 or later, you may specify from 20GiB to 200GiB of [ephemeral storage](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/fargate-task-storage.html#fargate-task-storage-pv14): + +* NetworkMultipleTargetGroupsFargateService + +```ts +/ Two network load balancers, each with their own listener and target group. +declare const cluster: ecs.Cluster; +const loadBalancedFargateService = new ecsPatterns.NetworkMultipleTargetGroupsFargateService(this, 'Service', { + cluster, + memoryLimitMiB: 512, + ephemeralStorageGiB: 100, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + }, + loadBalancers: [ + { + name: 'lb1', + listeners: [ + { + name: 'listener1', + }, + ], + }, + { + name: 'lb2', + listeners: [ + { + name: 'listener2', + }, + ], + }, + ], + targetGroups: [ + { + containerPort: 80, + listener: 'listener1', + }, + { + containerPort: 90, + listener: 'listener2', + }, + ], +}); +``` ## Queue Processing Services @@ -292,6 +398,28 @@ const queueProcessingFargateService = new ecsPatterns.QueueProcessingFargateServ containerName: 'test', }); ``` +On Fargate Platform Version 1.4.0 or later, you may specify from 20GiB to 200GiB of [ephemeral storage](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/fargate-task-storage.html#fargate-task-storage-pv14): + +* `QueueProcessingFargateService` + +```ts +declare const cluster: ecs.Cluster; +const queueProcessingFargateService = new ecsPatterns.QueueProcessingFargateService(this, 'Service', { + cluster, + memoryLimitMiB: 512, + ephemeralStorageGiB: 100, + image: ecs.ContainerImage.fromRegistry('test'), + command: ["-c", "4", "amazon.com"], + enableLogging: false, + desiredTaskCount: 2, + environment: { + TEST_ENVIRONMENT_VARIABLE1: "test environment variable 1 value", + TEST_ENVIRONMENT_VARIABLE2: "test environment variable 2 value", + }, + maxScalingCapacity: 5, + containerName: 'test', +}); +``` when queue not provided by user, CDK will create a primary queue and a dead letter queue with default redrive policy and attach permission to the task to be able to access the primary queue. @@ -332,6 +460,24 @@ const scheduledFargateTask = new ecsPatterns.ScheduledFargateTask(this, 'Schedul }); ``` +On Fargate Platform Version 1.4.0 or later, you may specify from 20GiB to 200GiB of [ephemeral storage](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/fargate-task-storage.html#fargate-task-storage-pv14): + +* `ScheduledFargateTask` + +```ts +declare const cluster: ecs.Cluster; +const scheduledFargateTask = new ecsPatterns.ScheduledFargateTask(this, 'ScheduledFargateTask', { + cluster, + scheduledFargateTaskImageOptions: { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + memoryLimitMiB: 512, + ephemeralStorageGiB: 100, + }, + schedule: appscaling.Schedule.expression('rate(1 minute)'), + platformVersion: ecs.FargatePlatformVersion.LATEST, +}); +``` + ## Additional Examples In addition to using the constructs, users can also add logic to customize these constructs: diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts index 514639acd71ee..f8226f60ed59d 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts @@ -391,6 +391,15 @@ export interface ApplicationLoadBalancedTaskImageOptions { * @default none */ readonly command?: string[]; + + /** + * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200 GiB. + * + * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. + * + * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. + */ + readonly ephemeralStorageGiB?: number; } /** diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts index 4e11fad6db585..60d617279f496 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts @@ -205,6 +205,15 @@ export interface ApplicationLoadBalancedTaskImageProps { * @default - No labels. */ readonly dockerLabels?: { [key: string]: string }; + + /** + * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200 GiB. + * + * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. + * + * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. + */ + readonly ephemeralStorageGiB?: number; } /** 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 61911ae406578..c135a1c9392fb 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 @@ -285,6 +285,15 @@ export interface NetworkLoadBalancedTaskImageOptions { * @default - No labels. */ readonly dockerLabels?: { [key: string]: string }; + + /** + * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200 GiB. + * + * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. + * + * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. + */ + readonly ephemeralStorageGiB?: number; } /** diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts index 33427c75c3758..21f21e57d42b1 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts @@ -196,6 +196,14 @@ export interface NetworkLoadBalancedTaskImageProps { * @default - No labels. */ readonly dockerLabels?: { [key: string]: string }; + /** + * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200 GiB. + * + * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. + * + * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. + */ + readonly ephemeralStorageGiB?: number; } /** diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/scheduled-task-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/scheduled-task-base.ts index 9190bb3ed2fb3..a795c8ecbb380 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/scheduled-task-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/scheduled-task-base.ts @@ -110,6 +110,15 @@ export interface ScheduledTaskImageProps { * @default - AwsLogDriver if enableLogging is true */ readonly logDriver?: LogDriver; + + /** + * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200 GiB. + * + * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. + * + * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. + */ + readonly ephemeralStorageGiB?: number; } /** diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-load-balanced-ecs-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-load-balanced-ecs-service.ts index df3dc32bac74e..d1781f7db5eea 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-load-balanced-ecs-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-load-balanced-ecs-service.ts @@ -108,6 +108,9 @@ export class ApplicationLoadBalancedEc2Service extends ApplicationLoadBalancedSe this.taskDefinition = props.taskDefinition; } else if (props.taskImageOptions) { const taskImageOptions = props.taskImageOptions; + if (taskImageOptions.ephemeralStorageGiB) { + throw new Error('ephemeralStorageGiB is only supported for Fargate service.'); + } this.taskDefinition = new Ec2TaskDefinition(this, 'TaskDef', { executionRole: taskImageOptions.executionRole, taskRole: taskImageOptions.taskRole, diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-multiple-target-groups-ecs-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-multiple-target-groups-ecs-service.ts index c69386bd2e719..69cb085b6d67f 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-multiple-target-groups-ecs-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-multiple-target-groups-ecs-service.ts @@ -108,6 +108,9 @@ export class ApplicationMultipleTargetGroupsEc2Service extends ApplicationMultip this.taskDefinition = props.taskDefinition; } else if (props.taskImageOptions) { const taskImageOptions = props.taskImageOptions; + if (taskImageOptions.ephemeralStorageGiB) { + throw new Error('ephemeralStorageGiB is only supported for Fargate service.'); + } this.taskDefinition = new Ec2TaskDefinition(this, 'TaskDef', { executionRole: taskImageOptions.executionRole, taskRole: taskImageOptions.taskRole, 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 e525ee02cf65e..d7f3b69fc0673 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 @@ -106,6 +106,9 @@ export class NetworkLoadBalancedEc2Service extends NetworkLoadBalancedServiceBas this.taskDefinition = props.taskDefinition; } else if (props.taskImageOptions) { const taskImageOptions = props.taskImageOptions; + if (taskImageOptions.ephemeralStorageGiB) { + throw new Error('ephemeralStorageGiB is only supported for Fargate service.'); + } this.taskDefinition = new Ec2TaskDefinition(this, 'TaskDef', { executionRole: taskImageOptions.executionRole, taskRole: taskImageOptions.taskRole, diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/network-multiple-target-groups-ecs-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/network-multiple-target-groups-ecs-service.ts index fa176f8930962..fee2561bebe01 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/network-multiple-target-groups-ecs-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/network-multiple-target-groups-ecs-service.ts @@ -107,6 +107,9 @@ export class NetworkMultipleTargetGroupsEc2Service extends NetworkMultipleTarget this.taskDefinition = props.taskDefinition; } else if (props.taskImageOptions) { const taskImageOptions = props.taskImageOptions; + if (taskImageOptions.ephemeralStorageGiB) { + throw new Error('ephemeralStorageGiB is only supported for Fargate service.'); + } this.taskDefinition = new Ec2TaskDefinition(this, 'TaskDef', { executionRole: taskImageOptions.executionRole, taskRole: taskImageOptions.taskRole, diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/scheduled-ecs-task.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/scheduled-ecs-task.ts index 1bc0ffe350239..af11fcdd56a7c 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/scheduled-ecs-task.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/scheduled-ecs-task.ts @@ -103,6 +103,9 @@ export class ScheduledEc2Task extends ScheduledTaskBase { this.taskDefinition = props.scheduledEc2TaskDefinitionOptions.taskDefinition; } else if (props.scheduledEc2TaskImageOptions) { const taskImageOptions = props.scheduledEc2TaskImageOptions; + if (taskImageOptions.ephemeralStorageGiB) { + throw new Error('ephemeralStorageGiB is only supported for Fargate service.'); + } // Create a Task Definition for the container to start, also creates a log driver this.taskDefinition = new Ec2TaskDefinition(this, 'ScheduledTaskDef'); this.taskDefinition.addContainer('ScheduledContainer', { diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-load-balanced-fargate-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-load-balanced-fargate-service.ts index 236a763bcd3f8..31f8b247f4619 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-load-balanced-fargate-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-load-balanced-fargate-service.ts @@ -71,6 +71,7 @@ export class ApplicationLoadBalancedFargateService extends ApplicationLoadBalanc taskRole: taskImageOptions.taskRole, family: taskImageOptions.family, runtimePlatform: props.runtimePlatform, + ephemeralStorageGiB: taskImageOptions.ephemeralStorageGiB, }); // Create log driver if logging is enabled diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-multiple-target-groups-fargate-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-multiple-target-groups-fargate-service.ts index 69a5b65309a40..2465da555f486 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-multiple-target-groups-fargate-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-multiple-target-groups-fargate-service.ts @@ -69,6 +69,7 @@ export class ApplicationMultipleTargetGroupsFargateService extends ApplicationMu taskRole: taskImageOptions.taskRole, family: taskImageOptions.family, runtimePlatform: props.runtimePlatform, + ephemeralStorageGiB: taskImageOptions.ephemeralStorageGiB, }); const containerName = taskImageOptions.containerName ?? 'web'; 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 1ec8f38e16547..7c1befd88fc02 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 @@ -63,6 +63,7 @@ export class NetworkLoadBalancedFargateService extends NetworkLoadBalancedServic taskRole: taskImageOptions.taskRole, family: taskImageOptions.family, runtimePlatform: props.runtimePlatform, + ephemeralStorageGiB: taskImageOptions.ephemeralStorageGiB, }); // Create log driver if logging is enabled diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/network-multiple-target-groups-fargate-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/network-multiple-target-groups-fargate-service.ts index 2ee925d585b7c..6922e6bfec210 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/network-multiple-target-groups-fargate-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/network-multiple-target-groups-fargate-service.ts @@ -69,6 +69,7 @@ export class NetworkMultipleTargetGroupsFargateService extends NetworkMultipleTa taskRole: taskImageOptions.taskRole, family: taskImageOptions.family, runtimePlatform: props.runtimePlatform, + ephemeralStorageGiB: taskImageOptions.ephemeralStorageGiB, }); const containerName = taskImageOptions.containerName ?? 'web'; diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/queue-processing-fargate-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/queue-processing-fargate-service.ts index 8c48023c4bc1c..06840bc917a90 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/queue-processing-fargate-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/queue-processing-fargate-service.ts @@ -47,6 +47,15 @@ export interface QueueProcessingFargateServiceProps extends QueueProcessingServi * @default false */ readonly assignPublicIp?: boolean; + + /** + * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200 GiB. + * + * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. + * + * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. + */ + readonly ephemeralStorageGiB?: number; } /** @@ -74,6 +83,7 @@ export class QueueProcessingFargateService extends QueueProcessingServiceBase { cpu: props.cpu || 256, family: props.family, runtimePlatform: props.runtimePlatform, + ephemeralStorageGiB: props.ephemeralStorageGiB, }); const containerName = props.containerName ?? 'QueueProcessingContainer'; diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/scheduled-fargate-task.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/scheduled-fargate-task.ts index aaed749435f29..0a5c0263263fa 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/scheduled-fargate-task.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/scheduled-fargate-task.ts @@ -76,6 +76,7 @@ export class ScheduledFargateTask extends ScheduledTaskBase { this.taskDefinition = new FargateTaskDefinition(this, 'ScheduledTaskDef', { memoryLimitMiB: taskImageOptions.memoryLimitMiB || 512, cpu: taskImageOptions.cpu || 256, + ephemeralStorageGiB: taskImageOptions.ephemeralStorageGiB, }); this.taskDefinition.addContainer('ScheduledContainer', { image: taskImageOptions.image, diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/scheduled-ecs-task.test.ts b/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/scheduled-ecs-task.test.ts index 71f8b81f14d95..17f2560e0af5a 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/scheduled-ecs-task.test.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/scheduled-ecs-task.test.ts @@ -385,3 +385,23 @@ test('Scheduled Ec2 Task shows no warning when minute is * in cron', () => { // THEN Annotations.fromStack(stack).hasNoWarning('/Default', Match.anyValue()); }); + +test('Scheduled Ec2 Task throws an error if ephemeralStorageGiB is provided on task image options', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 1 }); + const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); + + // THEN + expect(() => { + new ScheduledEc2Task(stack, 'ScheduledEc2Task', { + cluster, + scheduledEc2TaskImageOptions: { + image: ecs.ContainerImage.fromRegistry('henk'), + memoryLimitMiB: 512, + ephemeralStorageGiB: 2, + }, + schedule: events.Schedule.cron({ minute: '*' }), + }); + }).toThrow('ephemeralStorageGiB is only supported for Fargate service.'); +}); diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/load-balanced-fargate-service.test.ts b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/load-balanced-fargate-service.test.ts index a11f62b59544c..7dc810179b530 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/load-balanced-fargate-service.test.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/load-balanced-fargate-service.test.ts @@ -22,6 +22,7 @@ test('setting loadBalancerType to Network creates an NLB Public', () => { cluster, taskImageOptions: { image: ecs.ContainerImage.fromRegistry('/aws/aws-example-app'), + ephemeralStorageGiB: 100, }, }); @@ -224,6 +225,7 @@ test('setting healthCheckGracePeriod works', () => { new ecsPatterns.ApplicationLoadBalancedFargateService(stack, 'Service', { taskImageOptions: { image: ecs.ContainerImage.fromRegistry('/aws/aws-example-app'), + ephemeralStorageGiB: 100, }, healthCheckGracePeriod: cdk.Duration.seconds(600), }); diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/queue-processing-fargate-service.test.ts b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/queue-processing-fargate-service.test.ts index 5cce579170906..6fbe3ba192f22 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/queue-processing-fargate-service.test.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/queue-processing-fargate-service.test.ts @@ -149,6 +149,7 @@ test('test fargate queue worker service construct - with optional props for queu maxReceiveCount: 42, retentionPeriod: cdk.Duration.days(7), visibilityTimeout: cdk.Duration.minutes(5), + ephemeralStorageGiB: 100, }); // THEN - QueueWorker is of FARGATE launch type, an SQS queue is created and all default properties are set. diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/scheduled-fargate-task.test.ts b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/scheduled-fargate-task.test.ts index e33116d945afb..71d2ea8cf7485 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/scheduled-fargate-task.test.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/scheduled-fargate-task.test.ts @@ -93,6 +93,7 @@ test('Can create a scheduled Fargate Task - with optional props', () => { memoryLimitMiB: 512, cpu: 2, environment: { TRIGGER: 'CloudWatch Events' }, + ephemeralStorageGiB: 100, }, desiredTaskCount: 2, schedule: events.Schedule.expression('rate(1 minute)'), From 51512f2e0bb2e74655de0ebcd0f25ab871d18b6e Mon Sep 17 00:00:00 2001 From: homakk Date: Wed, 12 Apr 2023 19:17:26 +0000 Subject: [PATCH 03/11] resolve third part licenses merge conflicts --- packages/@aws-cdk/cli-lib/THIRD_PARTY_LICENSES | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@aws-cdk/cli-lib/THIRD_PARTY_LICENSES b/packages/@aws-cdk/cli-lib/THIRD_PARTY_LICENSES index a716629dad040..5e46d018bc141 100644 --- a/packages/@aws-cdk/cli-lib/THIRD_PARTY_LICENSES +++ b/packages/@aws-cdk/cli-lib/THIRD_PARTY_LICENSES @@ -1,4 +1,4 @@ -The @aws-cdk/cli-lib-alpha package includes the following third-party software/licensing: +The @aws-cdk/cli-lib package includes the following third-party software/licensing: ** @jsii/check-node@1.78.1 - https://www.npmjs.com/package/@jsii/check-node/v/1.78.1 | Apache-2.0 jsii From 90c441d389fd0bd720b3ad9ecaec4cc0f97335c1 Mon Sep 17 00:00:00 2001 From: homakk Date: Wed, 12 Apr 2023 20:08:31 +0000 Subject: [PATCH 04/11] updated readme file --- packages/aws-cdk-lib/aws-ecs-patterns/README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/README.md b/packages/aws-cdk-lib/aws-ecs-patterns/README.md index 72097ce015f4c..d7e509a10bc27 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/README.md +++ b/packages/aws-cdk-lib/aws-ecs-patterns/README.md @@ -62,9 +62,9 @@ const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargat cluster, memoryLimitMiB: 1024, cpu: 512, - ephemeralStorageGiB: 100, taskImageOptions: { image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + ephemeralStorageGiB: 100, }, }); loadBalancedFargateService.targetGroup.configureHealthCheck({ @@ -150,9 +150,9 @@ const loadBalancedFargateService = new ecsPatterns.ApplicationMultipleTargetGrou cluster, memoryLimitMiB: 1024, cpu: 512, - ephemeralStorageGiB: 100, taskImageOptions: { image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + ephemeralStorageGiB: 100, }, targetGroups: [ { @@ -212,9 +212,9 @@ const loadBalancedFargateService = new ecsPatterns.NetworkLoadBalancedFargateSer cluster, memoryLimitMiB: 1024, cpu: 512, - ephemeralStorageGiB: 100, taskImageOptions: { image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + ephemeralStorageGiB: 100, }, }); ``` @@ -323,6 +323,7 @@ const loadBalancedFargateService = new ecsPatterns.NetworkMultipleTargetGroupsFa ephemeralStorageGiB: 100, taskImageOptions: { image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + ephemeralStorageGiB: 100, }, loadBalancers: [ { From 0aa42c64f082e849f438c05c7b211cbd7facff7e Mon Sep 17 00:00:00 2001 From: homakk Date: Thu, 13 Apr 2023 19:35:32 +0000 Subject: [PATCH 05/11] updated changes for validation error message --- .../lib/ecs/application-load-balanced-ecs-service.ts | 2 +- .../lib/ecs/application-multiple-target-groups-ecs-service.ts | 2 +- .../lib/ecs/network-load-balanced-ecs-service.ts | 2 +- .../lib/ecs/network-multiple-target-groups-ecs-service.ts | 2 +- .../aws-cdk-lib/aws-ecs-patterns/lib/ecs/scheduled-ecs-task.ts | 2 +- .../aws-ecs-patterns/test/ec2/scheduled-ecs-task.test.ts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-load-balanced-ecs-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-load-balanced-ecs-service.ts index d1781f7db5eea..42bd8ee04daa0 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-load-balanced-ecs-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-load-balanced-ecs-service.ts @@ -109,7 +109,7 @@ export class ApplicationLoadBalancedEc2Service extends ApplicationLoadBalancedSe } else if (props.taskImageOptions) { const taskImageOptions = props.taskImageOptions; if (taskImageOptions.ephemeralStorageGiB) { - throw new Error('ephemeralStorageGiB is only supported for Fargate service.'); + throw new Error('ephemeralStorageGiB is only supported for Fargate services.'); } this.taskDefinition = new Ec2TaskDefinition(this, 'TaskDef', { executionRole: taskImageOptions.executionRole, diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-multiple-target-groups-ecs-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-multiple-target-groups-ecs-service.ts index 69cb085b6d67f..5064257262039 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-multiple-target-groups-ecs-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-multiple-target-groups-ecs-service.ts @@ -109,7 +109,7 @@ export class ApplicationMultipleTargetGroupsEc2Service extends ApplicationMultip } else if (props.taskImageOptions) { const taskImageOptions = props.taskImageOptions; if (taskImageOptions.ephemeralStorageGiB) { - throw new Error('ephemeralStorageGiB is only supported for Fargate service.'); + throw new Error('ephemeralStorageGiB is only supported for Fargate services.'); } this.taskDefinition = new Ec2TaskDefinition(this, 'TaskDef', { executionRole: taskImageOptions.executionRole, 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 d7f3b69fc0673..cf330386b47dd 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 @@ -107,7 +107,7 @@ export class NetworkLoadBalancedEc2Service extends NetworkLoadBalancedServiceBas } else if (props.taskImageOptions) { const taskImageOptions = props.taskImageOptions; if (taskImageOptions.ephemeralStorageGiB) { - throw new Error('ephemeralStorageGiB is only supported for Fargate service.'); + throw new Error('ephemeralStorageGiB is only supported for Fargate services.'); } this.taskDefinition = new Ec2TaskDefinition(this, 'TaskDef', { executionRole: taskImageOptions.executionRole, diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/network-multiple-target-groups-ecs-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/network-multiple-target-groups-ecs-service.ts index fee2561bebe01..f43147e8c6727 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/network-multiple-target-groups-ecs-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/network-multiple-target-groups-ecs-service.ts @@ -108,7 +108,7 @@ export class NetworkMultipleTargetGroupsEc2Service extends NetworkMultipleTarget } else if (props.taskImageOptions) { const taskImageOptions = props.taskImageOptions; if (taskImageOptions.ephemeralStorageGiB) { - throw new Error('ephemeralStorageGiB is only supported for Fargate service.'); + throw new Error('ephemeralStorageGiB is only supported for Fargate services.'); } this.taskDefinition = new Ec2TaskDefinition(this, 'TaskDef', { executionRole: taskImageOptions.executionRole, diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/scheduled-ecs-task.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/scheduled-ecs-task.ts index af11fcdd56a7c..3ce7539dffeb5 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/scheduled-ecs-task.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/scheduled-ecs-task.ts @@ -104,7 +104,7 @@ export class ScheduledEc2Task extends ScheduledTaskBase { } else if (props.scheduledEc2TaskImageOptions) { const taskImageOptions = props.scheduledEc2TaskImageOptions; if (taskImageOptions.ephemeralStorageGiB) { - throw new Error('ephemeralStorageGiB is only supported for Fargate service.'); + throw new Error('ephemeralStorageGiB is only supported for Fargate services.'); } // Create a Task Definition for the container to start, also creates a log driver this.taskDefinition = new Ec2TaskDefinition(this, 'ScheduledTaskDef'); diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/scheduled-ecs-task.test.ts b/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/scheduled-ecs-task.test.ts index 17f2560e0af5a..533845837f9e6 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/scheduled-ecs-task.test.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/scheduled-ecs-task.test.ts @@ -403,5 +403,5 @@ test('Scheduled Ec2 Task throws an error if ephemeralStorageGiB is provided on t }, schedule: events.Schedule.cron({ minute: '*' }), }); - }).toThrow('ephemeralStorageGiB is only supported for Fargate service.'); + }).toThrow('ephemeralStorageGiB is only supported for Fargate services.'); }); From 05f3920f6401d32684b90d3c30b5f694656298b4 Mon Sep 17 00:00:00 2001 From: homakk Date: Thu, 13 Apr 2023 20:27:25 +0000 Subject: [PATCH 06/11] small change in the discription --- .../lib/base/application-load-balanced-service-base.ts | 2 +- .../lib/base/application-multiple-target-groups-service-base.ts | 2 +- .../lib/base/network-load-balanced-service-base.ts | 2 +- .../lib/base/network-multiple-target-groups-service-base.ts | 2 +- .../aws-ecs-patterns/lib/base/scheduled-task-base.ts | 2 +- .../lib/fargate/queue-processing-fargate-service.ts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts index f8226f60ed59d..d47ad6a3bd1aa 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts @@ -393,7 +393,7 @@ export interface ApplicationLoadBalancedTaskImageOptions { readonly command?: string[]; /** - * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200 GiB. + * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. * * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. * diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts index 60d617279f496..8ec11ef88716f 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts @@ -207,7 +207,7 @@ export interface ApplicationLoadBalancedTaskImageProps { readonly dockerLabels?: { [key: string]: string }; /** - * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200 GiB. + * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. * * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. * 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 c135a1c9392fb..8f292f7fabc33 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 @@ -287,7 +287,7 @@ export interface NetworkLoadBalancedTaskImageOptions { readonly dockerLabels?: { [key: string]: string }; /** - * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200 GiB. + * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. * * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. * diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts index 21f21e57d42b1..76eb5862e5b4b 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts @@ -197,7 +197,7 @@ export interface NetworkLoadBalancedTaskImageProps { */ readonly dockerLabels?: { [key: string]: string }; /** - * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200 GiB. + * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. * * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. * diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/scheduled-task-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/scheduled-task-base.ts index a795c8ecbb380..be59f83ec76c5 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/scheduled-task-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/scheduled-task-base.ts @@ -112,7 +112,7 @@ export interface ScheduledTaskImageProps { readonly logDriver?: LogDriver; /** - * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200 GiB. + * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is200 GiB. * * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. * diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/queue-processing-fargate-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/queue-processing-fargate-service.ts index 06840bc917a90..6201d18110ff9 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/queue-processing-fargate-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/queue-processing-fargate-service.ts @@ -49,7 +49,7 @@ export interface QueueProcessingFargateServiceProps extends QueueProcessingServi readonly assignPublicIp?: boolean; /** - * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200 GiB. + * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. * * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. * From 600d3a31dbbf78608c8225c3cd8c3956fd39f177 Mon Sep 17 00:00:00 2001 From: homakk Date: Thu, 13 Apr 2023 20:39:10 +0000 Subject: [PATCH 07/11] updated changes --- .../aws-ecs-patterns/lib/base/scheduled-task-base.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/scheduled-task-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/scheduled-task-base.ts index be59f83ec76c5..242465091848e 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/scheduled-task-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/scheduled-task-base.ts @@ -112,7 +112,7 @@ export interface ScheduledTaskImageProps { readonly logDriver?: LogDriver; /** - * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is200 GiB. + * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. * * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. * From f4e2c6e194415d61eb27a92cf3759d1d78d4e1de Mon Sep 17 00:00:00 2001 From: homakk Date: Fri, 14 Apr 2023 18:20:44 +0000 Subject: [PATCH 08/11] added testcases for ALB, AppliMutipleTargetGroup,NetworkMultipleTargetgroup of ec2service --- .../aws-ecs-patterns/test/ec2/l3s-v2.test.ts | 51 +++++++++++++++++++ .../aws-ecs-patterns/test/ec2/l3s.test.ts | 26 ++++++++++ 2 files changed, 77 insertions(+) diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/l3s-v2.test.ts b/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/l3s-v2.test.ts index a6ae25547b32f..46ea696ce2aab 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/l3s-v2.test.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/l3s-v2.test.ts @@ -85,6 +85,32 @@ describe('When Application Load Balancer', () => { }); }); + test('throws an error if ephemeralStorageGiB is provided on task image options', () => { + // GIVEN + const stack = new Stack(); + const vpc = new Vpc(stack, 'VPC'); + const cluster = new Cluster(stack, 'Cluster', { vpc }); + cluster.addAsgCapacityProvider(new AsgCapacityProvider(stack, 'DefaultAutoScalingGroupProvider', { + autoScalingGroup: new AutoScalingGroup(stack, 'DefaultAutoScalingGroup', { + vpc, + instanceType: new ec2.InstanceType('t2.micro'), + machineImage: MachineImage.latestAmazonLinux(), + }), + })); + + // THEN + expect(() => + new ApplicationMultipleTargetGroupsEc2Service(stack, 'Service', { + cluster, + memoryLimitMiB: 1024, + taskImageOptions: { + image: ContainerImage.fromRegistry('test'), + ephemeralStorageGiB: 2, + }, + }), + ).toThrow(/ephemeralStorageGiB is only supported for Fargate services./); + }); + test('test ECS ALB construct with all settings', () => { // GIVEN const stack = new Stack(); @@ -965,6 +991,31 @@ describe('When Network Load Balancer', () => { }); }); + test('throws an error if ephemeralStorageGiB is provided on task image options', () => { + // GIVEN + const stack = new Stack(); + const vpc = new Vpc(stack, 'VPC'); + const cluster = new Cluster(stack, 'Cluster', { vpc }); + cluster.addAsgCapacityProvider(new AsgCapacityProvider(stack, 'DefaultAutoScalingGroupProvider', { + autoScalingGroup: new AutoScalingGroup(stack, 'DefaultAutoScalingGroup', { + vpc, + instanceType: new ec2.InstanceType('t2.micro'), + machineImage: MachineImage.latestAmazonLinux(), + }), + })); + + // THEN + expect(() => + new NetworkMultipleTargetGroupsEc2Service(stack, 'Service', { + cluster, + memoryLimitMiB: 1024, + taskImageOptions: { + image: ContainerImage.fromRegistry('test'), + ephemeralStorageGiB: 2, + }, + }), + ).toThrow(/ephemeralStorageGiB is only supported for Fargate services./); + }); test('Assert EnableExecuteCommand is missing if not set', () => { // GIVEN diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/l3s.test.ts b/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/l3s.test.ts index 799ba8a210449..35e5c506acca7 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/l3s.test.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/l3s.test.ts @@ -1278,6 +1278,32 @@ test('test Fargate application loadbalanced construct with taskDefinition provid }); }); +test('ALB - throws an error if ephemeralStorageGiB is provided on task image options', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const cluster = new ecs.Cluster(stack, 'Cluster', { vpc }); + cluster.addAsgCapacityProvider(new AsgCapacityProvider(stack, 'DefaultAutoScalingGroupProvider', { + autoScalingGroup: new AutoScalingGroup(stack, 'DefaultAutoScalingGroup', { + vpc, + instanceType: new ec2.InstanceType('t2.micro'), + machineImage: MachineImage.latestAmazonLinux(), + }), + })); + + // THEN + expect(() => + new ecsPatterns.ApplicationLoadBalancedEc2Service(stack, 'Service', { + cluster, + memoryLimitMiB: 1024, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry('test'), + ephemeralStorageGiB: 2, + }, + }), + ).toThrow(/ephemeralStorageGiB is only supported for Fargate services./); +}); + test('ALB - throws if desiredTaskCount is 0', () => { // GIVEN const stack = new cdk.Stack(); From e42c1028ce2cb4b89c81ba411724b48c816d9f3d Mon Sep 17 00:00:00 2001 From: homakk Date: Thu, 20 Apr 2023 17:23:45 +0000 Subject: [PATCH 09/11] updated changes removed validation in ecs patterns and added interface into fargate patterns --- .../aws-cdk-lib/aws-ecs-patterns/README.md | 7 ++- .../application-load-balanced-service-base.ts | 9 ---- ...ion-multiple-target-groups-service-base.ts | 9 ---- .../network-load-balanced-service-base.ts | 9 ---- ...ork-multiple-target-groups-service-base.ts | 8 --- .../lib/base/scheduled-task-base.ts | 9 ---- .../application-load-balanced-ecs-service.ts | 3 -- ...tion-multiple-target-groups-ecs-service.ts | 3 -- .../ecs/network-load-balanced-ecs-service.ts | 3 -- ...work-multiple-target-groups-ecs-service.ts | 3 -- .../lib/ecs/scheduled-ecs-task.ts | 3 -- ...plication-load-balanced-fargate-service.ts | 11 +++- ...-multiple-target-groups-fargate-service.ts | 11 +++- .../network-load-balanced-fargate-service.ts | 10 +++- ...-multiple-target-groups-fargate-service.ts | 11 +++- .../lib/fargate/scheduled-fargate-task.ts | 9 ++++ .../aws-ecs-patterns/test/ec2/l3s-v2.test.ts | 52 ------------------- .../aws-ecs-patterns/test/ec2/l3s.test.ts | 26 ---------- .../test/ec2/scheduled-ecs-task.test.ts | 20 ------- .../load-balanced-fargate-service.test.ts | 4 +- .../fargate/scheduled-fargate-task.test.ts | 1 + 21 files changed, 54 insertions(+), 167 deletions(-) diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/README.md b/packages/aws-cdk-lib/aws-ecs-patterns/README.md index d7e509a10bc27..72097ce015f4c 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/README.md +++ b/packages/aws-cdk-lib/aws-ecs-patterns/README.md @@ -62,9 +62,9 @@ const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargat cluster, memoryLimitMiB: 1024, cpu: 512, + ephemeralStorageGiB: 100, taskImageOptions: { image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - ephemeralStorageGiB: 100, }, }); loadBalancedFargateService.targetGroup.configureHealthCheck({ @@ -150,9 +150,9 @@ const loadBalancedFargateService = new ecsPatterns.ApplicationMultipleTargetGrou cluster, memoryLimitMiB: 1024, cpu: 512, + ephemeralStorageGiB: 100, taskImageOptions: { image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - ephemeralStorageGiB: 100, }, targetGroups: [ { @@ -212,9 +212,9 @@ const loadBalancedFargateService = new ecsPatterns.NetworkLoadBalancedFargateSer cluster, memoryLimitMiB: 1024, cpu: 512, + ephemeralStorageGiB: 100, taskImageOptions: { image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - ephemeralStorageGiB: 100, }, }); ``` @@ -323,7 +323,6 @@ const loadBalancedFargateService = new ecsPatterns.NetworkMultipleTargetGroupsFa ephemeralStorageGiB: 100, taskImageOptions: { image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - ephemeralStorageGiB: 100, }, loadBalancers: [ { diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts index d47ad6a3bd1aa..514639acd71ee 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts @@ -391,15 +391,6 @@ export interface ApplicationLoadBalancedTaskImageOptions { * @default none */ readonly command?: string[]; - - /** - * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. - * - * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. - * - * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. - */ - readonly ephemeralStorageGiB?: number; } /** diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts index 8ec11ef88716f..4e11fad6db585 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts @@ -205,15 +205,6 @@ export interface ApplicationLoadBalancedTaskImageProps { * @default - No labels. */ readonly dockerLabels?: { [key: string]: string }; - - /** - * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. - * - * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. - * - * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. - */ - readonly ephemeralStorageGiB?: number; } /** 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 8f292f7fabc33..61911ae406578 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 @@ -285,15 +285,6 @@ export interface NetworkLoadBalancedTaskImageOptions { * @default - No labels. */ readonly dockerLabels?: { [key: string]: string }; - - /** - * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. - * - * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. - * - * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. - */ - readonly ephemeralStorageGiB?: number; } /** diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts index 76eb5862e5b4b..33427c75c3758 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts @@ -196,14 +196,6 @@ export interface NetworkLoadBalancedTaskImageProps { * @default - No labels. */ readonly dockerLabels?: { [key: string]: string }; - /** - * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. - * - * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. - * - * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. - */ - readonly ephemeralStorageGiB?: number; } /** diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/scheduled-task-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/scheduled-task-base.ts index 242465091848e..9190bb3ed2fb3 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/scheduled-task-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/scheduled-task-base.ts @@ -110,15 +110,6 @@ export interface ScheduledTaskImageProps { * @default - AwsLogDriver if enableLogging is true */ readonly logDriver?: LogDriver; - - /** - * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. - * - * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. - * - * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. - */ - readonly ephemeralStorageGiB?: number; } /** diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-load-balanced-ecs-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-load-balanced-ecs-service.ts index 42bd8ee04daa0..df3dc32bac74e 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-load-balanced-ecs-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-load-balanced-ecs-service.ts @@ -108,9 +108,6 @@ export class ApplicationLoadBalancedEc2Service extends ApplicationLoadBalancedSe this.taskDefinition = props.taskDefinition; } else if (props.taskImageOptions) { const taskImageOptions = props.taskImageOptions; - if (taskImageOptions.ephemeralStorageGiB) { - throw new Error('ephemeralStorageGiB is only supported for Fargate services.'); - } this.taskDefinition = new Ec2TaskDefinition(this, 'TaskDef', { executionRole: taskImageOptions.executionRole, taskRole: taskImageOptions.taskRole, diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-multiple-target-groups-ecs-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-multiple-target-groups-ecs-service.ts index 5064257262039..c69386bd2e719 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-multiple-target-groups-ecs-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-multiple-target-groups-ecs-service.ts @@ -108,9 +108,6 @@ export class ApplicationMultipleTargetGroupsEc2Service extends ApplicationMultip this.taskDefinition = props.taskDefinition; } else if (props.taskImageOptions) { const taskImageOptions = props.taskImageOptions; - if (taskImageOptions.ephemeralStorageGiB) { - throw new Error('ephemeralStorageGiB is only supported for Fargate services.'); - } this.taskDefinition = new Ec2TaskDefinition(this, 'TaskDef', { executionRole: taskImageOptions.executionRole, taskRole: taskImageOptions.taskRole, 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 cf330386b47dd..e525ee02cf65e 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 @@ -106,9 +106,6 @@ export class NetworkLoadBalancedEc2Service extends NetworkLoadBalancedServiceBas this.taskDefinition = props.taskDefinition; } else if (props.taskImageOptions) { const taskImageOptions = props.taskImageOptions; - if (taskImageOptions.ephemeralStorageGiB) { - throw new Error('ephemeralStorageGiB is only supported for Fargate services.'); - } this.taskDefinition = new Ec2TaskDefinition(this, 'TaskDef', { executionRole: taskImageOptions.executionRole, taskRole: taskImageOptions.taskRole, diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/network-multiple-target-groups-ecs-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/network-multiple-target-groups-ecs-service.ts index f43147e8c6727..fa176f8930962 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/network-multiple-target-groups-ecs-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/network-multiple-target-groups-ecs-service.ts @@ -107,9 +107,6 @@ export class NetworkMultipleTargetGroupsEc2Service extends NetworkMultipleTarget this.taskDefinition = props.taskDefinition; } else if (props.taskImageOptions) { const taskImageOptions = props.taskImageOptions; - if (taskImageOptions.ephemeralStorageGiB) { - throw new Error('ephemeralStorageGiB is only supported for Fargate services.'); - } this.taskDefinition = new Ec2TaskDefinition(this, 'TaskDef', { executionRole: taskImageOptions.executionRole, taskRole: taskImageOptions.taskRole, diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/scheduled-ecs-task.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/scheduled-ecs-task.ts index 3ce7539dffeb5..1bc0ffe350239 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/scheduled-ecs-task.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/scheduled-ecs-task.ts @@ -103,9 +103,6 @@ export class ScheduledEc2Task extends ScheduledTaskBase { this.taskDefinition = props.scheduledEc2TaskDefinitionOptions.taskDefinition; } else if (props.scheduledEc2TaskImageOptions) { const taskImageOptions = props.scheduledEc2TaskImageOptions; - if (taskImageOptions.ephemeralStorageGiB) { - throw new Error('ephemeralStorageGiB is only supported for Fargate services.'); - } // Create a Task Definition for the container to start, also creates a log driver this.taskDefinition = new Ec2TaskDefinition(this, 'ScheduledTaskDef'); this.taskDefinition.addContainer('ScheduledContainer', { diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-load-balanced-fargate-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-load-balanced-fargate-service.ts index 31f8b247f4619..78e2cb9b37143 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-load-balanced-fargate-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-load-balanced-fargate-service.ts @@ -29,6 +29,15 @@ export interface ApplicationLoadBalancedFargateServiceProps extends ApplicationL * @default - A new security group is created. */ readonly securityGroups?: ISecurityGroup[]; + + /** + * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. + * + * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. + * + * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. + */ + readonly ephemeralStorageGiB?: number; } /** @@ -71,7 +80,7 @@ export class ApplicationLoadBalancedFargateService extends ApplicationLoadBalanc taskRole: taskImageOptions.taskRole, family: taskImageOptions.family, runtimePlatform: props.runtimePlatform, - ephemeralStorageGiB: taskImageOptions.ephemeralStorageGiB, + ephemeralStorageGiB: props.ephemeralStorageGiB, }); // Create log driver if logging is enabled diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-multiple-target-groups-fargate-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-multiple-target-groups-fargate-service.ts index 2465da555f486..7a2caf6c7470c 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-multiple-target-groups-fargate-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-multiple-target-groups-fargate-service.ts @@ -20,6 +20,15 @@ export interface ApplicationMultipleTargetGroupsFargateServiceProps extends Appl * @default false */ readonly assignPublicIp?: boolean; + + /** + * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. + * + * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. + * + * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. + */ + readonly ephemeralStorageGiB?: number; } /** @@ -69,7 +78,7 @@ export class ApplicationMultipleTargetGroupsFargateService extends ApplicationMu taskRole: taskImageOptions.taskRole, family: taskImageOptions.family, runtimePlatform: props.runtimePlatform, - ephemeralStorageGiB: taskImageOptions.ephemeralStorageGiB, + ephemeralStorageGiB: props.ephemeralStorageGiB, }); const containerName = taskImageOptions.containerName ?? 'web'; 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 7c1befd88fc02..af08709166caa 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 @@ -25,6 +25,14 @@ export interface NetworkLoadBalancedFargateServiceProps extends NetworkLoadBalan */ readonly taskSubnets?: SubnetSelection; + /** + * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. + * + * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. + * + * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. + */ + readonly ephemeralStorageGiB?: number; } /** @@ -63,7 +71,7 @@ export class NetworkLoadBalancedFargateService extends NetworkLoadBalancedServic taskRole: taskImageOptions.taskRole, family: taskImageOptions.family, runtimePlatform: props.runtimePlatform, - ephemeralStorageGiB: taskImageOptions.ephemeralStorageGiB, + ephemeralStorageGiB: props.ephemeralStorageGiB, }); // Create log driver if logging is enabled diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/network-multiple-target-groups-fargate-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/network-multiple-target-groups-fargate-service.ts index 6922e6bfec210..d26c81ef57edb 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/network-multiple-target-groups-fargate-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/network-multiple-target-groups-fargate-service.ts @@ -20,6 +20,15 @@ export interface NetworkMultipleTargetGroupsFargateServiceProps extends NetworkM * @default false */ readonly assignPublicIp?: boolean; + + /** + * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. + * + * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. + * + * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. + */ + readonly ephemeralStorageGiB?: number; } /** @@ -69,7 +78,7 @@ export class NetworkMultipleTargetGroupsFargateService extends NetworkMultipleTa taskRole: taskImageOptions.taskRole, family: taskImageOptions.family, runtimePlatform: props.runtimePlatform, - ephemeralStorageGiB: taskImageOptions.ephemeralStorageGiB, + ephemeralStorageGiB: props.ephemeralStorageGiB, }); const containerName = taskImageOptions.containerName ?? 'web'; diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/scheduled-fargate-task.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/scheduled-fargate-task.ts index 0a5c0263263fa..29844f7107b94 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/scheduled-fargate-task.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/scheduled-fargate-task.ts @@ -31,6 +31,15 @@ export interface ScheduledFargateTaskProps extends ScheduledTaskBaseProps, Farga */ export interface ScheduledFargateTaskImageOptions extends ScheduledTaskImageProps, FargateServiceBaseProps { + /** + * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. + * + * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. + * + * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. + */ + readonly ephemeralStorageGiB?: number; + } /** diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/l3s-v2.test.ts b/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/l3s-v2.test.ts index 46ea696ce2aab..25afeb033eebf 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/l3s-v2.test.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/l3s-v2.test.ts @@ -85,32 +85,6 @@ describe('When Application Load Balancer', () => { }); }); - test('throws an error if ephemeralStorageGiB is provided on task image options', () => { - // GIVEN - const stack = new Stack(); - const vpc = new Vpc(stack, 'VPC'); - const cluster = new Cluster(stack, 'Cluster', { vpc }); - cluster.addAsgCapacityProvider(new AsgCapacityProvider(stack, 'DefaultAutoScalingGroupProvider', { - autoScalingGroup: new AutoScalingGroup(stack, 'DefaultAutoScalingGroup', { - vpc, - instanceType: new ec2.InstanceType('t2.micro'), - machineImage: MachineImage.latestAmazonLinux(), - }), - })); - - // THEN - expect(() => - new ApplicationMultipleTargetGroupsEc2Service(stack, 'Service', { - cluster, - memoryLimitMiB: 1024, - taskImageOptions: { - image: ContainerImage.fromRegistry('test'), - ephemeralStorageGiB: 2, - }, - }), - ).toThrow(/ephemeralStorageGiB is only supported for Fargate services./); - }); - test('test ECS ALB construct with all settings', () => { // GIVEN const stack = new Stack(); @@ -991,32 +965,6 @@ describe('When Network Load Balancer', () => { }); }); - test('throws an error if ephemeralStorageGiB is provided on task image options', () => { - // GIVEN - const stack = new Stack(); - const vpc = new Vpc(stack, 'VPC'); - const cluster = new Cluster(stack, 'Cluster', { vpc }); - cluster.addAsgCapacityProvider(new AsgCapacityProvider(stack, 'DefaultAutoScalingGroupProvider', { - autoScalingGroup: new AutoScalingGroup(stack, 'DefaultAutoScalingGroup', { - vpc, - instanceType: new ec2.InstanceType('t2.micro'), - machineImage: MachineImage.latestAmazonLinux(), - }), - })); - - // THEN - expect(() => - new NetworkMultipleTargetGroupsEc2Service(stack, 'Service', { - cluster, - memoryLimitMiB: 1024, - taskImageOptions: { - image: ContainerImage.fromRegistry('test'), - ephemeralStorageGiB: 2, - }, - }), - ).toThrow(/ephemeralStorageGiB is only supported for Fargate services./); - }); - test('Assert EnableExecuteCommand is missing if not set', () => { // GIVEN const stack = new Stack(); diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/l3s.test.ts b/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/l3s.test.ts index 35e5c506acca7..799ba8a210449 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/l3s.test.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/l3s.test.ts @@ -1278,32 +1278,6 @@ test('test Fargate application loadbalanced construct with taskDefinition provid }); }); -test('ALB - throws an error if ephemeralStorageGiB is provided on task image options', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const cluster = new ecs.Cluster(stack, 'Cluster', { vpc }); - cluster.addAsgCapacityProvider(new AsgCapacityProvider(stack, 'DefaultAutoScalingGroupProvider', { - autoScalingGroup: new AutoScalingGroup(stack, 'DefaultAutoScalingGroup', { - vpc, - instanceType: new ec2.InstanceType('t2.micro'), - machineImage: MachineImage.latestAmazonLinux(), - }), - })); - - // THEN - expect(() => - new ecsPatterns.ApplicationLoadBalancedEc2Service(stack, 'Service', { - cluster, - memoryLimitMiB: 1024, - taskImageOptions: { - image: ecs.ContainerImage.fromRegistry('test'), - ephemeralStorageGiB: 2, - }, - }), - ).toThrow(/ephemeralStorageGiB is only supported for Fargate services./); -}); - test('ALB - throws if desiredTaskCount is 0', () => { // GIVEN const stack = new cdk.Stack(); diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/scheduled-ecs-task.test.ts b/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/scheduled-ecs-task.test.ts index 533845837f9e6..71f8b81f14d95 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/scheduled-ecs-task.test.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/scheduled-ecs-task.test.ts @@ -385,23 +385,3 @@ test('Scheduled Ec2 Task shows no warning when minute is * in cron', () => { // THEN Annotations.fromStack(stack).hasNoWarning('/Default', Match.anyValue()); }); - -test('Scheduled Ec2 Task throws an error if ephemeralStorageGiB is provided on task image options', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 1 }); - const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); - - // THEN - expect(() => { - new ScheduledEc2Task(stack, 'ScheduledEc2Task', { - cluster, - scheduledEc2TaskImageOptions: { - image: ecs.ContainerImage.fromRegistry('henk'), - memoryLimitMiB: 512, - ephemeralStorageGiB: 2, - }, - schedule: events.Schedule.cron({ minute: '*' }), - }); - }).toThrow('ephemeralStorageGiB is only supported for Fargate services.'); -}); diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/load-balanced-fargate-service.test.ts b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/load-balanced-fargate-service.test.ts index 7dc810179b530..e295e5ed809e6 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/load-balanced-fargate-service.test.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/load-balanced-fargate-service.test.ts @@ -22,8 +22,8 @@ test('setting loadBalancerType to Network creates an NLB Public', () => { cluster, taskImageOptions: { image: ecs.ContainerImage.fromRegistry('/aws/aws-example-app'), - ephemeralStorageGiB: 100, }, + ephemeralStorageGiB: 100, }); // THEN @@ -225,8 +225,8 @@ test('setting healthCheckGracePeriod works', () => { new ecsPatterns.ApplicationLoadBalancedFargateService(stack, 'Service', { taskImageOptions: { image: ecs.ContainerImage.fromRegistry('/aws/aws-example-app'), - ephemeralStorageGiB: 100, }, + ephemeralStorageGiB: 100, healthCheckGracePeriod: cdk.Duration.seconds(600), }); // THEN diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/scheduled-fargate-task.test.ts b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/scheduled-fargate-task.test.ts index 71d2ea8cf7485..086b223480295 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/scheduled-fargate-task.test.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/scheduled-fargate-task.test.ts @@ -95,6 +95,7 @@ test('Can create a scheduled Fargate Task - with optional props', () => { environment: { TRIGGER: 'CloudWatch Events' }, ephemeralStorageGiB: 100, }, + desiredTaskCount: 2, schedule: events.Schedule.expression('rate(1 minute)'), ruleName: 'sample-scheduled-task-rule', From ee59ea9822f34bcfec402605e1df610258f3ef16 Mon Sep 17 00:00:00 2001 From: homakk Date: Fri, 21 Apr 2023 19:22:43 +0000 Subject: [PATCH 10/11] updated changes --- packages/aws-cdk-lib/aws-ecs-patterns/README.md | 8 ++++---- .../base/application-load-balanced-service-base.ts | 13 ++++++++++++- ...plication-multiple-target-groups-service-base.ts | 13 ++++++++++++- .../lib/base/network-load-balanced-service-base.ts | 13 ++++++++++++- .../network-multiple-target-groups-service-base.ts | 13 ++++++++++++- .../application-load-balanced-fargate-service.ts | 11 +---------- ...cation-multiple-target-groups-fargate-service.ts | 11 +---------- .../network-load-balanced-fargate-service.ts | 11 +---------- ...etwork-multiple-target-groups-fargate-service.ts | 11 +---------- .../lib/fargate/scheduled-fargate-task.ts | 2 -- .../fargate/load-balanced-fargate-service.test.ts | 4 ++-- 11 files changed, 58 insertions(+), 52 deletions(-) diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/README.md b/packages/aws-cdk-lib/aws-ecs-patterns/README.md index 72097ce015f4c..070d4c1d6ede0 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/README.md +++ b/packages/aws-cdk-lib/aws-ecs-patterns/README.md @@ -62,9 +62,9 @@ const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargat cluster, memoryLimitMiB: 1024, cpu: 512, - ephemeralStorageGiB: 100, taskImageOptions: { image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + ephemeralStorageGiB: 100, }, }); loadBalancedFargateService.targetGroup.configureHealthCheck({ @@ -150,9 +150,9 @@ const loadBalancedFargateService = new ecsPatterns.ApplicationMultipleTargetGrou cluster, memoryLimitMiB: 1024, cpu: 512, - ephemeralStorageGiB: 100, taskImageOptions: { image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + ephemeralStorageGiB: 100, }, targetGroups: [ { @@ -212,9 +212,9 @@ const loadBalancedFargateService = new ecsPatterns.NetworkLoadBalancedFargateSer cluster, memoryLimitMiB: 1024, cpu: 512, - ephemeralStorageGiB: 100, taskImageOptions: { image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + ephemeralStorageGiB: 100, }, }); ``` @@ -320,9 +320,9 @@ declare const cluster: ecs.Cluster; const loadBalancedFargateService = new ecsPatterns.NetworkMultipleTargetGroupsFargateService(this, 'Service', { cluster, memoryLimitMiB: 512, - ephemeralStorageGiB: 100, taskImageOptions: { image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + ephemeralStorageGiB: 100, }, loadBalancers: [ { diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts index 514639acd71ee..38c09bb6d5a95 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts @@ -58,7 +58,7 @@ export interface ApplicationLoadBalancedServiceBaseProps { * * @default none */ - readonly taskImageOptions?: ApplicationLoadBalancedTaskImageOptions; + readonly taskImageOptions?: ApplicationLoadBalancedFargateTaskImageOptions; /** * Determines whether the Load Balancer will be internet-facing. @@ -279,6 +279,17 @@ export interface ApplicationLoadBalancedServiceBaseProps { readonly idleTimeout?: Duration; } +export interface ApplicationLoadBalancedFargateTaskImageOptions extends ApplicationLoadBalancedTaskImageOptions { + /** + * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. + * + * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. + * + * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. + */ + readonly ephemeralStorageGiB?: number; +} + export interface ApplicationLoadBalancedTaskImageOptions { /** * The image used to start a container. Image or taskDefinition must be specified, not both. diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts index 4e11fad6db585..7e35c1e29eefc 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts @@ -45,7 +45,7 @@ export interface ApplicationMultipleTargetGroupsServiceBaseProps { * * @default none */ - readonly taskImageOptions?: ApplicationLoadBalancedTaskImageProps; + readonly taskImageOptions?: ApplicationLoadBalancedFargateTaskImageProps; /** * The desired number of instantiations of the task definition to keep running on the service. @@ -116,6 +116,17 @@ export interface ApplicationMultipleTargetGroupsServiceBaseProps { readonly enableExecuteCommand?: boolean; } +export interface ApplicationLoadBalancedFargateTaskImageProps extends ApplicationLoadBalancedTaskImageProps { + /** + * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. + * + * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. + * + * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. + */ + readonly ephemeralStorageGiB?: number; +} + /** * Options for configuring a new container. */ 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 61911ae406578..721d5e72f3e95 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 @@ -53,7 +53,7 @@ export interface NetworkLoadBalancedServiceBaseProps { * * @default - none */ - readonly taskImageOptions?: NetworkLoadBalancedTaskImageOptions; + readonly taskImageOptions?: NetworkLoadBalancedFargateTaskImageOptions; /** * Determines whether the Load Balancer will be internet-facing. @@ -287,6 +287,17 @@ export interface NetworkLoadBalancedTaskImageOptions { readonly dockerLabels?: { [key: string]: string }; } +export interface NetworkLoadBalancedFargateTaskImageOptions extends NetworkLoadBalancedTaskImageOptions { + /** + * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. + * + * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. + * + * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. + */ + readonly ephemeralStorageGiB?: number; +} + /** * The base class for NetworkLoadBalancedEc2Service and NetworkLoadBalancedFargateService services. */ diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts index 33427c75c3758..8baee973fbede 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts @@ -35,7 +35,7 @@ export interface NetworkMultipleTargetGroupsServiceBaseProps { * * @default - none */ - readonly taskImageOptions?: NetworkLoadBalancedTaskImageProps; + readonly taskImageOptions?: NetworkLoadBalancedFargateTaskImageProps; /** * The desired number of instantiations of the task definition to keep running on the service. @@ -198,6 +198,17 @@ export interface NetworkLoadBalancedTaskImageProps { readonly dockerLabels?: { [key: string]: string }; } +export interface NetworkLoadBalancedFargateTaskImageProps extends NetworkLoadBalancedTaskImageProps { + /** + * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. + * + * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. + * + * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. + */ + readonly ephemeralStorageGiB?: number; +} + /** * Properties to define an network load balancer. */ diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-load-balanced-fargate-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-load-balanced-fargate-service.ts index 78e2cb9b37143..31f8b247f4619 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-load-balanced-fargate-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-load-balanced-fargate-service.ts @@ -29,15 +29,6 @@ export interface ApplicationLoadBalancedFargateServiceProps extends ApplicationL * @default - A new security group is created. */ readonly securityGroups?: ISecurityGroup[]; - - /** - * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. - * - * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. - * - * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. - */ - readonly ephemeralStorageGiB?: number; } /** @@ -80,7 +71,7 @@ export class ApplicationLoadBalancedFargateService extends ApplicationLoadBalanc taskRole: taskImageOptions.taskRole, family: taskImageOptions.family, runtimePlatform: props.runtimePlatform, - ephemeralStorageGiB: props.ephemeralStorageGiB, + ephemeralStorageGiB: taskImageOptions.ephemeralStorageGiB, }); // Create log driver if logging is enabled diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-multiple-target-groups-fargate-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-multiple-target-groups-fargate-service.ts index 7a2caf6c7470c..2465da555f486 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-multiple-target-groups-fargate-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-multiple-target-groups-fargate-service.ts @@ -20,15 +20,6 @@ export interface ApplicationMultipleTargetGroupsFargateServiceProps extends Appl * @default false */ readonly assignPublicIp?: boolean; - - /** - * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. - * - * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. - * - * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. - */ - readonly ephemeralStorageGiB?: number; } /** @@ -78,7 +69,7 @@ export class ApplicationMultipleTargetGroupsFargateService extends ApplicationMu taskRole: taskImageOptions.taskRole, family: taskImageOptions.family, runtimePlatform: props.runtimePlatform, - ephemeralStorageGiB: props.ephemeralStorageGiB, + ephemeralStorageGiB: taskImageOptions.ephemeralStorageGiB, }); const containerName = taskImageOptions.containerName ?? 'web'; 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 af08709166caa..b145c327b4c26 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 @@ -24,15 +24,6 @@ export interface NetworkLoadBalancedFargateServiceProps extends NetworkLoadBalan * @default - Public subnets if `assignPublicIp` is set, otherwise the first available one of Private, Isolated, Public, in that order. */ readonly taskSubnets?: SubnetSelection; - - /** - * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. - * - * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. - * - * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. - */ - readonly ephemeralStorageGiB?: number; } /** @@ -71,7 +62,7 @@ export class NetworkLoadBalancedFargateService extends NetworkLoadBalancedServic taskRole: taskImageOptions.taskRole, family: taskImageOptions.family, runtimePlatform: props.runtimePlatform, - ephemeralStorageGiB: props.ephemeralStorageGiB, + ephemeralStorageGiB: taskImageOptions.ephemeralStorageGiB, }); // Create log driver if logging is enabled diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/network-multiple-target-groups-fargate-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/network-multiple-target-groups-fargate-service.ts index d26c81ef57edb..6922e6bfec210 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/network-multiple-target-groups-fargate-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/network-multiple-target-groups-fargate-service.ts @@ -20,15 +20,6 @@ export interface NetworkMultipleTargetGroupsFargateServiceProps extends NetworkM * @default false */ readonly assignPublicIp?: boolean; - - /** - * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. - * - * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. - * - * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. - */ - readonly ephemeralStorageGiB?: number; } /** @@ -78,7 +69,7 @@ export class NetworkMultipleTargetGroupsFargateService extends NetworkMultipleTa taskRole: taskImageOptions.taskRole, family: taskImageOptions.family, runtimePlatform: props.runtimePlatform, - ephemeralStorageGiB: props.ephemeralStorageGiB, + ephemeralStorageGiB: taskImageOptions.ephemeralStorageGiB, }); const containerName = taskImageOptions.containerName ?? 'web'; diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/scheduled-fargate-task.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/scheduled-fargate-task.ts index 29844f7107b94..1766b7631e968 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/scheduled-fargate-task.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/scheduled-fargate-task.ts @@ -30,7 +30,6 @@ export interface ScheduledFargateTaskProps extends ScheduledTaskBaseProps, Farga * The properties for the ScheduledFargateTask using an image. */ export interface ScheduledFargateTaskImageOptions extends ScheduledTaskImageProps, FargateServiceBaseProps { - /** * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. * @@ -39,7 +38,6 @@ export interface ScheduledFargateTaskImageOptions extends ScheduledTaskImageProp * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. */ readonly ephemeralStorageGiB?: number; - } /** diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/load-balanced-fargate-service.test.ts b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/load-balanced-fargate-service.test.ts index e295e5ed809e6..7dc810179b530 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/load-balanced-fargate-service.test.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/load-balanced-fargate-service.test.ts @@ -22,8 +22,8 @@ test('setting loadBalancerType to Network creates an NLB Public', () => { cluster, taskImageOptions: { image: ecs.ContainerImage.fromRegistry('/aws/aws-example-app'), + ephemeralStorageGiB: 100, }, - ephemeralStorageGiB: 100, }); // THEN @@ -225,8 +225,8 @@ test('setting healthCheckGracePeriod works', () => { new ecsPatterns.ApplicationLoadBalancedFargateService(stack, 'Service', { taskImageOptions: { image: ecs.ContainerImage.fromRegistry('/aws/aws-example-app'), + ephemeralStorageGiB: 100, }, - ephemeralStorageGiB: 100, healthCheckGracePeriod: cdk.Duration.seconds(600), }); // THEN From e957372fa23220cf8c01e3df518f2e30e0cf0272 Mon Sep 17 00:00:00 2001 From: homakk Date: Mon, 24 Apr 2023 19:37:11 +0000 Subject: [PATCH 11/11] updated changes --- .../base/application-load-balanced-service-base.ts | 13 +------------ ...plication-multiple-target-groups-service-base.ts | 13 +------------ .../lib/base/fargate-service-base.ts | 11 +++++++++++ .../lib/base/network-load-balanced-service-base.ts | 13 +------------ .../network-multiple-target-groups-service-base.ts | 13 +------------ .../application-load-balanced-fargate-service.ts | 6 +++--- ...cation-multiple-target-groups-fargate-service.ts | 6 +++--- .../network-load-balanced-fargate-service.ts | 6 +++--- ...etwork-multiple-target-groups-fargate-service.ts | 6 +++--- .../fargate/load-balanced-fargate-service.test.ts | 4 ++-- 10 files changed, 29 insertions(+), 62 deletions(-) diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts index 38c09bb6d5a95..514639acd71ee 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts @@ -58,7 +58,7 @@ export interface ApplicationLoadBalancedServiceBaseProps { * * @default none */ - readonly taskImageOptions?: ApplicationLoadBalancedFargateTaskImageOptions; + readonly taskImageOptions?: ApplicationLoadBalancedTaskImageOptions; /** * Determines whether the Load Balancer will be internet-facing. @@ -279,17 +279,6 @@ export interface ApplicationLoadBalancedServiceBaseProps { readonly idleTimeout?: Duration; } -export interface ApplicationLoadBalancedFargateTaskImageOptions extends ApplicationLoadBalancedTaskImageOptions { - /** - * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. - * - * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. - * - * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. - */ - readonly ephemeralStorageGiB?: number; -} - export interface ApplicationLoadBalancedTaskImageOptions { /** * The image used to start a container. Image or taskDefinition must be specified, not both. diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts index 7e35c1e29eefc..4e11fad6db585 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts @@ -45,7 +45,7 @@ export interface ApplicationMultipleTargetGroupsServiceBaseProps { * * @default none */ - readonly taskImageOptions?: ApplicationLoadBalancedFargateTaskImageProps; + readonly taskImageOptions?: ApplicationLoadBalancedTaskImageProps; /** * The desired number of instantiations of the task definition to keep running on the service. @@ -116,17 +116,6 @@ export interface ApplicationMultipleTargetGroupsServiceBaseProps { readonly enableExecuteCommand?: boolean; } -export interface ApplicationLoadBalancedFargateTaskImageProps extends ApplicationLoadBalancedTaskImageProps { - /** - * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. - * - * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. - * - * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. - */ - readonly ephemeralStorageGiB?: number; -} - /** * Options for configuring a new container. */ diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/fargate-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/fargate-service-base.ts index 618f556744800..dc1c9070b5a1e 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/fargate-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/fargate-service-base.ts @@ -80,3 +80,14 @@ export interface FargateServiceBaseProps { */ readonly runtimePlatform?: RuntimePlatform; } + +export interface FargateTaskImageOptions { + /** + * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. + * + * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. + * + * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. + */ + readonly ephemeralStorageGiB?: number; +} 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 721d5e72f3e95..61911ae406578 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 @@ -53,7 +53,7 @@ export interface NetworkLoadBalancedServiceBaseProps { * * @default - none */ - readonly taskImageOptions?: NetworkLoadBalancedFargateTaskImageOptions; + readonly taskImageOptions?: NetworkLoadBalancedTaskImageOptions; /** * Determines whether the Load Balancer will be internet-facing. @@ -287,17 +287,6 @@ export interface NetworkLoadBalancedTaskImageOptions { readonly dockerLabels?: { [key: string]: string }; } -export interface NetworkLoadBalancedFargateTaskImageOptions extends NetworkLoadBalancedTaskImageOptions { - /** - * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. - * - * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. - * - * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. - */ - readonly ephemeralStorageGiB?: number; -} - /** * The base class for NetworkLoadBalancedEc2Service and NetworkLoadBalancedFargateService services. */ diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts index 8baee973fbede..33427c75c3758 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts @@ -35,7 +35,7 @@ export interface NetworkMultipleTargetGroupsServiceBaseProps { * * @default - none */ - readonly taskImageOptions?: NetworkLoadBalancedFargateTaskImageProps; + readonly taskImageOptions?: NetworkLoadBalancedTaskImageProps; /** * The desired number of instantiations of the task definition to keep running on the service. @@ -198,17 +198,6 @@ export interface NetworkLoadBalancedTaskImageProps { readonly dockerLabels?: { [key: string]: string }; } -export interface NetworkLoadBalancedFargateTaskImageProps extends NetworkLoadBalancedTaskImageProps { - /** - * The amount (in GiB) of ephemeral storage to be allocated to the task. The maximum supported value is 200GiB. - * - * NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later. - * - * @default - Undefined, in which case, the task will receive 20GiB ephemeral storage. - */ - readonly ephemeralStorageGiB?: number; -} - /** * Properties to define an network load balancer. */ diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-load-balanced-fargate-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-load-balanced-fargate-service.ts index 31f8b247f4619..57e5079574660 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-load-balanced-fargate-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-load-balanced-fargate-service.ts @@ -4,11 +4,11 @@ import { FeatureFlags } from '../../../core'; import * as cxapi from '../../../cx-api'; import { Construct } from 'constructs'; import { ApplicationLoadBalancedServiceBase, ApplicationLoadBalancedServiceBaseProps } from '../base/application-load-balanced-service-base'; -import { FargateServiceBaseProps } from '../base/fargate-service-base'; +import { FargateServiceBaseProps, FargateTaskImageOptions } from '../base/fargate-service-base'; /** * The properties for the ApplicationLoadBalancedFargateService service. */ -export interface ApplicationLoadBalancedFargateServiceProps extends ApplicationLoadBalancedServiceBaseProps, FargateServiceBaseProps { +export interface ApplicationLoadBalancedFargateServiceProps extends ApplicationLoadBalancedServiceBaseProps, FargateServiceBaseProps, FargateTaskImageOptions { /** * Determines whether the service will be assigned a public IP address. * @@ -71,7 +71,7 @@ export class ApplicationLoadBalancedFargateService extends ApplicationLoadBalanc taskRole: taskImageOptions.taskRole, family: taskImageOptions.family, runtimePlatform: props.runtimePlatform, - ephemeralStorageGiB: taskImageOptions.ephemeralStorageGiB, + ephemeralStorageGiB: props.ephemeralStorageGiB, }); // Create log driver if logging is enabled diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-multiple-target-groups-fargate-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-multiple-target-groups-fargate-service.ts index 2465da555f486..83539013436cf 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-multiple-target-groups-fargate-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-multiple-target-groups-fargate-service.ts @@ -7,12 +7,12 @@ import { ApplicationMultipleTargetGroupsServiceBase, ApplicationMultipleTargetGroupsServiceBaseProps, } from '../base/application-multiple-target-groups-service-base'; -import { FargateServiceBaseProps } from '../base/fargate-service-base'; +import { FargateServiceBaseProps, FargateTaskImageOptions } from '../base/fargate-service-base'; /** * The properties for the ApplicationMultipleTargetGroupsFargateService service. */ -export interface ApplicationMultipleTargetGroupsFargateServiceProps extends ApplicationMultipleTargetGroupsServiceBaseProps, FargateServiceBaseProps { +export interface ApplicationMultipleTargetGroupsFargateServiceProps extends ApplicationMultipleTargetGroupsServiceBaseProps, FargateServiceBaseProps, FargateTaskImageOptions { /** * Determines whether the service will be assigned a public IP address. @@ -69,7 +69,7 @@ export class ApplicationMultipleTargetGroupsFargateService extends ApplicationMu taskRole: taskImageOptions.taskRole, family: taskImageOptions.family, runtimePlatform: props.runtimePlatform, - ephemeralStorageGiB: taskImageOptions.ephemeralStorageGiB, + ephemeralStorageGiB: props.ephemeralStorageGiB, }); const containerName = taskImageOptions.containerName ?? 'web'; 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 b145c327b4c26..159f5b6f1a59c 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 @@ -3,13 +3,13 @@ import { FargateService, FargateTaskDefinition } from '../../../aws-ecs'; import { FeatureFlags } from '../../../core'; import * as cxapi from '../../../cx-api'; import { Construct } from 'constructs'; -import { FargateServiceBaseProps } from '../base/fargate-service-base'; +import { FargateServiceBaseProps, FargateTaskImageOptions } from '../base/fargate-service-base'; import { NetworkLoadBalancedServiceBase, NetworkLoadBalancedServiceBaseProps } from '../base/network-load-balanced-service-base'; /** * The properties for the NetworkLoadBalancedFargateService service. */ -export interface NetworkLoadBalancedFargateServiceProps extends NetworkLoadBalancedServiceBaseProps, FargateServiceBaseProps { +export interface NetworkLoadBalancedFargateServiceProps extends NetworkLoadBalancedServiceBaseProps, FargateServiceBaseProps, FargateTaskImageOptions { /** * Determines whether the service will be assigned a public IP address. @@ -62,7 +62,7 @@ export class NetworkLoadBalancedFargateService extends NetworkLoadBalancedServic taskRole: taskImageOptions.taskRole, family: taskImageOptions.family, runtimePlatform: props.runtimePlatform, - ephemeralStorageGiB: taskImageOptions.ephemeralStorageGiB, + ephemeralStorageGiB: props.ephemeralStorageGiB, }); // Create log driver if logging is enabled diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/network-multiple-target-groups-fargate-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/network-multiple-target-groups-fargate-service.ts index 6922e6bfec210..fb3b7f0307059 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/network-multiple-target-groups-fargate-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/network-multiple-target-groups-fargate-service.ts @@ -3,7 +3,7 @@ import { NetworkTargetGroup } from '../../../aws-elasticloadbalancingv2'; import { FeatureFlags } from '../../../core'; import * as cxapi from '../../../cx-api'; import { Construct } from 'constructs'; -import { FargateServiceBaseProps } from '../base/fargate-service-base'; +import { FargateServiceBaseProps, FargateTaskImageOptions } from '../base/fargate-service-base'; import { NetworkMultipleTargetGroupsServiceBase, NetworkMultipleTargetGroupsServiceBaseProps, @@ -12,7 +12,7 @@ import { /** * The properties for the NetworkMultipleTargetGroupsFargateService service. */ -export interface NetworkMultipleTargetGroupsFargateServiceProps extends NetworkMultipleTargetGroupsServiceBaseProps, FargateServiceBaseProps { +export interface NetworkMultipleTargetGroupsFargateServiceProps extends NetworkMultipleTargetGroupsServiceBaseProps, FargateServiceBaseProps, FargateTaskImageOptions { /** * Determines whether the service will be assigned a public IP address. @@ -69,7 +69,7 @@ export class NetworkMultipleTargetGroupsFargateService extends NetworkMultipleTa taskRole: taskImageOptions.taskRole, family: taskImageOptions.family, runtimePlatform: props.runtimePlatform, - ephemeralStorageGiB: taskImageOptions.ephemeralStorageGiB, + ephemeralStorageGiB: props.ephemeralStorageGiB, }); const containerName = taskImageOptions.containerName ?? 'web'; diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/load-balanced-fargate-service.test.ts b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/load-balanced-fargate-service.test.ts index 7dc810179b530..e295e5ed809e6 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/load-balanced-fargate-service.test.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/load-balanced-fargate-service.test.ts @@ -22,8 +22,8 @@ test('setting loadBalancerType to Network creates an NLB Public', () => { cluster, taskImageOptions: { image: ecs.ContainerImage.fromRegistry('/aws/aws-example-app'), - ephemeralStorageGiB: 100, }, + ephemeralStorageGiB: 100, }); // THEN @@ -225,8 +225,8 @@ test('setting healthCheckGracePeriod works', () => { new ecsPatterns.ApplicationLoadBalancedFargateService(stack, 'Service', { taskImageOptions: { image: ecs.ContainerImage.fromRegistry('/aws/aws-example-app'), - ephemeralStorageGiB: 100, }, + ephemeralStorageGiB: 100, healthCheckGracePeriod: cdk.Duration.seconds(600), }); // THEN