diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/.eslintrc.js b/packages/@aws-cdk-containers/ecs-service-extensions/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/.gitignore b/packages/@aws-cdk-containers/ecs-service-extensions/.gitignore deleted file mode 100644 index 0865b27d394a2..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/.gitignore +++ /dev/null @@ -1,26 +0,0 @@ -*.js -*.js.map -*.d.ts -*.generated.ts -dist -lib/generated/resources.ts -.jsii - -.coverage -__pycache__ - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js - -junit.xml - -!jest.config.js -!**/*.integ.snapshot/**/asset.*/*.js -!**/*.integ.snapshot/**/asset.*/*.d.ts - -!**/*.integ.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/.npmignore b/packages/@aws-cdk-containers/ecs-service-extensions/.npmignore deleted file mode 100644 index 9bcdfbb4d0764..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -**/cdk.out -junit.xml - -test/ -jest.config.js -**/*.integ.snapshot -**/*.integ.snapshot diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/CONTRIBUTING.md b/packages/@aws-cdk-containers/ecs-service-extensions/CONTRIBUTING.md deleted file mode 100644 index 5a6ad506d18ea..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/CONTRIBUTING.md +++ /dev/null @@ -1 +0,0 @@ -See: [Contributing Guide](https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-ecs/README.md) diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/LICENSE b/packages/@aws-cdk-containers/ecs-service-extensions/LICENSE deleted file mode 100644 index 82ad00bb02d0b..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/NOTICE b/packages/@aws-cdk-containers/ecs-service-extensions/NOTICE deleted file mode 100644 index 1b7adbb891265..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/README.md b/packages/@aws-cdk-containers/ecs-service-extensions/README.md deleted file mode 100644 index 49ebf7186ef2a..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/README.md +++ /dev/null @@ -1,538 +0,0 @@ -# CDK Construct library for building ECS services - - ---- - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -> ⚠️ v2 of this library is now available! It is compatible with AWS CDK v2 and available in -> multiple languages. -> The source code for v2 lives [here](https://github.com/cdklabs/cdk-ecs-service-extensions). -> To migrate from this library to v2, see the [Migration Guide](https://github.com/cdklabs/cdk-ecs-service-extensions/blob/main/MIGRATING.md). - -This library provides a high level, extensible pattern for constructing services -deployed using Amazon ECS. - -The `Service` construct provided by this module can be extended with optional `ServiceExtension` classes that add supplemental ECS features including: - -- [AWS X-Ray](https://aws.amazon.com/xray/) for tracing your application -- [Amazon CloudWatch Agent](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Install-CloudWatch-Agent.html) for capturing per task stats -- [AWS AppMesh](https://aws.amazon.com/app-mesh/) for adding your application to a service mesh -- [Application Load Balancer](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/introduction.html), for exposing your service to the public -- [AWS FireLens](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_firelens.html), for filtering and routing application logs -- [Injecter Extension](#injecter-extension), for allowing your service connect to other AWS services by granting permission and injecting environment variables -- [Queue Extension](#queue-extension), for allowing your service to consume messages from an SQS Queue which can be populated by one or more SNS Topics that it is subscribed to -- [Community Extensions](#community-extensions), providing support for advanced use cases - -The `ServiceExtension` class is an abstract class which you can also implement in -order to build your own custom service extensions for modifying your service, or -attaching your own custom resources or sidecars. - -## Example - -```ts -import { AppMeshExtension, CloudwatchAgentExtension, Container, Environment, FireLensExtension, HttpLoadBalancerExtension, Service, ServiceDescription, XRayExtension } from 'ecs-service-builder'; - -// Create an environment to deploy a service in. -const environment = new Environment(stack, 'production'); - -// Build out the service description -const nameDescription = new ServiceDescription(); -nameDescription.add(new Container({ - cpu: 1024, - memoryMiB: 2048, - trafficPort: 80, - image: ContainerImage.fromRegistry('nathanpeck/name'), - environment: { - PORT: '80', - }, -})); -nameDescription.add(new AppMeshExtension({ mesh })); -nameDescription.add(new FireLensExtension()); -nameDescription.add(new XRayExtension()); -nameDescription.add(new CloudwatchAgentExtension()); -nameDescription.add(new HttpLoadBalancerExtension()); - -// Implement the service description as a real service inside -// an environment. -const nameService = new Service(stack, 'name', { - environment: environment, - serviceDescription: nameDescription, -}); -``` - -## Creating an `Environment` - -An `Environment` is a place to deploy your services. You can have multiple environments -on a single AWS account. For example, you could create a `test` environment as well -as a `production` environment so you have a place to verify that your application -works as intended before you deploy it to a live environment. - -Each environment is isolated from other environments. In other words, -when you create an environment, by default the construct supplies its own VPC, -ECS Cluster, and any other required resources for the environment: - -```ts -const environment = new Environment(stack, 'production'); -``` - -However, you can also choose to build an environment out of a pre-existing VPC -or ECS Cluster: - -```ts -const vpc = new ec2.Vpc(stack, 'VPC'); -const cluster = new ecs.Cluster(stack, 'Cluster', { vpc }); - -const environment = new Environment(stack, 'production', { - vpc, - cluster, -}); -``` - -## Defining your `ServiceDescription` - -The `ServiceDescription` defines what application you want the service to run and -what optional extensions you want to add to the service. The most basic form of a `ServiceDescription` looks like this: - -```ts -const nameDescription = new ServiceDescription(); -nameDescription.add(new Container({ - cpu: 1024, - memoryMiB: 2048, - trafficPort: 80, - image: ContainerImage.fromRegistry('nathanpeck/name'), - environment: { - PORT: '80', - }, -})); -``` - -Every `ServiceDescription` requires at minimum that you add a `Container` extension -which defines the main application (essential) container to run for the service. - -### Logging using `awslogs` log driver - -If no observability extensions have been configured for a service, the ECS Service Extensions configures an `awslogs` log driver for the application container of the service to send the container logs to CloudWatch Logs. - -You can either provide a log group to the `Container` extension or one will be created for you by the CDK. - -Following is an example of an application with an `awslogs` log driver configured for the application container: - -```ts -const environment = new Environment(stack, 'production'); - -const nameDescription = new ServiceDescription(); -nameDescription.add(new Container({ - cpu: 1024, - memoryMiB: 2048, - trafficPort: 80, - image: ContainerImage.fromRegistry('nathanpeck/name'), - environment: { - PORT: '80', - }, - logGroup: new awslogs.LogGroup(stack, 'MyLogGroup'), -})); -``` - -If a log group is not provided, no observability extensions have been created, and the `ECS_SERVICE_EXTENSIONS_ENABLE_DEFAULT_LOG_DRIVER` feature flag is enabled, then logging will be configured by default and a log group will be created for you. - -The `ECS_SERVICE_EXTENSIONS_ENABLE_DEFAULT_LOG_DRIVER` feature flag is enabled by default in any CDK apps that are created with CDK v1.140.0 or v2.8.0 and later. - -To enable default logging for previous versions, ensure that the `ECS_SERVICE_EXTENSIONS_ENABLE_DEFAULT_LOG_DRIVER` flag within the application stack context is set to true, like so: - -```ts -stack.node.setContext(cxapi.ECS_SERVICE_EXTENSIONS_ENABLE_DEFAULT_LOG_DRIVER, true); -``` - -Alternatively, you can also set the feature flag in the `cdk.json` file. For more information, refer the [docs](https://docs.aws.amazon.com/cdk/v2/guide/featureflags.html). - -After adding the `Container` extension, you can optionally enable additional features for the service using the `ServiceDescription.add()` method: - -```ts -nameDescription.add(new AppMeshExtension({ mesh })); -nameDescription.add(new FireLensExtension()); -nameDescription.add(new XRayExtension()); -nameDescription.add(new CloudwatchAgentExtension()); -nameDescription.add(new HttpLoadBalancerExtension()); -nameDescription.add(new AssignPublicIpExtension()); -``` - -## Launching the `ServiceDescription` as a `Service` - -Once the service description is defined, you can launch it as a service: - -```ts -const nameService = new Service(stack, 'name', { - environment: environment, - serviceDescription: nameDescription, -}); -``` - -At this point, all the service resources will be created. This includes the ECS Task -Definition, Service, as well as any other attached resources, such as App Mesh Virtual -Node or an Application Load Balancer. - -## Creating your own taskRole - -Sometimes the taskRole should be defined outside of the service so that you can create strict resource policies (ie. S3 bucket policies) that are restricted to a given taskRole: - -```ts -const taskRole = new iam.Role(stack, 'CustomTaskRole', { - assumedBy: new iam.ServicePrincipal('ecs-tasks.amazonaws.com'), -}); - -// Use taskRole in any CDK resource policies -// new s3.BucketPolicy(this, 'BucketPolicy, {}); - -const nameService = new Service(stack, 'name', { - environment: environment, - serviceDescription: nameDescription, - taskRole, -}); -``` - -## Task Auto-Scaling - -You can configure the task count of a service to match demand. The recommended way of achieving this is to configure target tracking policies for your service which scales in and out in order to keep metrics around target values. - -You need to configure an auto scaling target for the service by setting the `minTaskCount` (defaults to 1) and `maxTaskCount` in the `Service` construct. Then you can specify target values for "CPU Utilization" or "Memory Utilization" across all tasks in your service. Note that the `desiredCount` value will be set to `undefined` if the auto scaling target is configured. - -If you want to configure auto-scaling policies based on resources like Application Load Balancer or SQS Queues, you can set the corresponding resource-specific fields in the extension. For example, you can enable target tracking scaling based on Application Load Balancer request count as follows: - -```ts -const stack = new cdk.Stack(); -const environment = new Environment(stack, 'production'); -const serviceDescription = new ServiceDescription(); - -serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('my-alb'), -})); - -// Add the extension with target `requestsPerTarget` value set -serviceDescription.add(new HttpLoadBalancerExtension({ requestsPerTarget: 10 })); - -// Configure the auto scaling target -new Service(stack, 'my-service', { - environment, - serviceDescription, - desiredCount: 5, - // Task auto-scaling constuct for the service - autoScaleTaskCount: { - maxTaskCount: 10, - targetCpuUtilization: 70, - targetMemoryUtilization: 50, - }, -}); -``` - -You can also define your own service extensions for [other auto-scaling policies](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-auto-scaling.html) for your service by making use of the `scalableTaskCount` attribute of the `Service` class. - -## Creating your own custom `ServiceExtension` - -In addition to using the default service extensions that come with this module, you -can choose to implement your own custom service extensions. The `ServiceExtension` -class is an abstract class you can implement yourself. The following example -implements a custom service extension that could be added to a service in order to -autoscale it based on scaling intervals of SQS Queue size: - -```ts -export class MyCustomAutoscaling extends ServiceExtension { - constructor() { - super('my-custom-autoscaling'); - // Scaling intervals for the step scaling policy - this.scalingSteps = [{ upper: 0, change: -1 }, { lower: 100, change: +1 }, { lower: 500, change: +5 }]; - this.sqsQueue = new sqs.Queue(this.scope, 'my-queue'); - } - - // This hook utilizes the resulting service construct - // once it is created - public useService(service: ecs.Ec2Service | ecs.FargateService) { - this.parentService.scalableTaskCount.scaleOnMetric('QueueMessagesVisibleScaling', { - metric: this.sqsQueue.metricApproximateNumberOfMessagesVisible(), - scalingSteps: this.scalingSteps, - }); - } -} -``` - -This `ServiceExtension` can now be reused and added to any number of different -service descriptions. This allows you to develop reusable bits of configuration, -attach them to many different services, and centrally manage them. Updating the -`ServiceExtension` in one place would update all services that use it, instead of -requiring decentralized updates to many different services. - -Every `ServiceExtension` can implement the following hooks to modify the properties -of constructs, or make use of the resulting constructs: - -- `addHooks()` - This hook is called after all the extensions are added to a - ServiceDescription, but before any of the other extension hooks have been run. - It gives each extension a chance to do some inspection of the overall ServiceDescription - and see what other extensions have been added. Some extensions may want to register - hooks on the other extensions to modify them. For example, the Firelens extension - wants to be able to modify the settings of the application container to route logs - through Firelens. -- `modifyTaskDefinitionProps()` - This is hook is passed the proposed - ecs.TaskDefinitionProps for a TaskDefinition that is about to be created. - This allows the extension to make modifications to the task definition props - before the TaskDefinition is created. For example, the App Mesh extension modifies - the proxy settings for the task. -- `useTaskDefinition()` - After the TaskDefinition is created, this hook is - passed the actual TaskDefinition construct that was created. This allows the - extension to add containers to the task, modify the task definition's IAM role, - etc. -- `resolveContainerDependencies()` - Once all extensions have added their containers, - each extension is given a chance to modify its container's `dependsOn` settings. - Extensions need to check and see what other extensions were enabled and decide - whether their container needs to wait on another container to start first. -- `modifyServiceProps()` - Before an Ec2Service or FargateService is created, this - hook is passed a draft version of the service props to change. Each extension adds - its own modifications to the service properties. For example, the App Mesh extension - needs to modify the service settings to enable CloudMap service discovery. -- `useService()` - After the service is created, this hook is given a chance to - utilize that service. This is used by extensions like the load balancer or App Mesh - extension, which create and link other AWS resources to the ECS extension. -- `connectToService()` - This hook is called when a user wants to connect one service - to another service. It allows an extension to implement logic about how to allow - connections from one service to another. For example, the App Mesh extension implements - this method in order to easily connect one service mesh service to another, which - allows the service's Envoy proxy sidecars to route traffic to each other. - -## Connecting services - -One of the hooks that a `ServiceExtension` can implement is a hook for connection -logic. This is utilized when connecting one service to another service, e.g. -connecting a user facing web service with a backend API. Usage looks like this: - -```ts -const frontend = new Service(stack, 'frontend', { - environment, - serviceDescription: frontendDescription -}); -const backend = new Service(stack, 'backend', { - environment, - serviceDescription: backendDescription -}); - -frontend.connectTo(backend); -``` - -The address that a service will use to talk to another service depends on the -type of ingress that has been created by the extension that did the connecting. -For example, if an App Mesh extension has been used, then the service is accessible -at a DNS address of `.`. For example: - -```ts -const environment = new Environment(stack, 'production'); - -// Define the frontend tier -const frontendDescription = new ServiceDescription(); -frontendDescription.add(new Container({ - cpu: 1024, - memoryMiB: 2048, - trafficPort: 80, - image: ContainerImage.fromRegistry('my-frontend-service'), - environment: { - BACKEND_URL: 'http://backend.production' - }, -})); -const frontend = new Service(stack, 'frontend', { - environment, - serviceDescription: frontendDescription -}); - -// Define the backend tier -const backendDescription = new ServiceDescription(); -backendDescription.add(new Container({ - cpu: 1024, - memoryMiB: 2048, - trafficPort: 80, - image: ContainerImage.fromRegistry('my-backend-service'), - environment: { - FRONTEND_URL: 'http://frontend.production' - }, -})); -const backend = new Service(stack, 'backend', { - environment, - serviceDescription: backendDescription -}); - -// Connect the two tiers to each other -frontend.connectTo(backend); -``` - -The above code uses the well-known service discovery name for each -service, and passes it as an environment variable to the container so -that the container knows what address to use when communicating to -the other service. - -## Importing a pre-existing cluster - -To create an environment with a pre-existing cluster, you must import the cluster first, then use `Environment.fromEnvironmentAttributes()`. When a cluster is imported into an environment, the cluster is treated as immutable. As a result, no extension may modify the cluster to change a setting. - -```ts - -const cluster = ecs.Cluster.fromClusterAttributes(stack, 'Cluster', { - ... -}); - -const environment = Environment.fromEnvironmentAttributes(stack, 'Environment', { - capacityType: EnvironmentCapacityType.EC2, // or `FARGATE` - cluster, -}); - -``` - -## Injecter Extension - -This service extension accepts a list of `Injectable` resources. It grants access to these resources and adds the necessary environment variables to the tasks that are part of the service. - -For example, an `InjectableTopic` is an SNS Topic that grants permission to the task role and adds the topic ARN as an environment variable to the task definition. - -### Publishing to SNS Topics - -You can use this extension to set up publishing permissions for SNS Topics. - -```ts -nameDescription.add(new InjecterExtension({ - injectables: [new InjectableTopic({ - // SNS Topic the service will publish to - topic: new sns.Topic(stack, 'my-topic'), - })], -})); -``` - -## Queue Extension - -This service extension creates a default SQS Queue `eventsQueue` for the service (if not provided) and optionally also accepts list of `ISubscribable` objects that the `eventsQueue` can subscribe to. The service extension creates the subscriptions and sets up permissions for the service to consume messages from the SQS Queue. - -### Setting up SNS Topic Subscriptions for SQS Queues - -You can use this extension to set up SNS Topic subscriptions for the `eventsQueue`. To do this, create a new object of type `TopicSubscription` for every SNS Topic you want the `eventsQueue` to subscribe to and provide it as input to the service extension. - -```ts -const myServiceDescription = nameDescription.add(new QueueExtension({ - // Provide list of topic subscriptions that you want the `eventsQueue` to subscribe to - subscriptions: [new TopicSubscription({ - topic: new sns.Topic(stack, 'my-topic'), - }], -})); - -// To access the `eventsQueue` for the service, use the `eventsQueue` getter for the extension -const myQueueExtension = myServiceDescription.extensions.queue as QueueExtension; -const myEventsQueue = myQueueExtension.eventsQueue; -``` - -For setting up a topic-specific queue subscription, you can provide a custom queue in the `TopicSubscription` object along with the SNS Topic. The extension will set up a topic subscription for the provided queue instead of the default `eventsQueue` of the service. - -```ts -nameDescription.add(new QueueExtension({ - eventsQueue: myEventsQueue, - subscriptions: [new TopicSubscription({ - topic: new sns.Topic(stack, 'my-topic'), - // `myTopicQueue` will subscribe to the `my-topic` instead of `eventsQueue` - topicSubscriptionQueue: { - queue: myTopicQueue, - }, - }], -})); -``` - -### Configuring auto scaling based on SQS Queues - -You can scale your service up or down to maintain an acceptable queue latency by tracking the backlog per task. It configures a target tracking scaling policy with target value (acceptable backlog per task) calculated by dividing the `acceptableLatency` by `messageProcessingTime`. For example, if the maximum acceptable latency for a message to be processed after its arrival in the SQS Queue is 10 mins and the average processing time for a task is 250 milliseconds per message, then `acceptableBacklogPerTask = 10 * 60 / 0.25 = 2400`. Therefore, each queue can hold up to 2400 messages before the service starts to scale up. For this, a target tracking policy will be attached to the scaling target for your service with target value `2400`. For more information, please refer: https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-using-sqs-queue.html . - -You can configure auto scaling based on SQS Queue for your service as follows: - -```ts -nameDescription.add(new QueueExtension({ - eventsQueue: myEventsQueue, - // Need to specify `scaleOnLatency` to configure auto scaling based on SQS Queue - scaleOnLatency: { - acceptableLatency: cdk.Duration.minutes(10), - messageProcessingTime: cdk.Duration.millis(250), - }, - subscriptions: [new TopicSubscription({ - topic: new sns.Topic(stack, 'my-topic'), - // `myTopicQueue` will subscribe to the `my-topic` instead of `eventsQueue` - topicSubscriptionQueue: { - queue: myTopicQueue, - // Optionally provide `scaleOnLatency` for configuring separate autoscaling for `myTopicQueue` - scaleOnLatency: { - acceptableLatency: cdk.Duration.minutes(10), - messageProcessingTime: cdk.Duration.millis(250), - } - }, - }], -})); -``` - -## Publish/Subscribe Service Pattern - -The [Publish/Subscribe Service Pattern](https://aws.amazon.com/pub-sub-messaging/) is used for implementing asynchronous communication between services. It involves 'publisher' services emitting events to SNS Topics, which are passed to subscribed SQS queues and then consumed by 'worker' services. - -The following example adds the `InjecterExtension` to a `Publisher` Service which can publish events to an SNS Topic and adds the `QueueExtension` to a `Worker` Service which can poll its `eventsQueue` to consume messages populated by the topic. - -```ts -const environment = new Environment(stack, 'production'); - -const pubServiceDescription = new ServiceDescription(); -pubServiceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('sns-publish'), -})); - -const myTopic = new sns.Topic(stack, 'myTopic'); - -// Add the `InjecterExtension` to the service description to allow publishing events to `myTopic` -pubServiceDescription.add(new InjecterExtension({ - injectables: [new InjectableTopic({ - topic: myTopic, - }], -})); - -// Create the `Publisher` Service -new Service(stack, 'Publisher', { - environment: environment, - serviceDescription: pubServiceDescription, -}); - -const subServiceDescription = new ServiceDescription(); -subServiceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('sqs-reader'), -})); - -// Add the `QueueExtension` to the service description to subscribe to `myTopic` -subServiceDescription.add(new QueueExtension({ - subscriptions: [new TopicSubscription({ - topic: myTopic, - }], -})); - -// Create the `Worker` Service -new Service(stack, 'Worker', { - environment: environment, - serviceDescription: subServiceDescription, -}); -``` - -## Community Extensions - -We encourage the development of Community Service Extensions that support -advanced features. Here are some useful extensions that we have reviewed: - -- [ListenerRulesExtension](https://www.npmjs.com/package/@wheatstalk/ecs-service-extension-listener-rules) for more precise control over Application Load Balancer rules - -> Please submit a pull request so that we can review your service extension and -> list it here. diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/jest.config.js b/packages/@aws-cdk-containers/ecs-service-extensions/jest.config.js deleted file mode 100644 index e88b48ab04549..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/jest.config.js +++ /dev/null @@ -1,9 +0,0 @@ -const baseConfig = require('../../../tools/@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = { - ...baseConfig, - coverageThreshold: { - global: { - branches: 70, - } - } -}; diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/environment.ts b/packages/@aws-cdk-containers/ecs-service-extensions/lib/environment.ts deleted file mode 100644 index 5fae1c627bead..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/environment.ts +++ /dev/null @@ -1,166 +0,0 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import { Construct } from 'constructs'; -import { EnvironmentCapacityType } from './extensions/extension-interfaces'; - -/** - * Settings for the environment where you want to deploy your services. - */ -export interface EnvironmentProps { - /** - * The VPC used by the service for networking. - * - * @default - Create a new VPC - */ - readonly vpc?: ec2.IVpc, - - /** - * The ECS cluster which provides compute capacity to this service. - * - * [disable-awslint:ref-via-interface] - * @default - Create a new cluster - */ - readonly cluster?: ecs.Cluster - - /** - * The type of capacity to use for this environment. - * - * @default - EnvironmentCapacityType.FARGATE - */ - readonly capacityType?: EnvironmentCapacityType -} - -/** - * An environment into which to deploy a service. - */ -export interface IEnvironment { - /** - * The name of this environment. - */ - readonly id: string; - - /** - * The VPC into which environment services should be placed. - */ - readonly vpc: ec2.IVpc; - - /** - * The cluster that is providing capacity for this service. - */ - readonly cluster: ecs.ICluster; - - /** - * The capacity type used by the service's cluster. - */ - readonly capacityType: EnvironmentCapacityType; - - /** - * Add a default cloudmap namespace to the environment's cluster. - */ - addDefaultCloudMapNamespace(options: ecs.CloudMapNamespaceOptions): void; -} - -/** - * An environment into which to deploy a service. This environment - * can either be instantiated with a pre-existing AWS VPC and ECS cluster, - * or it can create its own VPC and cluster. By default, it will create - * a cluster with Fargate capacity. - */ -export class Environment extends Construct implements IEnvironment { - /** - * Import an existing environment from its attributes. - */ - public static fromEnvironmentAttributes(scope: Construct, id: string, attrs: EnvironmentAttributes): IEnvironment { - return new ImportedEnvironment(scope, id, attrs); - } - - /** - * The name of this environment. - */ - public readonly id: string; - - /** - * The VPC where environment services should be placed. - */ - public readonly vpc: ec2.IVpc; - - /** - * The cluster that is providing capacity for this service. - */ - public readonly cluster: ecs.Cluster; - - /** - * The capacity type used by the service's cluster. - */ - public readonly capacityType: EnvironmentCapacityType; - - private readonly scope: Construct; - - constructor(scope: Construct, id: string, props?: EnvironmentProps) { - super(scope, id); - - this.scope = scope; - this.id = id; - - if (props && props.vpc) { - this.vpc = props.vpc; - } else { - this.vpc = new ec2.Vpc(this.scope, `${this.id}-environment-vpc`); - } - - if (props && props.cluster) { - this.cluster = props.cluster; - } else { - this.cluster = new ecs.Cluster(this.scope, `${this.id}-environment-cluster`, { vpc: this.vpc }); - } - - if (props && props.capacityType) { - this.capacityType = props.capacityType; - } else { - this.capacityType = EnvironmentCapacityType.FARGATE; - } - } - - /** - * Add a default cloudmap namespace to the environment's cluster. - */ - addDefaultCloudMapNamespace(options: ecs.CloudMapNamespaceOptions) { - this.cluster.addDefaultCloudMapNamespace(options); - } -} - -export interface EnvironmentAttributes { - /** - * The capacity type used by the service's cluster. - */ - capacityType: EnvironmentCapacityType; - - /** - * The cluster that is providing capacity for this service. - */ - cluster: ecs.ICluster; -} - -export class ImportedEnvironment extends Construct implements IEnvironment { - public readonly capacityType: EnvironmentCapacityType; - public readonly cluster: ecs.ICluster; - public readonly id: string; - public readonly vpc: ec2.IVpc; - - constructor(scope: Construct, id: string, props: EnvironmentAttributes) { - super(scope, id); - - this.id = id; - this.capacityType = props.capacityType; - this.cluster = props.cluster; - this.vpc = props.cluster.vpc; - } - - /** - * Adding a default cloudmap namespace to the cluster will throw an error, as we don't - * own it. - */ - addDefaultCloudMapNamespace(_options: ecs.CloudMapNamespaceOptions) { - throw new Error('the cluster environment is immutable when imported'); - } -} diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/appmesh.ts b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/appmesh.ts deleted file mode 100644 index 0e1df5fca95cb..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/appmesh.ts +++ /dev/null @@ -1,379 +0,0 @@ -import * as appmesh from '@aws-cdk/aws-appmesh'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecr from '@aws-cdk/aws-ecr'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import * as regionInfo from '@aws-cdk/region-info'; -import { Construct } from 'constructs'; -import { Service } from '../service'; -import { Container } from './container'; -import { ServiceExtension, ServiceBuild } from './extension-interfaces'; - -// The version of the App Mesh envoy sidecar to add to the task. -const APP_MESH_ENVOY_SIDECAR_VERSION = 'v1.15.1.0-prod'; - -/** - * The settings for the App Mesh extension. - */ -export interface MeshProps { - /** - * The service mesh into which to register the service. - */ - readonly mesh: appmesh.Mesh; - - /** - * The protocol of the service. - * Valid values are Protocol.HTTP, Protocol.HTTP2, Protocol.TCP, Protocol.GRPC - * @default - Protocol.HTTP - */ - readonly protocol?: appmesh.Protocol; -} - -/** - * This extension adds an Envoy sidecar to the task definition and - * creates the App Mesh resources required to route network traffic - * to the container in a service mesh. - * - * The service will then be available to other App Mesh services at the - * address `.`. For example, a service called - * `orders` deploying in an environment called `production` would be accessible - * to other App Mesh enabled services at the address `http://orders.production`. - */ -export class AppMeshExtension extends ServiceExtension { - protected virtualNode!: appmesh.VirtualNode; - protected virtualService!: appmesh.VirtualService; - protected virtualRouter!: appmesh.VirtualRouter; - protected route!: appmesh.Route; - private mesh: appmesh.Mesh; - - /** - * The protocol used for AppMesh routing. - * default - Protocol.HTTP - */ - public readonly protocol: appmesh.Protocol; - - constructor(props: MeshProps) { - super('appmesh'); - this.mesh = props.mesh; - - if (props.protocol) { - this.protocol = props.protocol; - } else { - this.protocol = appmesh.Protocol.HTTP; - } - } - - public prehook(service: Service, scope: Construct) { - this.parentService = service; - this.scope = scope; - - // Make sure that the parent cluster for this service has - // a namespace attached. - if (!this.parentService.cluster.defaultCloudMapNamespace) { - this.parentService.environment.addDefaultCloudMapNamespace({ - // Name the namespace after the environment name. - // Service DNS will be like . - name: this.parentService.environment.id, - }); - } - } - - public modifyTaskDefinitionProps(props: ecs.TaskDefinitionProps): ecs.TaskDefinitionProps { - // Find the app extension, to get its port - const containerextension = this.parentService.serviceDescription.get('service-container') as Container; - - if (!containerextension) { - throw new Error('Appmesh extension requires an application extension'); - } - - return { - ...props, - - // App Mesh requires AWS VPC networking mode so that each - // task can have its own IP address - networkMode: ecs.NetworkMode.AWS_VPC, - - // This configures the envoy container as a proxy for all - // traffic going into and out of the task, with a few exceptions - // for metadata endpoints or other ports that need direct - // communication - proxyConfiguration: new ecs.AppMeshProxyConfiguration({ - containerName: 'envoy', - properties: { - appPorts: [containerextension.trafficPort], - proxyEgressPort: 15001, - proxyIngressPort: 15000, - - // The App Mesh proxy runs with this user ID, and this keeps its - // own outbound connections from recursively attempting to infinitely proxy. - ignoredUID: 1337, - - // This GID is ignored and any outbound traffic originating from containers that - // use this group ID will be ignored by the proxy. This is primarily utilized by - // the FireLens extension, so that outbound application logs don't have to go through Envoy - // and therefore add extra burden to the proxy sidecar. Instead the logs can go directly - // to CloudWatch - ignoredGID: 1338, - - egressIgnoredIPs: [ - '169.254.170.2', // Allow services to talk directly to ECS metadata endpoints - '169.254.169.254', // and EC2 instance endpoint - ], - - // If there is outbound traffic to specific ports that you want to - // ignore the proxy those ports can be added here. - egressIgnoredPorts: [], - }, - }), - } as ecs.TaskDefinitionProps; - } - - private accountIdForRegion(region: string) { - return { ecrRepo: regionInfo.RegionInfo.get(region).appMeshRepositoryAccount }; - } - - public useTaskDefinition(taskDefinition: ecs.TaskDefinition) { - var region = cdk.Stack.of(this.scope).region; - var partition = cdk.Stack.of(this.scope).partition; - var appMeshRepo; - - // This is currently necessary because App Mesh has different images in each region, - // and some regions have their images in a different account. See: - // https://docs.aws.amazon.com/app-mesh/latest/userguide/envoy.html - const mapping = new cdk.CfnMapping(this.scope, `${this.parentService.id}-envoy-image-account-mapping`, { - mapping: { - 'ap-northeast-1': this.accountIdForRegion('ap-northeast-1'), - 'ap-northeast-2': this.accountIdForRegion('ap-northeast-2'), - 'ap-south-1': this.accountIdForRegion('ap-south-1'), - 'ap-southeast-1': this.accountIdForRegion('ap-southeast-1'), - 'ap-southeast-2': this.accountIdForRegion('ap-southeast-1'), - 'ca-central-1': this.accountIdForRegion('ca-central-1'), - 'cn-north-1': this.accountIdForRegion('cn-north-1'), - 'cn-northwest-1': this.accountIdForRegion('cn-northwest-1'), - 'eu-central-1': this.accountIdForRegion('eu-central-1'), - 'eu-north-1': this.accountIdForRegion('eu-north-1'), - 'eu-south-1': this.accountIdForRegion('eu-south-1'), - 'eu-west-1': this.accountIdForRegion('eu-west-1'), - 'eu-west-2': this.accountIdForRegion('eu-west-2'), - 'eu-west-3': this.accountIdForRegion('eu-west-3'), - 'sa-east-1': this.accountIdForRegion('sa-east-1'), - 'us-east-1': this.accountIdForRegion('us-east-1'), - 'us-east-2': this.accountIdForRegion('us-east-2'), - 'us-west-1': this.accountIdForRegion('us-west-1'), - 'us-west-2': this.accountIdForRegion('us-west-2'), - - 'me-south-1': this.accountIdForRegion('me-south-1'), - 'ap-east-1': this.accountIdForRegion('ap-east-1'), - 'af-south-1': this.accountIdForRegion('af-south-1'), - }, - }); - - // WHEN - const ownerAccount = mapping.findInMap(region, 'ecrRepo'); - - appMeshRepo = ecr.Repository.fromRepositoryAttributes( - this.scope, - `${this.parentService.id}-envoy-repo`, - { - repositoryName: 'aws-appmesh-envoy', - repositoryArn: `arn:${partition}:ecr:${region}:${ownerAccount}:repository/aws-appmesh-envoy`, - }, - ); - - this.container = taskDefinition.addContainer('envoy', { - image: ecs.ContainerImage.fromEcrRepository(appMeshRepo, APP_MESH_ENVOY_SIDECAR_VERSION), - essential: true, - environment: { - APPMESH_VIRTUAL_NODE_NAME: `mesh/${this.mesh.meshName}/virtualNode/${this.parentService.id}`, - AWS_REGION: cdk.Stack.of(this.parentService).region, - ENABLE_ENVOY_STATS_TAGS: '1', - ENABLE_ENVOY_DOG_STATSD: '1', - }, - healthCheck: { - command: [ - 'CMD-SHELL', - 'curl -s http://localhost:9901/server_info | grep state | grep -q LIVE', - ], - startPeriod: cdk.Duration.seconds(10), - interval: cdk.Duration.seconds(5), - timeout: cdk.Duration.seconds(2), - }, - memoryReservationMiB: 128, - user: '1337', - logging: new ecs.AwsLogDriver({ streamPrefix: 'envoy' }), - }); - - // Modify the task definition role to allow the Envoy sidecar to get - // configuration from the Envoy control plane, for this particular - // mesh only. - new iam.Policy(this.scope, `${this.parentService.id}-envoy-to-appmesh`, { - roles: [taskDefinition.taskRole], - statements: [ - new iam.PolicyStatement({ - resources: [this.mesh.meshArn], - actions: ['appmesh:StreamAggregatedResources'], - }), - ], - }); - - // Raise the number of open file descriptors allowed. This is - // necessary when the Envoy proxy is handling large amounts of - // traffic. - this.container.addUlimits({ - softLimit: 1024000, - hardLimit: 1024000, - name: ecs.UlimitName.NOFILE, - }); - } - - // Enable CloudMap for the service. - public modifyServiceProps(props: ServiceBuild): ServiceBuild { - return { - ...props, - - // Ensure that service tasks are registered into - // CloudMap so that the App Mesh proxy can find them. - cloudMapOptions: { - dnsRecordType: 'A', - dnsTtl: cdk.Duration.seconds(10), - failureThreshold: 2, - name: this.parentService.id, - }, - - // These specific deployment settings are currently required in order to - // maintain availability during a rolling deploy of the service with App Mesh - // https://docs.aws.amazon.com/app-mesh/latest/userguide/best-practices.html#reduce-deployment-velocity - minHealthyPercent: 100, - maxHealthyPercent: 125, // Note that at low task count the Service will boost this setting higher - } as ServiceBuild; - } - - // Now that the service is defined, we can create the AppMesh virtual service - // and virtual node for the real service - public useService(service: ecs.Ec2Service | ecs.FargateService) { - const containerextension = this.parentService.serviceDescription.get('service-container') as Container; - - if (!containerextension) { - throw new Error('Firelens extension requires an application extension'); - } - - const cloudmapNamespace = this.parentService.cluster.defaultCloudMapNamespace; - - if (!cloudmapNamespace) { - throw new Error('You must add a CloudMap namespace to the ECS cluster in order to use the AppMesh extension'); - } - - function addListener(protocol: appmesh.Protocol, port: number): appmesh.VirtualNodeListener { - switch (protocol) { - case appmesh.Protocol.HTTP : - return appmesh.VirtualNodeListener.http({ port }); - - case appmesh.Protocol.HTTP2 : - return appmesh.VirtualNodeListener.http2({ port }); - - case appmesh.Protocol.GRPC : - return appmesh.VirtualNodeListener.grpc({ port }); - - case appmesh.Protocol.TCP : - return appmesh.VirtualNodeListener.tcp({ port }); - } - } - - // Create a virtual node for the name service - this.virtualNode = new appmesh.VirtualNode(this.scope, `${this.parentService.id}-virtual-node`, { - mesh: this.mesh, - virtualNodeName: this.parentService.id, - serviceDiscovery: service.cloudMapService - ? appmesh.ServiceDiscovery.cloudMap(service.cloudMapService) - : undefined, - listeners: [addListener(this.protocol, containerextension.trafficPort)], - }); - - // Create a virtual router for this service. This allows for retries - // and other similar behaviors. - this.virtualRouter = new appmesh.VirtualRouter(this.scope, `${this.parentService.id}-virtual-router`, { - mesh: this.mesh, - listeners: [ - this.virtualRouterListener(containerextension.trafficPort), - ], - virtualRouterName: `${this.parentService.id}`, - }); - - // Form the service name that requests will be made to - const serviceName = `${this.parentService.id}.${cloudmapNamespace.namespaceName}`; - const weightedTargets: appmesh.WeightedTarget[] = [{ - virtualNode: this.virtualNode, - weight: 1, - }]; - // Now add the virtual node as a route in the virtual router - // Ensure that the route type matches the protocol type. - this.route = this.virtualRouter.addRoute(`${this.parentService.id}-route`, { - routeSpec: this.routeSpec(weightedTargets, serviceName), - }); - - // Now create a virtual service. Relationship goes like this: - // virtual service -> virtual router -> virtual node - this.virtualService = new appmesh.VirtualService(this.scope, `${this.parentService.id}-virtual-service`, { - virtualServiceProvider: appmesh.VirtualServiceProvider.virtualRouter(this.virtualRouter), - virtualServiceName: serviceName, - }); - } - - // Connect the app mesh extension for this service to an app mesh - // extension on another service. - public connectToService(otherService: Service) { - const otherAppMesh = otherService.serviceDescription.get('appmesh') as AppMeshExtension; - const otherContainer = otherService.serviceDescription.get('service-container') as Container; - - // Do a check to ensure that these services are in the same environment. - // Currently this extension only supports connecting services within - // the same VPC, same App Mesh service mesh, and same Cloud Map namespace - if (otherAppMesh.parentService.environment.id !== this.parentService.environment.id) { - throw new Error(`Unable to connect service '${this.parentService.id}' in environment '${this.parentService.environment.id}' to service '${otherService.id}' in environment '${otherAppMesh.parentService.environment.id}' because services can not be connected across environment boundaries`); - } - - // First allow this service to talk to the other service - // at a network level. This opens the security groups so that - // the security groups of these two services to each other - this.parentService.ecsService.connections.allowTo( - otherService.ecsService, - ec2.Port.tcp(otherContainer.trafficPort), - `Accept inbound traffic from ${this.parentService.id}`, - ); - - // Next update the app mesh config so that the local Envoy - // proxy on this service knows how to route traffic to - // nodes from the other service. - this.virtualNode.addBackend(appmesh.Backend.virtualService(otherAppMesh.virtualService)); - } - - private routeSpec(weightedTargets: appmesh.WeightedTarget[], serviceName: string): appmesh.RouteSpec { - switch (this.protocol) { - case appmesh.Protocol.HTTP: return appmesh.RouteSpec.http({ - weightedTargets: weightedTargets, - }); - case appmesh.Protocol.HTTP2: return appmesh.RouteSpec.http2({ - weightedTargets: weightedTargets, - }); - case appmesh.Protocol.GRPC: return appmesh.RouteSpec.grpc({ - weightedTargets: weightedTargets, - match: { - serviceName: serviceName, - }, - }); - case appmesh.Protocol.TCP: return appmesh.RouteSpec.tcp({ - weightedTargets: weightedTargets, - }); - } - } - - private virtualRouterListener(port: number): appmesh.VirtualRouterListener { - switch (this.protocol) { - case appmesh.Protocol.HTTP: return appmesh.VirtualRouterListener.http(port); - case appmesh.Protocol.HTTP2: return appmesh.VirtualRouterListener.http2(port); - case appmesh.Protocol.GRPC: return appmesh.VirtualRouterListener.grpc(port); - case appmesh.Protocol.TCP: return appmesh.VirtualRouterListener.tcp(port); - } - } -} diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/assign-public-ip.ts b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/assign-public-ip.ts deleted file mode 100644 index b7501385373b6..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/assign-public-ip.ts +++ /dev/null @@ -1,85 +0,0 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as route53 from '@aws-cdk/aws-route53'; -import { Construct } from 'constructs'; -import { Service } from '../../service'; -import { Container } from '../container'; -import { ServiceExtension, ServiceBuild, EnvironmentCapacityType } from '../extension-interfaces'; -import { TaskRecordManager } from './task-record-manager'; - -export interface AssignPublicIpExtensionOptions { - /** - * Enable publishing task public IPs to a recordset in a Route 53 hosted zone. - * - * Note: If you want to change the DNS zone or record name, you will need to - * remove this extension completely and then re-add it. - */ - dns?: AssignPublicIpDnsOptions; -} - -export interface AssignPublicIpDnsOptions { - /** - * A DNS Zone to expose task IPs in. - */ - zone: route53.IHostedZone; - - /** - * Name of the record to add to the zone and in which to add the task IP - * addresses to. - * - * @example 'myservice' - */ - recordName: string; -} - -/** - * Modifies the service to assign a public ip to each task and optionally - * exposes public IPs in a Route 53 record set. - * - * Note: If you want to change the DNS zone or record name, you will need to - * remove this extension completely and then re-add it. - */ -export class AssignPublicIpExtension extends ServiceExtension { - dns?: AssignPublicIpDnsOptions; - - constructor(options?: AssignPublicIpExtensionOptions) { - super('public-ip'); - - this.dns = options?.dns; - } - - private hasDns() { - return Boolean(this.dns); - } - - public prehook(service: Service, _scope: Construct) { - super.prehook(service, _scope); - - if (service.capacityType != EnvironmentCapacityType.FARGATE) { - throw new Error('AssignPublicIp only supports Fargate tasks'); - } - } - - public modifyServiceProps(props: ServiceBuild): ServiceBuild { - return { - ...props, - assignPublicIp: true, - } as ServiceBuild; - } - - public useService(service: ecs.Ec2Service | ecs.FargateService) { - if (this.hasDns()) { - new TaskRecordManager(service, 'TaskRecordManager', { - service: service, - dnsZone: this.dns!.zone, - dnsRecordName: this.dns!.recordName, - }); - - const container = this.parentService.serviceDescription.get('service-container') as Container; - service.connections.allowFromAnyIpv4( - ec2.Port.tcp(container.trafficPort), - 'Accept inbound traffic on traffic port from anywhere', - ); - } - } -} diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/index.ts b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/index.ts deleted file mode 100644 index 81a5e787e9ab9..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './assign-public-ip'; diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/.style.yapf b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/.style.yapf deleted file mode 100644 index 72e1005523a92..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/.style.yapf +++ /dev/null @@ -1,6 +0,0 @@ -# Format using: yapf -ri . -# Since you're here, unit test using: python -m unittest discover -[style] -based_on_style = pep8 -column_limit = 120 -SPLIT_BEFORE_NAMED_ASSIGNS = False diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/Pipfile b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/Pipfile deleted file mode 100644 index 27927581bc218..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/Pipfile +++ /dev/null @@ -1,14 +0,0 @@ -[[source]] -url = "https://pypi.python.org/simple" -verify_ssl = true -name = "pypi" - -[packages] - -[dev-packages] -yapf = "*" -boto3 = "*" -coverage = "*" - -[requires] -python_version = "3.8" diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/Pipfile.lock b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/Pipfile.lock deleted file mode 100644 index 37b1c47e3d5e7..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/Pipfile.lock +++ /dev/null @@ -1,138 +0,0 @@ -{ - "_meta": { - "hash": { - "sha256": "62f31cd5a0266aa03d564dff455c3c2fd49b3e086ede177a42d574a15789fbda" - }, - "pipfile-spec": 6, - "requires": { - "python_version": "3.8" - }, - "sources": [ - { - "name": "pypi", - "url": "https://pypi.python.org/simple", - "verify_ssl": true - } - ] - }, - "default": {}, - "develop": { - "boto3": { - "hashes": [ - "sha256:76b3ee0d1dd860c9218bc864cd29f1ee986f6e1e75e8669725dd3c411039379e", - "sha256:c39cb6ed376ba1d4689ac8f6759a2b2d8a0b0424dbec0cd3af1558079bcf06e8" - ], - "index": "pypi", - "version": "==1.20.23" - }, - "botocore": { - "hashes": [ - "sha256:640b62110aa6d1c25553eceafb5bcd89aedeb84b191598d1f6492ad24374d285", - "sha256:7459766c4594f3b8877e8013f93f0dc6c6486acbeb7d9c9ae488396529cc2e84" - ], - "markers": "python_version >= '3.6'", - "version": "==1.23.23" - }, - "coverage": { - "hashes": [ - "sha256:01774a2c2c729619760320270e42cd9e797427ecfddd32c2a7b639cdc481f3c0", - "sha256:03b20e52b7d31be571c9c06b74746746d4eb82fc260e594dc662ed48145e9efd", - "sha256:0a7726f74ff63f41e95ed3a89fef002916c828bb5fcae83b505b49d81a066884", - "sha256:1219d760ccfafc03c0822ae2e06e3b1248a8e6d1a70928966bafc6838d3c9e48", - "sha256:13362889b2d46e8d9f97c421539c97c963e34031ab0cb89e8ca83a10cc71ac76", - "sha256:174cf9b4bef0db2e8244f82059a5a72bd47e1d40e71c68ab055425172b16b7d0", - "sha256:17e6c11038d4ed6e8af1407d9e89a2904d573be29d51515f14262d7f10ef0a64", - "sha256:215f8afcc02a24c2d9a10d3790b21054b58d71f4b3c6f055d4bb1b15cecce685", - "sha256:22e60a3ca5acba37d1d4a2ee66e051f5b0e1b9ac950b5b0cf4aa5366eda41d47", - "sha256:2641f803ee9f95b1f387f3e8f3bf28d83d9b69a39e9911e5bfee832bea75240d", - "sha256:276651978c94a8c5672ea60a2656e95a3cce2a3f31e9fb2d5ebd4c215d095840", - "sha256:3f7c17209eef285c86f819ff04a6d4cbee9b33ef05cbcaae4c0b4e8e06b3ec8f", - "sha256:3feac4084291642165c3a0d9eaebedf19ffa505016c4d3db15bfe235718d4971", - "sha256:49dbff64961bc9bdd2289a2bda6a3a5a331964ba5497f694e2cbd540d656dc1c", - "sha256:4e547122ca2d244f7c090fe3f4b5a5861255ff66b7ab6d98f44a0222aaf8671a", - "sha256:5829192582c0ec8ca4a2532407bc14c2f338d9878a10442f5d03804a95fac9de", - "sha256:5d6b09c972ce9200264c35a1d53d43ca55ef61836d9ec60f0d44273a31aa9f17", - "sha256:600617008aa82032ddeace2535626d1bc212dfff32b43989539deda63b3f36e4", - "sha256:619346d57c7126ae49ac95b11b0dc8e36c1dd49d148477461bb66c8cf13bb521", - "sha256:63c424e6f5b4ab1cf1e23a43b12f542b0ec2e54f99ec9f11b75382152981df57", - "sha256:6dbc1536e105adda7a6312c778f15aaabe583b0e9a0b0a324990334fd458c94b", - "sha256:6e1394d24d5938e561fbeaa0cd3d356207579c28bd1792f25a068743f2d5b282", - "sha256:86f2e78b1eff847609b1ca8050c9e1fa3bd44ce755b2ec30e70f2d3ba3844644", - "sha256:8bdfe9ff3a4ea37d17f172ac0dff1e1c383aec17a636b9b35906babc9f0f5475", - "sha256:8e2c35a4c1f269704e90888e56f794e2d9c0262fb0c1b1c8c4ee44d9b9e77b5d", - "sha256:92b8c845527eae547a2a6617d336adc56394050c3ed8a6918683646328fbb6da", - "sha256:9365ed5cce5d0cf2c10afc6add145c5037d3148585b8ae0e77cc1efdd6aa2953", - "sha256:9a29311bd6429be317c1f3fe4bc06c4c5ee45e2fa61b2a19d4d1d6111cb94af2", - "sha256:9a2b5b52be0a8626fcbffd7e689781bf8c2ac01613e77feda93d96184949a98e", - "sha256:a4bdeb0a52d1d04123b41d90a4390b096f3ef38eee35e11f0b22c2d031222c6c", - "sha256:a9c8c4283e17690ff1a7427123ffb428ad6a52ed720d550e299e8291e33184dc", - "sha256:b637c57fdb8be84e91fac60d9325a66a5981f8086c954ea2772efe28425eaf64", - "sha256:bf154ba7ee2fd613eb541c2bc03d3d9ac667080a737449d1a3fb342740eb1a74", - "sha256:c254b03032d5a06de049ce8bca8338a5185f07fb76600afff3c161e053d88617", - "sha256:c332d8f8d448ded473b97fefe4a0983265af21917d8b0cdcb8bb06b2afe632c3", - "sha256:c7912d1526299cb04c88288e148c6c87c0df600eca76efd99d84396cfe00ef1d", - "sha256:cfd9386c1d6f13b37e05a91a8583e802f8059bebfccde61a418c5808dea6bbfa", - "sha256:d5d2033d5db1d58ae2d62f095e1aefb6988af65b4b12cb8987af409587cc0739", - "sha256:dca38a21e4423f3edb821292e97cec7ad38086f84313462098568baedf4331f8", - "sha256:e2cad8093172b7d1595b4ad66f24270808658e11acf43a8f95b41276162eb5b8", - "sha256:e3db840a4dee542e37e09f30859f1612da90e1c5239a6a2498c473183a50e781", - "sha256:edcada2e24ed68f019175c2b2af2a8b481d3d084798b8c20d15d34f5c733fa58", - "sha256:f467bbb837691ab5a8ca359199d3429a11a01e6dfb3d9dcc676dc035ca93c0a9", - "sha256:f506af4f27def639ba45789fa6fde45f9a217da0be05f8910458e4557eed020c", - "sha256:f614fc9956d76d8a88a88bb41ddc12709caa755666f580af3a688899721efecd", - "sha256:f9afb5b746781fc2abce26193d1c817b7eb0e11459510fba65d2bd77fe161d9e", - "sha256:fb8b8ee99b3fffe4fd86f4c81b35a6bf7e4462cba019997af2fe679365db0c49" - ], - "index": "pypi", - "version": "==6.2" - }, - "jmespath": { - "hashes": [ - "sha256:b85d0567b8666149a93172712e68920734333c0ce7e89b78b3e987f71e5ed4f9", - "sha256:cdf6525904cc597730141d61b36f2e4b8ecc257c420fa2f4549bac2c2d0cb72f" - ], - "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==0.10.0" - }, - "python-dateutil": { - "hashes": [ - "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86", - "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==2.8.2" - }, - "s3transfer": { - "hashes": [ - "sha256:50ed823e1dc5868ad40c8dc92072f757aa0e653a192845c94a3b676f4a62da4c", - "sha256:9c1dc369814391a6bda20ebbf4b70a0f34630592c9aa520856bf384916af2803" - ], - "markers": "python_version >= '3.6'", - "version": "==0.5.0" - }, - "six": { - "hashes": [ - "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926", - "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==1.16.0" - }, - "urllib3": { - "hashes": [ - "sha256:4987c65554f7a2dbf30c18fd48778ef124af6fab771a377103da0585e2336ece", - "sha256:c4fdf4019605b6e5423637e01bc9fe4daef873709a7973e195ceba0a62bbc844" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'", - "version": "==1.26.7" - }, - "yapf": { - "hashes": [ - "sha256:408fb9a2b254c302f49db83c59f9aa0b4b0fd0ec25be3a5c51181327922ff63d", - "sha256:e3a234ba8455fe201eaa649cdac872d590089a18b661e39bbac7020978dd9c2e" - ], - "index": "pypi", - "version": "==0.31.0" - } - } -} diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/index.py b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/index.py deleted file mode 100644 index 790102022efed..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/index.py +++ /dev/null @@ -1,34 +0,0 @@ -import logging -import os - -import boto3 - -from lib.cleanup_resource_handler import CleanupResourceHandler -from lib.queue_handler import QueueHandler - -logging.getLogger().setLevel(logging.INFO) - - -def queue_handler(event, context): - """ - Handler for the event queue lambda trigger - """ - - ec2_client = boto3.client('ec2') - dynamodb_resource = boto3.resource('dynamodb') - route53_client = boto3.client('route53') - - handler = QueueHandler(ec2_client=ec2_client, dynamodb_resource=dynamodb_resource, route53_client=route53_client, - environ=os.environ) - - return handler.handle(event, context) - - -def cleanup_resource_handler(event, context): - """ - Event handler for the custom resource. - """ - - route53_client = boto3.client('route53') - handler = CleanupResourceHandler(route53_client=route53_client) - handler.handle_event(event, context) diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/lib/__init__.py b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/lib/__init__.py deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/lib/cleanup_resource_handler.py b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/lib/cleanup_resource_handler.py deleted file mode 100644 index 1ffde51b261c0..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/lib/cleanup_resource_handler.py +++ /dev/null @@ -1,51 +0,0 @@ -import time -from dataclasses import dataclass -import logging -from typing import Any - -from lib.route53 import Route53RecordSetAccessor, Route53RecordSetLocator - - -@dataclass -class CleanupResourceProperties: - HostedZoneId: str - RecordName: str - ServiceToken: str - - -class CleanupResourceHandler: - route53_client: Any - monitor_interval: int - - def __init__(self, route53_client, monitor_interval=5): - self.record_set_accessor = Route53RecordSetAccessor(route53_client=route53_client) - self.monitor_interval = monitor_interval - - def handle_event(self, event, context): - request_type = event['RequestType'] - resource_properties = event['ResourceProperties'] - logging.info(f'Handling a {request_type} event with properties {resource_properties}') - - # Decode resource properties right away so that mis-configured - # properties will always fail quickly. - resource_properties = CleanupResourceProperties(**resource_properties) - - if request_type == 'Delete': - return self.on_delete(resource_properties) - - def on_delete(self, resource_properties: CleanupResourceProperties): - locator = Route53RecordSetLocator(hosted_zone_id=resource_properties.HostedZoneId, - record_name=resource_properties.RecordName) - - deleted = self.record_set_accessor.delete(locator=locator) - - if deleted: - logging.info(f'Monitoring for the record deletion') - for interval_number in range(1, 10): - if not self.record_set_accessor.exists(locator): - logging.info(f'The record has been deleted') - return - else: - logging.info(f'The record still exists') - if self.monitor_interval > 0: - time.sleep(self.monitor_interval) diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/lib/events.py b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/lib/events.py deleted file mode 100644 index aa34343a00170..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/lib/events.py +++ /dev/null @@ -1,15 +0,0 @@ -from lib.records import TaskInfo, EniInfo - - -def extract_event_task_info(task_description) -> TaskInfo: - arn = task_description['taskArn'] - - # Parse the eni info out of the the attachments - enis = [ - EniInfo(eni_id=detail['value']) for network_interface in task_description['attachments'] - if network_interface['type'] == 'eni' for detail in network_interface['details'] - if detail['name'] == 'networkInterfaceId' - ] - - # Create an object out of the extracted information - return TaskInfo(task_arn=arn, enis=enis) \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/lib/queue_handler.py b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/lib/queue_handler.py deleted file mode 100644 index db56b4c898264..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/lib/queue_handler.py +++ /dev/null @@ -1,117 +0,0 @@ -import json -import logging -from typing import Any - -from lib.events import extract_event_task_info -from lib.records import DdbRecordKey, DdbRecord -from lib.records_table import RecordsTableAccessor, RecordUpdate -from lib.route53 import Route53RecordSetLocator, Route53RecordSetAccessor -from lib.running_task_collector import RunningTaskCollector - - -class QueueHandler: - def __init__(self, ec2_client, route53_client, dynamodb_resource, environ): - self.ec2_client = ec2_client - self.route53_client = route53_client - - hosted_zone_id = environ['HOSTED_ZONE_ID'] - record_name = environ['RECORD_NAME'] - records_table = environ['RECORDS_TABLE'] - - cluster_arn = environ['CLUSTER_ARN'] - self.service_name = environ['SERVICE_NAME'] - - self.records_table_key = DdbRecordKey(cluster_arn=cluster_arn, service_name=self.service_name) - self.records_table_accessor = RecordsTableAccessor(table_client=dynamodb_resource.Table(records_table)) - - self.record_set_locator = Route53RecordSetLocator(hosted_zone_id=hosted_zone_id, record_name=record_name) - self.record_set_accessor = Route53RecordSetAccessor(route53_client=self.route53_client) - - def handle(self, event, context): - logging.info(f'event = {json.dumps(event)}') - - # Get a reference record from the records table to check for incoming - # event inconsistencies. - reference_record = self.records_table_accessor.get_record(self.records_table_key) - - # Collect running and stopped tasks from the status change events - running_tasks, stopped_tasks = self.collect_event_task_info(event, reference_record) - - # Build up a set of updates for the record - update = RecordUpdate(running_tasks=running_tasks, stopped_tasks=stopped_tasks) - - # Record the current record set locator - update.current_record_set(self.record_set_locator) - - # Clean any extra record sets in case the recordset has moved. - for record_set_locator in reference_record.record_sets: - if not record_set_locator.matches(self.record_set_locator): - update.extra_record_set(record_set_locator) - self.try_to_delete_record(record_set_locator) - - # Introduce some delay - # records_table.optimistic_simulation_delay = 5 - - # Update the record - ddb_record = self.records_table_accessor.put_update(key=self.records_table_key, update=update) - - # Update DNS - self.record_set_accessor.update(locator=self.record_set_locator, ipv4s=ddb_record.ipv4s) - - def collect_event_task_info(self, event, reference_record: DdbRecord): - running_task_collector = RunningTaskCollector(ec2_client=self.ec2_client, reference_record=reference_record) - stopped_tasks = [] - for message in decode_records(event): - if 'details' not in message: - logging.info(f'Received a non-task state message {message}') - continue - - task_description = message['details'] - - group = task_description['group'] - if group != f'service:{self.service_name}': - logging.info(f'Skipping irrelevant task description from group {group}') - continue - - task_info = extract_event_task_info(task_description) - logging.info(f'extracted task_info = {task_info}') - - last_status = task_description['lastStatus'] - if last_status == 'RUNNING': - logging.info(f'Collecting {task_info.task_arn} as running') - running_task_collector.collect(task_info) - - elif last_status == 'STOPPED': - logging.info(f'Collecting {task_info.task_arn} as stopped') - stopped_tasks.append(task_info) - - else: - logging.warning(f'{task_info.task_arn} had an unexpected status: {last_status}') - - # Query the ENIs store-back public IPs. - running_task_collector.fill_eni_info_from_eni_query() - - running_tasks = running_task_collector.tasks - - return running_tasks, stopped_tasks - - def try_to_delete_record(self, record_set_locator: Route53RecordSetLocator): - """ - Try to delete the given record set. This may not be possible if the - record is in a hosted zone we don't have access to. This may happen - when the user changes dns zones at the service extension level. - """ - - try: - self.record_set_accessor.delete(record_set_locator) - - except: - # We give up pretty easily if the record set accessor can't delete - # the extraneous record for any reason that the accessor can't - # handle. - logging.warning(f'Could not delete the extraneous record set {record_set_locator}') - - -def decode_records(sqs_event): - logging.info(f'sqs_event = {json.dumps(sqs_event)}') - return [json.loads(sqs_record['body']) for sqs_record in sqs_event['Records']] diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/lib/records.py b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/lib/records.py deleted file mode 100644 index a6a1f2a374ab0..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/lib/records.py +++ /dev/null @@ -1,185 +0,0 @@ -from dataclasses import dataclass, field -from datetime import datetime -from typing import Optional, List, Dict, Set - -from boto3.dynamodb.conditions import Key - -from lib.route53 import Route53RecordSetLocator - - -@dataclass -class EniInfo: - eni_id: str - public_ipv4: Optional[str] = None - - -@dataclass -class TaskInfo: - task_arn: str - enis: List[EniInfo] - stopped_datetime: Optional[datetime] = None - - # Tombstone information for the dynamodb record. - - def set_stopped_marker(self): - """ - Mark this task as stopped. - """ - self.stopped_datetime = datetime.utcnow() - - def is_stopped(self): - """ - Check if this task is stopped. - """ - return True if self.stopped_datetime is not None else False - - -@dataclass -class DdbRecordKey: - cluster_arn: str - service_name: str - - def to_composite(self): - return f'{self.cluster_arn}#{self.service_name}' - - @staticmethod - def from_composite(composite: str): - cluster_arn, service_name = composite.split('#') - return DdbRecordKey(cluster_arn=cluster_arn, service_name=service_name) - - -@dataclass -class DdbRecord: - key: DdbRecordKey - ipv4s: Set[str] = field(default_factory=set) - task_info: Dict[str, TaskInfo] = field(default_factory=dict) - record_sets: Set[Route53RecordSetLocator] = field(default_factory=set) - version: int = 0 - - def task_is_stopped(self, task_info: TaskInfo): - """ - Check if a task has already stopped. - """ - - return task_info.task_arn in self.task_info and self.task_info[task_info.task_arn].is_stopped() - - -class DdbRecordEncoding: - PK_NAME = 'cluster_service' - ATTR_VERSION = 'version' - ATTR_IPV4S = 'ipv4s' - ATTR_TASK_INFO = 'task_info' - ATTR_TASK_ARN = 'task_arn' - ATTR_TASK_ENIS = 'enis' - ATTR_TASK_STOPPED_DATETIME = 'stopped_datetime' - ATTR_ENI_ID = 'eni_id' - ATTR_ENI_PUBLIC_IPV4 = 'public_ipv4' - ATTR_RECORD_SETS = 'record_sets' - ATTR_RECORD_SET_ZONE = 'hosted_zone_id' - ATTR_RECORD_SET_NAME = 'record_name' - - def get_identity(self, key: DdbRecordKey): - return {self.PK_NAME: key.to_composite()} - - def get_identity_expression(self, key: DdbRecordKey): - return Key(self.PK_NAME).eq(key.to_composite()) - - def encode(self, record: DdbRecord) -> dict: - data = dict() - data[self.PK_NAME] = record.key.to_composite() - data[self.ATTR_VERSION] = record.version - - if len(record.ipv4s) > 0: - # Sorting only matters here for repeatability in tests, as set ordering - # isn't easily predictable. - data[self.ATTR_IPV4S] = [v for v in sorted(record.ipv4s)] - - if len(record.record_sets) > 0: - data[self.ATTR_RECORD_SETS] = [self.encode_record_set(v) for v in sorted(record.record_sets)] - - if len(record.task_info) > 0: - data[self.ATTR_TASK_INFO] = { - task_info.task_arn: self.encode_task_info(task_info) - for task_info in record.task_info.values() - } - - return data - - def encode_record_set(self, record_set: Route53RecordSetLocator): - return { - self.ATTR_RECORD_SET_ZONE: record_set.hosted_zone_id, - self.ATTR_RECORD_SET_NAME: record_set.record_name, - } - - def encode_task_info(self, task_info: TaskInfo) -> dict: - data = dict() - data[self.ATTR_TASK_ARN] = task_info.task_arn - - if task_info.stopped_datetime is not None: - data[self.ATTR_TASK_STOPPED_DATETIME] = task_info.stopped_datetime.isoformat() - - if len(task_info.enis) > 0: - data[self.ATTR_TASK_ENIS] = [self.encode_eni_info(eni_info) for eni_info in task_info.enis] - - return data - - def encode_eni_info(self, eni_info: EniInfo) -> dict: - data = dict() - data[self.ATTR_ENI_ID] = eni_info.eni_id - if eni_info.public_ipv4 is not None: - data[self.ATTR_ENI_PUBLIC_IPV4] = eni_info.public_ipv4 - - return data - - def decode(self, data: dict) -> DdbRecord: - key = DdbRecordKey.from_composite(data[self.PK_NAME]) - version = int(data[self.ATTR_VERSION]) - - ipv4s = set() - if self.ATTR_IPV4S in data: - ipv4s = {ip for ip in data[self.ATTR_IPV4S]} - - record_sets = set() - if self.ATTR_RECORD_SETS in data: - for record_set_data in data[self.ATTR_RECORD_SETS]: - record_set = self.decode_record_set(record_set_data) - record_sets.add(record_set) - - task_info = dict() - if self.ATTR_TASK_INFO in data: - task_info = { - k: self.decode_task_info(task_info_data) - for (k, task_info_data) in data[self.ATTR_TASK_INFO].items() - } - - record = DdbRecord(key=key, version=version, ipv4s=ipv4s, task_info=task_info, record_sets=record_sets) - - return record - - def decode_record_set(self, data) -> Route53RecordSetLocator: - hosted_zone_id = data[self.ATTR_RECORD_SET_ZONE] - record_name = data[self.ATTR_RECORD_SET_NAME] - - return Route53RecordSetLocator(hosted_zone_id=hosted_zone_id, record_name=record_name) - - def decode_task_info(self, data) -> TaskInfo: - task_arn = data[self.ATTR_TASK_ARN] - - stopped_datetime = None - if self.ATTR_TASK_STOPPED_DATETIME in data: - stopped_datetime = datetime.fromisoformat(data[self.ATTR_TASK_STOPPED_DATETIME]) - - enis = [] - if self.ATTR_TASK_ENIS in data: - enis = [self.decode_eni_info(eni_info_data) for eni_info_data in data[self.ATTR_TASK_ENIS]] - - return TaskInfo(task_arn=task_arn, stopped_datetime=stopped_datetime, enis=enis) - - def decode_eni_info(self, data) -> EniInfo: - eni_id = data[self.ATTR_ENI_ID] - - public_ipv4 = None - if self.ATTR_ENI_PUBLIC_IPV4 in data: - public_ipv4 = data[self.ATTR_ENI_PUBLIC_IPV4] - - return EniInfo(eni_id=eni_id, public_ipv4=public_ipv4) diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/lib/records_table.py b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/lib/records_table.py deleted file mode 100644 index 390ef0066dde5..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/lib/records_table.py +++ /dev/null @@ -1,215 +0,0 @@ -import logging -import time -from dataclasses import dataclass, field -from datetime import datetime, timedelta -from typing import * - -from boto3.dynamodb.conditions import Attr -from botocore.exceptions import ClientError - -from lib.records import DdbRecord, DdbRecordKey, DdbRecordEncoding, TaskInfo -from lib.route53 import Route53RecordSetLocator - - -@dataclass -class RecordUpdate: - running_tasks: List[TaskInfo] = field(default_factory=list) - stopped_tasks: List[TaskInfo] = field(default_factory=list) - record_sets_added: List[Route53RecordSetLocator] = field(default_factory=list) - record_sets_removed: List[Route53RecordSetLocator] = field(default_factory=list) - - def current_record_set(self, record_set: Route53RecordSetLocator): - self.record_sets_added.append(record_set) - - def extra_record_set(self, record_set: Route53RecordSetLocator): - self.record_sets_removed.append(record_set) - - -class RecordsTableAccessor: - """ - Abstracts management of the task records to putting running and stopped tasks. - """ - - table_client: Any - ddb_record_encoding: DdbRecordEncoding - - # Max number of attempts at optimistic put_tasks - max_attempts = 50 - - # Amount of lag to add (if any) to simulate concurrent locking conflicts in - # lambda - optimistic_simulation_delay = 0 - - def __init__(self, table_client): - """ - Initializes a RecordsTable. Provide a boto3.resource - """ - self.table_client = table_client - self.ddb_record_encoding = DdbRecordEncoding() - - def delete(self, key: DdbRecordKey): - """ - Delete a record by record key. - """ - - logging.info(f'Deleting {key}') - self.table_client.delete_item(Key=self.ddb_record_encoding.get_identity(key)) - - def put_update(self, key: DdbRecordKey, update: RecordUpdate) -> DdbRecord: - """ - Retries putting tasks into the table record with optimistic locking. - """ - - for attempt in range(0, self.max_attempts): - try: - logging.info(f'Attempting to put the task optimistically (attempt {attempt+1})') - return self.put_update_optimistically(key=key, update=update) - except ClientError as e: - if e.response['Error']['Code'] == 'ConditionalCheckFailedException': - logging.info(f'Check condition was rejected') - continue - else: - raise - - # Ran out of retries!! - raise Exception('Exceeded maximum retries while optimistically putting changes') - - def get_record(self, key: DdbRecordKey) -> DdbRecord: - """ - Gets the record by key or provides a blank record. - """ - - # Search for the pertinent record - response = self.table_client.query(KeyConditionExpression=self.ddb_record_encoding.get_identity_expression(key)) - - if len(response['Items']) > 0: - # Decode a pre-existing record - logging.info(f'Found a pre-existing record') - return self.ddb_record_encoding.decode(response['Items'][0]) - else: - logging.info(f'Creating a new record') - # Create a new record - return DdbRecord(key=key) - - def put_update_optimistically(self, key: DdbRecordKey, update: RecordUpdate) -> DdbRecord: - """ - Optimistically record running and stopped tasks for this record. - """ - - ddb_record = self.get_record(key=key) - - # Add some lag (if any) to simulate concurrent locking conflicts in lambda - if self.optimistic_simulation_delay > 0: - time.sleep(self.optimistic_simulation_delay) - - # Update the record with the running and stopped task info - update_ddb_record(ddb_record=ddb_record, update=update) - - # Optimistic locking condition - optimistic_lock_condition = Attr(self.ddb_record_encoding.ATTR_VERSION).not_exists() \ - | Attr(self.ddb_record_encoding.ATTR_VERSION).eq(ddb_record.version) - - # Prepare the record for updating - ddb_record.version += 1 - item = self.ddb_record_encoding.encode(ddb_record) - - # Put it up - self.table_client.put_item(Item=item, ConditionExpression=optimistic_lock_condition) - - return ddb_record - - -def update_ddb_record(ddb_record: DdbRecord, update: RecordUpdate) -> DdbRecord: - """ - Updates a DynamoDB record with the list of running and stopped tasks. - """ - - # Add the record sets we want to add - for record_set in update.record_sets_added: - ddb_record.record_sets.add(record_set) - - # Remove the ones we want to remove - for record_set in update.record_sets_removed: - if record_set in ddb_record.record_sets: - ddb_record.record_sets.remove(record_set) - - # Add running task info to the record - for running_task in update.running_tasks: - # Don't add a task as running when it previously stopped (out-of-order receive) - if running_task.task_arn in ddb_record.task_info and ddb_record.task_info[running_task.task_arn].is_stopped(): - logging.info( - f'Received {running_task.task_arn} transition to RUNNING, but it was already stopped. Ignored.') - continue - - # Record info about the running task - ddb_record.task_info[running_task.task_arn] = running_task - - # Add all public ips to the public ip set - for eni in running_task.enis: - if eni.public_ipv4 is not None: - ddb_record.ipv4s.add(eni.public_ipv4) - - logging.info(f'Recorded {running_task.task_arn} as RUNNING.') - - # Remove stopped task ips from the record and set "stopped" markers on the - # stored task info. - for stopped_task in update.stopped_tasks: - # When the stopped task was previously represented in the task info list, - # then we fetch the old representation for its potential ip address info. - if stopped_task.task_arn in ddb_record.task_info: - task_arn = stopped_task.task_arn - stored_task = ddb_record.task_info[task_arn] - - # When the task is not yet marked as stopped, we need to mark it as such - # and remove its eni ips from the ip list. - if not stored_task.is_stopped(): - stored_task.set_stopped_marker() - - for eni in stored_task.enis: - if eni.public_ipv4 is not None and eni.public_ipv4 in ddb_record.ipv4s: - ddb_record.ipv4s.remove(eni.public_ipv4) - - logging.info(f'Recorded {task_arn} as STOPPED.') - - else: - # Stored task already marked as stopped, so the received task is a - # duplicate. Ignore it. - logging.info(f'Received {task_arn} which was already STOPPED. Ignoring.') - pass - - else: - # Stopped task isn't in the task list, so we've received an out-of-order - # STOPPED transition. We don't know this task, but we know that if we - # receive a running task in the future, that we don't want to accept it. - stopped_task.set_stopped_marker() - ddb_record.task_info[stopped_task.task_arn] = stopped_task - logging.info(f'Recorded {stopped_task.task_arn} as STOPPED even though we have never seen it.') - - # Expunge expired tasks. Use a copy of the dict items to avoid errors from the - # dictionary changing while iterating. - for (key, task) in list(ddb_record.task_info.items()): - if task_info_has_expired(task): - logging.info(f'Expunging {task.task_arn} as expired.') - del ddb_record.task_info[key] - - return ddb_record - - -# The the length of time that a task marked as stopped may continue to exist -# in the task info list before it is expunged. -STOPPED_MARKER_EXPIRATION = timedelta(minutes=30) - - -def task_info_has_expired(task_info: TaskInfo): - """ - Determine if this task info can be deleted from the DDB record. If the task - has stopped and the stopped marker expiration has elapsed, then we can - delete, otherwise the task info must be kept to filter out-of-order duplicate - RUNNING state transition events. - """ - - if not task_info.is_stopped(): - return False - - stopped_marker_age = datetime.utcnow() - task_info.stopped_datetime - return True if stopped_marker_age > STOPPED_MARKER_EXPIRATION else False diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/lib/route53.py b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/lib/route53.py deleted file mode 100644 index df3b23c76a1fe..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/lib/route53.py +++ /dev/null @@ -1,167 +0,0 @@ -from dataclasses import dataclass -import time -from typing import * -import logging - -from botocore.exceptions import ClientError - - -@dataclass -class Route53RecordSetLocator: - hosted_zone_id: str - record_name: str - - def __str__(self): - """String serialization for hashing and comparison""" - return f'{self.hosted_zone_id}#{self.record_name}' - - def __hash__(self): - """Unique hash for this object is based on its string serialization""" - return int.from_bytes(self.__str__().encode(), 'little') - - def __lt__(self, other): - """set() uses this""" - return self.__str__() < other.__str__() - - def get_dot_suffixed_name(self): - return self.record_name + '.' - - def matches_record_set(self, record_set): - return record_set['Name'] == self.get_dot_suffixed_name() - - def matches(self, record_set_locator): - return self.record_name == record_set_locator.record_name and self.hosted_zone_id == record_set_locator.hosted_zone_id - - -class Route53RecordSetAccessor: - route53_client: Any - ttl = 60 - - def __init__(self, route53_client: Any): - self.route53_client = route53_client - - def update(self, locator: Route53RecordSetLocator, ipv4s: Set[str] = None): - ipv4s = set() if ipv4s is None else ipv4s - - record_set, is_new = retry_with_backoff(lambda: self.get_record_set(locator)) - if is_new: - logging.info(f'Found a pre-existing record set: {record_set}') - else: - logging.info('Creating a new record set') - - if len(ipv4s) > 0: - record_set['ResourceRecords'] = map_ips_to_resource_records(ipv4s) - retry_with_backoff(lambda: self.request_upsert(locator, record_set)) - elif not is_new: - retry_with_backoff(lambda: self.request_delete(locator, record_set)) - else: - logging.info('Refusing to do anything with a new but empty recordset') - - def get_record_set(self, locator: Route53RecordSetLocator) -> Tuple[dict, bool]: - record_type = 'A' - result = self.route53_client.list_resource_record_sets(HostedZoneId=locator.hosted_zone_id, - StartRecordName=locator.record_name, - StartRecordType=record_type, MaxItems="1") - - logging.info(f'Query result: {result}') - existing_record_set = find_locator_record_set(locator, record_type, result['ResourceRecordSets']) - if existing_record_set: - return existing_record_set, False - else: - return { - 'Name': locator.get_dot_suffixed_name(), - 'Type': record_type, - 'ResourceRecords': [], - 'TTL': self.ttl - }, True - - def request_upsert(self, locator: Route53RecordSetLocator, record_set): - logging.info(f'Upserting record set {record_set}') - self.route53_client.change_resource_record_sets( - HostedZoneId=locator.hosted_zone_id, ChangeBatch={ - 'Comment': 'Automatic', - 'Changes': [{ - 'Action': 'UPSERT', - 'ResourceRecordSet': record_set - }] - }) - - def delete(self, locator: Route53RecordSetLocator): - """ - Delete the record. Returns true if it found and deleted the record. - Returns false if it didn't need to delete anything. - """ - - logging.info(f'Querying for {locator}') - record_set, is_new = retry_with_backoff(lambda: self.get_record_set(locator)) - - if not is_new: - logging.info(f'Found a record set') - retry_with_backoff(lambda: self.request_delete(locator, record_set)) - logging.info(f'Deleted record set {record_set}') - return True - - else: - logging.info(f'Did not find a record set, so no deletion needed') - return False - - def exists(self, locator: Route53RecordSetLocator): - """ - Returns true if the record exists. False otherwise. - """ - - _, is_new = retry_with_backoff(lambda: self.get_record_set(locator)) - - return not is_new - - def request_delete(self, locator: Route53RecordSetLocator, record_set): - logging.info(f'Deleting record set: {record_set}') - self.route53_client.change_resource_record_sets( - HostedZoneId=locator.hosted_zone_id, ChangeBatch={ - 'Comment': 'Automatic', - 'Changes': [{ - 'Action': 'DELETE', - 'ResourceRecordSet': record_set, - }] - }) - - -def exponential_backoff(attempt: int): - return 2**attempt - - -def retry_with_backoff(call: Callable, attempts=5, backoff=exponential_backoff): - for attempt in range(0, attempts): - try: - return call() - - except ClientError as e: - if e.response['Error']['Code'] == 'Throttling': - backoff_seconds = backoff(attempt) - logging.info(f'Attempt {attempt+1} throttled. Backing off for {backoff_seconds}.') - time.sleep(backoff_seconds) - continue - - if e.response['Error']['Code'] == 'PriorRequestNotComplete': - backoff_seconds = backoff(attempt) - logging.info( - f'Attempt {attempt+1} discovered the prior request is not yet complete. Backing off for {backoff_seconds}.' - ) - time.sleep(backoff_seconds) - continue - - raise - - -def map_ips_to_resource_records(ips: Set[str]): - # Take up to the first 400 ips after sorting as the max recordset record quota is 400 - ips_sorted_limited = sorted(ips)[0:400] - return [{'Value': ip} for ip in ips_sorted_limited] - - -def find_locator_record_set(locator: Route53RecordSetLocator, record_type: str, record_sets: list): - for record_set in record_sets: - if locator.matches_record_set(record_set) and record_set['Type'] == record_type: - return record_set - - return None diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/lib/running_task_collector.py b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/lib/running_task_collector.py deleted file mode 100644 index a7034d81e5e53..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/lib/running_task_collector.py +++ /dev/null @@ -1,57 +0,0 @@ -import logging -from typing import * - -from lib.records import DdbRecord, EniInfo, TaskInfo - - -class RunningTaskCollector: - """ - Collects information about running tasks. After collecting all task info, - when `fill_eni_info_from_eni_query()` is called, the collector queries - for the ip addresses of the tasks and fills in the appropriate records. - """ - - ec2_client: Any - tasks: List[TaskInfo] - enis_by_id: Dict[str, EniInfo] - - def __init__(self, ec2_client, reference_record: DdbRecord): - self.ec2_client = ec2_client - self.tasks = list() - self.enis_by_id = dict() - self.reference_record = reference_record - - def collect(self, task_info): - # Check to see if the task we've received is already stopped. If so, - # we refuse to collect it on the basis that we'll just get an eni - # doesn't exist error anyway. - if self.reference_record.task_is_stopped(task_info): - logging.info(f'Refusing to collect {task_info.task_arn} as it has already been deleted') - return - - # Append the task info to the master list - self.tasks.append(task_info) - - # Collect enis indexed by their ids - for eni in task_info.enis: - self.enis_by_id[eni.eni_id] = eni - - def fill_eni_info_from_eni_query(self): - for eni_description in self.describe_enis(): - eni_id = eni_description['NetworkInterfaceId'] - - if 'Association' in eni_description: - public_ipv4 = eni_description['Association']['PublicIp'] - if public_ipv4 and eni_id in self.enis_by_id: - self.enis_by_id[eni_id].public_ipv4 = public_ipv4 - - def describe_enis(self): - paginator = self.ec2_client.get_paginator('describe_network_interfaces') - - eni_ids = list(self.enis_by_id.keys()) - for page in paginator.paginate(NetworkInterfaceIds=eni_ids): - for eni in page['NetworkInterfaces']: - yield eni - - def get_ips(self): - return [eni.public_ipv4 for eni in self.enis_by_id.values()] diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/run_test.py b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/run_test.py deleted file mode 100644 index 7efd5dc08534d..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/run_test.py +++ /dev/null @@ -1,5 +0,0 @@ -import unittest - -if __name__ == "__main__": - test_suite = unittest.defaultTestLoader.discover('.') - unittest.TextTestRunner().run(test_suite) diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/__init__.py b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/__init__.py deleted file mode 100644 index 539bac0f9e2aa..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# Keep this file so that python -m unittest discover can find these tests. diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/fixtures/ddb-record.json b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/fixtures/ddb-record.json deleted file mode 100644 index f62cf391abf39..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/fixtures/ddb-record.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "cluster_service": "CLUSTER_ARN#SERVICE", - "ipv4s": [ - "1.1.2.1", - "1.1.2.2" - ], - "task_info": { - "TASK1_ARN": { - "enis": [ - { - "eni_id": "TASK1_ENI1_ID", - "public_ipv4": "1.1.1.1" - } - ], - "stopped_datetime": "2020-10-04T23:47:36.322158", - "task_arn": "TASK1_ARN" - }, - "TASK2_ARN": { - "enis": [ - { - "eni_id": "TASK2_ENI1_ID", - "public_ipv4": "1.1.2.1" - }, - { - "eni_id": "TASK2_ENI2_ID", - "public_ipv4": "1.1.2.2" - } - ], - "task_arn": "TASK2_ARN" - } - }, - "record_sets": [ - { - "hosted_zone_id": "ABCD", - "record_name": "test-record.myexample.com" - }, - { - "hosted_zone_id": "ABCD", - "record_name": "test-record2.myexample.com" - } - ], - "version": 12 -} diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/fixtures/eni_description.json b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/fixtures/eni_description.json deleted file mode 100644 index 9e790e455fb99..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/fixtures/eni_description.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "Association": { - "IpOwnerId": "amazon", - "PublicDnsName": "example.com", - "PublicIp": "1.2.3.4" - }, - "Attachment": { - "AttachTime": "2020-10-03T23:42:51+00:00", - "AttachmentId": "eni-attach-0704671692ecf366b", - "DeleteOnTermination": false, - "DeviceIndex": 1, - "InstanceOwnerId": "000000000", - "Status": "attached" - }, - "AvailabilityZone": "test-region-1a", - "Description": "arn:aws:ecs:test-region-1:0000000000:attachment/20d24cce-3d50-493d-b890-32d4f11859f4", - "Groups": [ - { - "GroupName": "aws-ecs-integ-nameserviceSecurityGroup33F4662C-16PM465FOR8L1", - "GroupId": "sg-0b83d6ad2edd8e940" - } - ], - "InterfaceType": "interface", - "Ipv6Addresses": [], - "MacAddress": "02:a4:cb:74:0f:a8", - "NetworkInterfaceId": "eni-abcd", - "OwnerId": "0000000000", - "PrivateDnsName": "ip-10-0-0-19.test-region-1.compute.internal", - "PrivateIpAddress": "10.0.0.19", - "PrivateIpAddresses": [ - { - "Association": { - "IpOwnerId": "amazon", - "PublicDnsName": "example.com", - "PublicIp": "1.2.3.4" - }, - "Primary": true, - "PrivateDnsName": "ip-10-0-0-19.test-region-1.compute.internal", - "PrivateIpAddress": "10.0.0.19" - } - ], - "RequesterId": "0000000000", - "RequesterManaged": true, - "SourceDestCheck": true, - "Status": "in-use", - "SubnetId": "subnet-036b0d1413bb6bd2c", - "TagSet": [], - "VpcId": "vpc-0e63014e689c4b14f" -} diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/fixtures/task_description.json b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/fixtures/task_description.json deleted file mode 100644 index 7bf19d91893a2..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/fixtures/task_description.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "attachments": [ - { - "id": "", - "type": "eni", - "status": "DELETED", - "details": [ - { - "name": "subnetId", - "value": "subnet-" - }, - { - "name": "networkInterfaceId", - "value": "eni-abcd" - }, - { - "name": "macAddress", - "value": "" - }, - { - "name": "privateIPv4Address", - "value": "10.0.0.52" - } - ] - } - ], - "availabilityZone": "test-region-1a", - "clusterArn": "arn:aws:ecs:test-region-1::cluster/aws-ecs-integ-productionenvironmentclusterC6599D2D-U7W8a2P2HPhC", - "containers": [ - { - "containerArn": "arn:aws:ecs:test-region-1::container/ff3b49f4-5eea-46cd-99c6-069584b3fb8e", - "exitCode": 1, - "lastStatus": "STOPPED", - "name": "app", - "image": "nathanpeck/name", - "runtimeId": "", - "taskArn": "arn:aws:ecs:test-region-1::task/12345678-1234-1234-1234-1234567890AB", - "networkInterfaces": [ - { - "attachmentId": "323eb03f-dedf-44b6-aa5f-d9d7f7b37714", - "privateIpv4Address": "10.0.0.52" - } - ], - "cpu": "256", - "memory": "512" - } - ], - "createdAt": "2020-10-03T22:31:35.117Z", - "launchType": "FARGATE", - "cpu": "256", - "memory": "512", - "desiredStatus": "STOPPED", - "group": "service:aws-ecs-integ-nameserviceService8015C8D6-I4TwUFv4xk2o", - "lastStatus": "STOPPED", - "overrides": { - "containerOverrides": [ - { - "name": "app" - } - ] - }, - "connectivity": "CONNECTED", - "connectivityAt": "2020-10-03T22:31:43.32Z", - "pullStartedAt": "2020-10-03T22:31:46.764Z", - "startedAt": "2020-10-03T22:31:54.764Z", - "startedBy": "ecs-svc/7073659324082574009", - "stoppingAt": "2020-10-03T22:43:06.753Z", - "stoppedAt": "2020-10-03T22:43:31.542Z", - "pullStoppedAt": "2020-10-03T22:31:53.764Z", - "executionStoppedAt": "2020-10-03T22:43:08Z", - "stoppedReason": "Scaling activity initiated by (deployment ecs-svc/7073659324082574009)", - "updatedAt": "2020-10-03T22:43:31.542Z", - "taskArn": "arn:aws:ecs:test-region-1::task/12345678-1234-1234-1234-1234567890AB", - "taskDefinitionArn": "arn:aws:ecs:test-region-1::task-definition/awsecsintegnametaskdefinition0EA6A1A0:3", - "version": 7, - "platformVersion": "1.3.0" -} diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/test_cleanup_resource_handler.py b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/test_cleanup_resource_handler.py deleted file mode 100644 index c5ec1d0cf61ec..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/test_cleanup_resource_handler.py +++ /dev/null @@ -1,46 +0,0 @@ -import unittest -import unittest.mock as mock - -from lib.cleanup_resource_handler import CleanupResourceHandler -from lib.route53 import Route53RecordSetLocator - - -class TestCleanupResourceHandler(unittest.TestCase): - def test_handler_rejects_invalid_properties(self): - handler = CleanupResourceHandler(route53_client=mock.Mock()) - with self.assertRaises(Exception): - handler.handle_event({'RequestType': 'Delete', 'ResourceProperties': {'Invalid': 'Invalid'}}, {}) - - def test_handling_delete(self): - handler = CleanupResourceHandler(route53_client=mock.Mock(), monitor_interval=0) - record_set_accessor = mock.Mock() - record_set_accessor.delete = mock.Mock(return_value=True) # True = Deleted - - exists_count = 0 - - def exists_side_effect(*args): - nonlocal exists_count - exists_count += 1 - return True if exists_count < 3 else False - - record_set_accessor.exists = mock.Mock(side_effect=exists_side_effect) - - handler.record_set_accessor = record_set_accessor - - event = { - 'RequestType': 'Delete', - 'ResourceProperties': { - 'ServiceToken': 'Something', - 'HostedZoneId': 'ZONE', - 'RecordName': 'something.mydomain.com' - } - } - - # WHEN - handler.handle_event(event, {}) - - # THEN - expected_locator = Route53RecordSetLocator(hosted_zone_id='ZONE', record_name='something.mydomain.com') - record_set_accessor.delete.assert_called_with(locator=expected_locator) - record_set_accessor.exists.assert_called() - self.assertEqual(record_set_accessor.exists.call_count, 3) diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/test_events.py b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/test_events.py deleted file mode 100644 index a616bd7999309..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/test_events.py +++ /dev/null @@ -1,21 +0,0 @@ -import json -import os -import unittest - -from lib.events import extract_event_task_info - -THIS_DIR = os.path.abspath(os.path.dirname(__file__)) -with open(os.path.join(THIS_DIR, 'fixtures', 'task_description.json')) as f: - TASK_DESCRIPTION = json.loads(f.read()) - - -class TestEvents(unittest.TestCase): - def test_extract_event_task_info(self): - task_info = extract_event_task_info(TASK_DESCRIPTION) - - self.assertEqual(task_info.task_arn, 'arn:aws:ecs:test-region-1::task/12345678-1234-1234-1234-1234567890AB') - self.assertTrue(not task_info.is_stopped()) - - self.assertEqual(len(task_info.enis), 1) - self.assertEqual(task_info.enis[0].eni_id, 'eni-abcd') - self.assertEqual(task_info.enis[0].public_ipv4, None) diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/test_queue_handler.py b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/test_queue_handler.py deleted file mode 100644 index 91477451cf72e..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/test_queue_handler.py +++ /dev/null @@ -1,29 +0,0 @@ -import unittest -import unittest.mock as mock - -from lib.queue_handler import QueueHandler - - -class TestQueueHandler(unittest.TestCase): - def test_queue_handler_sets_up(self): - environ = { - 'HOSTED_ZONE_ID': 'HOSTED_ZONE_ID', - 'RECORD_NAME': 'RECORD_NAME', - 'RECORDS_TABLE': 'RECORDS_TABLE', - 'CLUSTER_ARN': 'CLUSTER_ARN', - 'SERVICE_NAME': 'SERVICE_NAME', - } - - ec2_client = mock.Mock() - route53_client = mock.Mock() - dynamodb_resource = mock.Mock() - - # WHEN - - handler = QueueHandler(ec2_client=ec2_client, route53_client=route53_client, - dynamodb_resource=dynamodb_resource, environ=environ) - - # THEN - dynamodb_resource.Table.called_width('RECORDS_TABLE') - - pass diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/test_records.py b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/test_records.py deleted file mode 100644 index cb2e1e45f6ed4..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/test_records.py +++ /dev/null @@ -1,46 +0,0 @@ -import json -import os -import unittest -from datetime import datetime - -from lib.records import DdbRecordEncoding, TaskInfo, EniInfo - -THIS_DIR = os.path.abspath(os.path.dirname(__file__)) -with open(os.path.join(THIS_DIR, 'fixtures', 'ddb-record.json')) as f: - DDB_RECORD_ENCODED = json.loads(f.read()) - - -class TestRecords(unittest.TestCase): - def test_task_info_stopped_marker(self): - task_info = TaskInfo(task_arn='a', enis=[]) - task_info.set_stopped_marker() - self.assertTrue(task_info.is_stopped()) - - def test_ddb_record_encoding(self): - # GIVEN - ddb_record_encoding = DdbRecordEncoding() - - # WHEN - ddb_record = ddb_record_encoding.decode(DDB_RECORD_ENCODED) - ddb_record_reencoded = ddb_record_encoding.encode(ddb_record) - - # THEN - self.assertEqual(ddb_record.key.cluster_arn, 'CLUSTER_ARN') - self.assertEqual(ddb_record.key.service_name, 'SERVICE') - self.assertEqual(sorted(ddb_record.ipv4s), ['1.1.2.1', '1.1.2.2']) - self.assertEqual( - ddb_record.task_info['TASK1_ARN'], - TaskInfo(task_arn='TASK1_ARN', stopped_datetime=datetime(2020, 10, 4, 23, 47, 36, 322158), enis=[ - EniInfo(eni_id='TASK1_ENI1_ID', public_ipv4='1.1.1.1'), - ])) - self.assertEqual( - ddb_record.task_info['TASK2_ARN'], - TaskInfo( - task_arn='TASK2_ARN', enis=[ - EniInfo(eni_id='TASK2_ENI1_ID', public_ipv4='1.1.2.1'), - EniInfo(eni_id='TASK2_ENI2_ID', public_ipv4='1.1.2.2'), - ])) - self.assertEqual(len(ddb_record.record_sets), 2) - - self.maxDiff = 9999999 - self.assertEqual(ddb_record_reencoded, DDB_RECORD_ENCODED) diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/test_records_table.py b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/test_records_table.py deleted file mode 100644 index 3429c152a6a35..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/test_records_table.py +++ /dev/null @@ -1,188 +0,0 @@ -import json -import os -import unittest -import unittest.mock as mock - -from boto3.dynamodb.conditions import ConditionExpressionBuilder -from botocore.exceptions import ClientError - -from lib.records import DdbRecordKey, TaskInfo, EniInfo, DdbRecord -from lib.records_table import RecordsTableAccessor, update_ddb_record, RecordUpdate -from lib.route53 import Route53RecordSetLocator - -THIS_DIR = os.path.abspath(os.path.dirname(__file__)) -with open(os.path.join(THIS_DIR, 'fixtures', 'ddb-record.json')) as f: - DDB_RECORD_ENCODED = json.loads(f.read()) - - -class TestRecordsTable(unittest.TestCase): - def test_put_tasks_creates_with_optimistic_lock(self): - # GIVEN - table_client = mock.Mock() - table_client.query = mock.Mock(return_value={'Items': []}) - - key = DdbRecordKey(cluster_arn='a', service_name='b') - records_table = RecordsTableAccessor(table_client=table_client) - - running = [TaskInfo(task_arn='TASK1_ARN', enis=[ - EniInfo(eni_id='TASK1_ENI1_ID', public_ipv4='1.1.1.1'), - ])] - - # WHEN - records_table.put_update_optimistically(key=key, update=RecordUpdate(running_tasks=running)) - - # THEN - table_client.put_item.assert_called() - item = table_client.put_item.call_args.kwargs['Item'] - self.assertEqual(item['version'], 1) - - condition_expression = table_client.put_item.call_args.kwargs['ConditionExpression'] - expr, atts, vals = ConditionExpressionBuilder().build_expression(condition_expression) - self.assertEqual(expr, '(attribute_not_exists(#n0) OR #n1 = :v0)') - self.assertEqual(atts, {'#n0': 'version', '#n1': 'version'}) - self.assertEqual(vals, {':v0': 0}) - - def test_put_tasks_updates_with_optimistic_lock(self): - # GIVEN - table_client = mock.Mock() - table_client.query = mock.Mock(return_value={'Items': [dict(DDB_RECORD_ENCODED)]}) - - key = DdbRecordKey(cluster_arn='FOO', service_name='test.myexample.com') - records_table = RecordsTableAccessor(table_client=table_client) - - running = [TaskInfo(task_arn='TASK1_ARN', enis=[ - EniInfo(eni_id='TASK1_ENI1_ID', public_ipv4='1.1.1.1'), - ])] - - # WHEN - records_table.put_update_optimistically(key=key, update=RecordUpdate(running_tasks=running)) - - # THEN - condition_expression = table_client.put_item.call_args.kwargs['ConditionExpression'] - expr, atts, vals = ConditionExpressionBuilder().build_expression(condition_expression) - self.assertEqual(vals, {':v0': 12}) - - def test_put_tasks_retries_optimistically(self): - # GIVEN - table_client = mock.Mock() - table_client.query = mock.Mock(return_value={'Items': []}) - table_client.put_item = mock.Mock( - side_effect=ClientError({'Error': { - 'Code': 'ConditionalCheckFailedException' - }}, 'PutItem')) - - records_table = RecordsTableAccessor(table_client=table_client) - key = DdbRecordKey(cluster_arn='a', service_name='b') - - # WHEN - with self.assertRaisesRegex(Exception, r'Exceeded maximum retries'): - records_table.put_update(key=key, update=RecordUpdate()) - - # THEN - self.assertEqual(table_client.query.call_count, records_table.max_attempts) - self.assertEqual(table_client.put_item.call_count, records_table.max_attempts) - - def test_put_tasks_raises_other_errors(self): - # GIVEN - table_client = mock.Mock() - table_client.query = mock.Mock(return_value={'Items': []}) - table_client.put_item = mock.Mock(side_effect=ClientError({'Error': {'Code': 'SomethingElse'}}, 'PutItem')) - - records_table = RecordsTableAccessor(table_client=table_client) - key = DdbRecordKey(cluster_arn='a', service_name='b') - - # WHEN - with self.assertRaisesRegex(Exception, r'SomethingElse'): - records_table.put_update(key=key, update=RecordUpdate()) - - # THEN - self.assertEqual(table_client.query.call_count, 1) - self.assertEqual(table_client.put_item.call_count, 1) - - def test_delete(self): - # GIVEN - table_client = mock.Mock() - key = DdbRecordKey(cluster_arn='a', service_name='b') - records_table = RecordsTableAccessor(table_client=table_client) - - # WHEN - records_table.delete(key) - - # THEN - table_client.delete_item.called_with(Key='a#b') - - def test_update_ddb_record(self): - # GIVEN - ddb_record = DdbRecord(key=DdbRecordKey(cluster_arn='a', service_name='b')) - - # TASK1->RUNNING, TASK2->RUNNING - ord1_running = [ - TaskInfo(task_arn='TASK1_ARN', enis=[ - EniInfo(eni_id='TASK1_ENI1_ID', public_ipv4='1.1.1.1'), - ]), - TaskInfo(task_arn='TASK2_ARN', enis=[ - EniInfo(eni_id='TASK2_ENI1_ID', public_ipv4='1.1.2.1'), - ]), - ] - # TASK3->STOPPED (out of order) - ord1_stopped = [ - TaskInfo(task_arn='TASK3_ARN', enis=[ - EniInfo(eni_id='TASK3_ENI1_ID'), - ]), - ] - - # TASK1->STOPPED, TASK3->STOPPED (duplicate) - ord2_stopped = [ - # Expected TASK1 transition to STOPPED - TaskInfo(task_arn='TASK1_ARN', enis=[ - EniInfo(eni_id='TASK1_ENI1_ID'), - ]), - # Duplicate TASK3 transition to STOPPED - TaskInfo(task_arn='TASK3_ARN', enis=[ - EniInfo(eni_id='TASK3_ENI1_ID'), - ]), - ] - - # TASK1->RUNNING (out of order), TASK3->RUNNING (out of order) - ord3_running = [ - TaskInfo(task_arn='TASK1_ARN', enis=[ - EniInfo(eni_id='TASK1_ENI1_ID', public_ipv4='1.1.1.1'), - ]), - TaskInfo(task_arn='TASK3_ARN', enis=[ - EniInfo(eni_id='TASK3_ENI1_ID', public_ipv4='1.1.3.1'), - ]), - ] - - # WHEN - update_ddb_record(ddb_record, RecordUpdate(running_tasks=ord1_running, stopped_tasks=ord1_stopped)) - update_ddb_record(ddb_record, RecordUpdate(stopped_tasks=ord2_stopped)) - update_ddb_record(ddb_record, RecordUpdate(running_tasks=ord3_running)) - - # THEN - self.assertEqual(len(ddb_record.task_info), 3, msg='expected 3 task infos') - self.assertTrue(ddb_record.task_info['TASK1_ARN'].is_stopped()) - self.assertTrue(not ddb_record.task_info['TASK2_ARN'].is_stopped()) - self.assertTrue(ddb_record.task_info['TASK3_ARN'].is_stopped()) - - self.assertFalse('1.1.1.1' in ddb_record.ipv4s, - msg='ord3_running should have been ignored because the task previously stopped') - self.assertEqual(sorted(ddb_record.ipv4s), ['1.1.2.1']) - - def test_update_record_sets(self): - # GIVEN - ddb_record = DdbRecord(key=DdbRecordKey(cluster_arn='a', service_name='b')) - ord1 = [ - Route53RecordSetLocator('a', 'b'), - Route53RecordSetLocator('a', 'c'), - ] - ord2 = [ - Route53RecordSetLocator('a', 'b'), - ] - - # WHEN - update_ddb_record(ddb_record, RecordUpdate(record_sets_added=ord1)) - update_ddb_record(ddb_record, RecordUpdate(record_sets_removed=ord2)) - - # THEN - self.assertEqual(len(ddb_record.record_sets), 1) - self.assertTrue(Route53RecordSetLocator('a', 'c') in ddb_record.record_sets) \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/test_route53.py b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/test_route53.py deleted file mode 100644 index a77093dcf484d..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/test_route53.py +++ /dev/null @@ -1,281 +0,0 @@ -import unittest -import unittest.mock as mock - -from botocore.exceptions import ClientError - -from lib.route53 import Route53RecordSetLocator, Route53RecordSetAccessor, exponential_backoff, retry_with_backoff, \ - map_ips_to_resource_records, find_locator_record_set - - -class TestRoute53(unittest.TestCase): - def get_route53_client_mock(self): - route53_client = mock.Mock() - record_set_value = None - - route53_client.list_resource_record_sets = mock.Mock( - side_effect=lambda **kwargs: - {'ResourceRecordSets': [record_set_value] if record_set_value is not None else []}) - - def change_resource_record_sets(HostedZoneId, ChangeBatch): - nonlocal record_set_value - change = ChangeBatch['Changes'][0] - change_action = change['Action'] - - if change_action == 'UPSERT': - record_set_value = change['ResourceRecordSet'] - elif change_action == 'DELETE': - record_set_value = None - - route53_client.change_resource_record_sets = mock.Mock(side_effect=change_resource_record_sets) - - return route53_client - - def test_creating_records(self): - # GIVEN - route53_client = self.get_route53_client_mock() - locator = Route53RecordSetLocator(hosted_zone_id='foo', record_name='foo.myexample.com') - merger = Route53RecordSetAccessor(route53_client) - - # WHEN - merger.update(locator, ipv4s={'1.1.1.1'}) - - # THEN - route53_client.change_resource_record_sets.assert_called_with( - HostedZoneId='foo', ChangeBatch={ - 'Comment': - 'Automatic', - 'Changes': [{ - 'Action': 'UPSERT', - 'ResourceRecordSet': { - 'Name': 'foo.myexample.com.', - 'Type': 'A', - 'ResourceRecords': [ - { - 'Value': '1.1.1.1' - }, - ], - 'TTL': 60 - } - }] - }) - - def test_creating_empty_records(self): - # GIVEN - route53_client = self.get_route53_client_mock() - locator = Route53RecordSetLocator(hosted_zone_id='foo', record_name='foo.myexample.com') - merger = Route53RecordSetAccessor(route53_client) - - # WHEN - merger.update(locator, ipv4s=set()) - - # THEN - route53_client.change_resource_record_sets.assert_not_called() - - def test_deleting_records(self): - # GIVEN - route53_client = self.get_route53_client_mock() - locator = Route53RecordSetLocator(hosted_zone_id='foo', record_name='foo.myexample.com') - record_set = Route53RecordSetAccessor(route53_client) - - # Set up the mock with a record. - record_set.update(locator, ipv4s={'1.1.1.1'}) - - # WHEN - record_set.update(locator, ipv4s=set()) - - # THEN - route53_client.change_resource_record_sets.assert_called_with( - HostedZoneId='foo', ChangeBatch={ - 'Comment': - 'Automatic', - 'Changes': [{ - 'Action': 'DELETE', - 'ResourceRecordSet': { - 'Name': 'foo.myexample.com.', - 'Type': 'A', - 'ResourceRecords': [ - { - 'Value': '1.1.1.1' - }, - ], - 'TTL': 60 - } - }] - }) - - def test_deleting_records_with_frontend(self): - # GIVEN - route53_client = self.get_route53_client_mock() - locator = Route53RecordSetLocator(hosted_zone_id='foo', record_name='foo.myexample.com') - record_set = Route53RecordSetAccessor(route53_client) - - # Set up the mock with a record. - record_set.update(locator, ipv4s={'1.1.1.1'}) - - # WHEN - record_set.delete(locator) - - # THEN - self.assertEqual(route53_client.list_resource_record_sets.call_count, 2) - route53_client.change_resource_record_sets.assert_called_with( - HostedZoneId='foo', ChangeBatch={ - 'Comment': - 'Automatic', - 'Changes': [{ - 'Action': 'DELETE', - 'ResourceRecordSet': { - 'Name': 'foo.myexample.com.', - 'Type': 'A', - 'ResourceRecords': [ - { - 'Value': '1.1.1.1' - }, - ], - 'TTL': 60 - } - }] - }) - - def test_deleting_no_records_with_frontend(self): - # GIVEN - route53_client = self.get_route53_client_mock() - locator = Route53RecordSetLocator(hosted_zone_id='foo', record_name='foo.myexample.com') - record_set = Route53RecordSetAccessor(route53_client) - - # WHEN - record_set.delete(locator) - - # THEN - self.assertEqual(route53_client.list_resource_record_sets.call_count, 1) - route53_client.change_resource_record_sets.assert_not_called() - - def test_checks_not_exists(self): - # GIVEN - route53_client = self.get_route53_client_mock() - locator = Route53RecordSetLocator(hosted_zone_id='foo', record_name='foo.myexample.com') - record_set = Route53RecordSetAccessor(route53_client) - - # WHEN - exists = record_set.exists(locator) - - # THEN - self.assertTrue(not exists) - - def test_checks_exists(self): - # GIVEN - route53_client = self.get_route53_client_mock() - locator = Route53RecordSetLocator(hosted_zone_id='foo', record_name='foo.myexample.com') - record_set = Route53RecordSetAccessor(route53_client) - - # WHEN - record_set.update(locator, ipv4s={'1.1.1.1'}) - exists = record_set.exists(locator) - - # THEN - self.assertTrue(exists) - - def test_exponential_backoff(self): - self.assertEqual(exponential_backoff(0), 1) - self.assertEqual(exponential_backoff(1), 2) - self.assertEqual(exponential_backoff(2), 4) - - def test_retry_with_backoff_throttling(self): - # GIVEN - call = mock.Mock(side_effect=ClientError(error_response={'Error': { - 'Code': 'Throttling' - }}, operation_name='any')) - - # WHEN - retry_with_backoff(call, attempts=5, backoff=lambda x: 0) - - # THEN - self.assertEqual(call.call_count, 5) - - def test_retry_with_backoff_prior_request_not_complete(self): - # GIVEN - call = mock.Mock(side_effect=ClientError(error_response={'Error': { - 'Code': 'PriorRequestNotComplete' - }}, operation_name='any')) - - # WHEN - retry_with_backoff(call, attempts=5, backoff=lambda x: 0) - - # THEN - self.assertEqual(call.call_count, 5) - - def test_retry_with_backoff_other_client_errors(self): - # GIVEN - call = mock.Mock(side_effect=ClientError(error_response={'Error': { - 'Code': 'SomethingElse' - }}, operation_name='any')) - - # WHEN/THEN - with self.assertRaisesRegex(ClientError, r'SomethingElse'): - retry_with_backoff(call, attempts=5, backoff=lambda x: 0) - self.assertEqual(call.call_count, 1) - - def test_retry_with_backoff_other_errors(self): - # GIVEN - call = mock.Mock(side_effect=Exception('very good reason')) - - # WHEN/THEN - with self.assertRaisesRegex(Exception, r'very good reason'): - retry_with_backoff(call, attempts=5, backoff=lambda x: 0) - self.assertEqual(call.call_count, 1) - - def test_map_ips_to_resource_records(self): - # GIVEN - ips = {'1.1.1.1', '1.1.1.2'} - - # WHEN - output = map_ips_to_resource_records(ips) - - # THEN - self.assertEqual(output, [{'Value': '1.1.1.1'}, {'Value': '1.1.1.2'}]) - - def test_map_ips_to_resource_records_truncates_to_400(self): - # GIVEN - ips = {f'1.1.{a}.{b}' for a in range(1, 255) for b in range(1, 255)} - - # WHEN - output = map_ips_to_resource_records(ips) - - # THEN - self.assertEqual(len(output), 400) - - def test_find_locator_record_set_ignores_irrelevant_records(self): - # GIVEN - locator = Route53RecordSetLocator(hosted_zone_id='foo', record_name='test-record.myexample.com') - record_sets = [{ - 'Name': 'u-record.myexample.com.', - 'Type': 'A', - 'TTL': 60, - 'ResourceRecords': [{ - 'Value': '1.1.1.1' - }] - }] - - # WHEN - result = find_locator_record_set(locator, 'A', record_sets) - - # THEN - self.assertIsNone(result) - - def test_find_locator_record_set_finds_it(self): - # GIVEN - locator = Route53RecordSetLocator(hosted_zone_id='foo', record_name='test-record.myexample.com') - matching_record = { - 'Name': 'test-record.myexample.com.', - 'Type': 'A', - 'TTL': 60, - 'ResourceRecords': [{ - 'Value': '1.1.1.1' - }] - } - record_sets = [matching_record] - - # WHEN - result = find_locator_record_set(locator, 'A', record_sets) - - # THEN - self.assertEqual(result, matching_record) diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/test_tasks.py b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/test_tasks.py deleted file mode 100644 index b4b491750bcce..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/test/test_tasks.py +++ /dev/null @@ -1,55 +0,0 @@ -import json -import os -import unittest -import unittest.mock as mock -from datetime import datetime - -from lib.events import extract_event_task_info -from lib.records import TaskInfo, DdbRecord, DdbRecordKey -from lib.running_task_collector import RunningTaskCollector - -THIS_DIR = os.path.abspath(os.path.dirname(__file__)) -with open(os.path.join(THIS_DIR, 'fixtures', 'task_description.json')) as f: - TASK_DESCRIPTION = json.loads(f.read()) -with open(os.path.join(THIS_DIR, 'fixtures', 'eni_description.json')) as f: - ENI_DESCRIPTION = json.loads(f.read()) - - -class TestRunningTasksCollector(unittest.TestCase): - def test_task_collector(self): - # GIVEN - ec2_client = mock.Mock() - paginator = mock.Mock() - paginator.paginate = mock.Mock(return_value=[{'NetworkInterfaces': [ENI_DESCRIPTION]}]) - ec2_client.get_paginator = mock.Mock(return_value=paginator) - - reference_record = DdbRecord(key=DdbRecordKey(cluster_arn="A", service_name="B")) - collector = RunningTaskCollector(ec2_client=ec2_client, reference_record=reference_record) - - # WHEN - task_info = extract_event_task_info(TASK_DESCRIPTION) - collector.collect(task_info) - collector.fill_eni_info_from_eni_query() - - # THEN - paginator.paginate.assert_called_with(NetworkInterfaceIds=['eni-abcd']) - self.assertTrue('1.2.3.4' in collector.get_ips()) - - def test_task_collector_doesnt_collect_stopped_tasks(self): - # GIVEN - ec2_client = mock.Mock() - paginator = mock.Mock() - paginator.paginate = mock.Mock(return_value=[{'NetworkInterfaces': [ENI_DESCRIPTION]}]) - ec2_client.get_paginator = mock.Mock(return_value=paginator) - - task_arn = TASK_DESCRIPTION['taskArn'] - task_info = {task_arn: TaskInfo(task_arn=task_arn, enis=[], stopped_datetime=datetime.utcnow())} - reference_record = DdbRecord(key=DdbRecordKey(cluster_arn="A", service_name="B"), task_info=task_info) - collector = RunningTaskCollector(ec2_client=ec2_client, reference_record=reference_record) - - # WHEN - task_info = extract_event_task_info(TASK_DESCRIPTION) - collector.collect(task_info) - - # THEN - self.assertEqual(len(collector.tasks), 0) diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/task-record-manager.ts b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/task-record-manager.ts deleted file mode 100644 index dd0bd0718d2e9..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/task-record-manager.ts +++ /dev/null @@ -1,208 +0,0 @@ -import * as path from 'path'; -import * as dynamodb from '@aws-cdk/aws-dynamodb'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as events from '@aws-cdk/aws-events'; -import * as events_targets from '@aws-cdk/aws-events-targets'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as lambda_es from '@aws-cdk/aws-lambda-event-sources'; -import * as route53 from '@aws-cdk/aws-route53'; -import * as sqs from '@aws-cdk/aws-sqs'; -import * as cdk from '@aws-cdk/core'; -import * as customresources from '@aws-cdk/custom-resources'; -import { Construct } from 'constructs'; - -export interface TaskRecordManagerProps { - service: ecs.Ec2Service | ecs.FargateService; - dnsZone: route53.IHostedZone; - dnsRecordName: string; -} - -/** - * An event-driven serverless app to maintain a list of public ips in a Route 53 - * hosted zone. - */ -export class TaskRecordManager extends Construct { - constructor(scope: Construct, id: string, props: TaskRecordManagerProps) { - super(scope, id); - - // Poison pills go here. - const deadLetterQueue = new sqs.Queue(this, 'EventsDL', { - retentionPeriod: cdk.Duration.days(14), - }); - - // Time limit for processing queue items - we set the lambda time limit to - // this value as well. - const eventsQueueVisibilityTimeout = cdk.Duration.seconds(30); - - // This queue lets us batch together ecs task state events. This is useful - // for when when we would be otherwise bombarded by them. - const eventsQueue = new sqs.Queue(this, 'EventsQueue', { - deadLetterQueue: { - maxReceiveCount: 500, - queue: deadLetterQueue, - }, - visibilityTimeout: eventsQueueVisibilityTimeout, - }); - - // Storage for task and record set information. - const recordsTable = new dynamodb.Table(this, 'Records', { - partitionKey: { - name: 'cluster_service', - type: dynamodb.AttributeType.STRING, - }, - billingMode: dynamodb.BillingMode.PAY_PER_REQUEST, - removalPolicy: cdk.RemovalPolicy.DESTROY, - }); - - // Put the cluster's task state changes events into the queue. - const runningEventRule = new events.Rule(this, 'RuleRunning', { - eventPattern: { - source: ['aws.ecs'], - detailType: ['ECS Task State Change'], - detail: { - clusterArn: [props.service.cluster.clusterArn], - lastStatus: ['RUNNING'], - desiredStatus: ['RUNNING'], - }, - }, - targets: [ - new events_targets.SqsQueue(eventsQueue), - ], - }); - - const stoppedEventRule = new events.Rule(this, 'RuleStopped', { - eventPattern: { - source: ['aws.ecs'], - detailType: ['ECS Task State Change'], - detail: { - clusterArn: [props.service.cluster.clusterArn], - lastStatus: ['STOPPED'], - desiredStatus: ['STOPPED'], - }, - }, - targets: [ - new events_targets.SqsQueue(eventsQueue), - ], - }); - - // Shared codebase for the lambdas. - const code = lambda.Code.fromAsset(path.join(__dirname, 'lambda'), { - exclude: [ - '.coverage', - '*.pyc', - '.idea', - ], - }); - - // Fully qualified domain name of the record - const recordFqdn = cdk.Fn.join('.', [props.dnsRecordName, props.dnsZone.zoneName]); - - // Allow access to manage a zone's records. - const dnsPolicyStatement = new iam.PolicyStatement({ - effect: iam.Effect.ALLOW, - actions: [ - 'route53:ChangeResourceRecordSets', - 'route53:ListResourceRecordSets', - ], - resources: [props.dnsZone.hostedZoneArn], - }); - - // This function consumes events from the event queue and does the work of - // querying task IP addresses and creating, updating record sets. When there - // are zero tasks, it deletes the record set. - const eventHandler = new lambda.Function(this, 'EventHandler', { - code: code, - handler: 'index.queue_handler', - runtime: lambda.Runtime.PYTHON_3_8, - timeout: eventsQueueVisibilityTimeout, - // Single-concurrency to prevent a race to set the RecordSet - reservedConcurrentExecutions: 1, - environment: { - HOSTED_ZONE_ID: props.dnsZone.hostedZoneId, - RECORD_NAME: recordFqdn, - RECORDS_TABLE: recordsTable.tableName, - CLUSTER_ARN: props.service.cluster.clusterArn, - SERVICE_NAME: props.service.serviceName, - }, - events: [ - new lambda_es.SqsEventSource(eventsQueue), - ], - initialPolicy: [ - // Look up task IPs - new iam.PolicyStatement({ - effect: iam.Effect.ALLOW, - actions: ['ec2:DescribeNetworkInterfaces'], - resources: ['*'], - }), - dnsPolicyStatement, - ], - }); - recordsTable.grantReadWriteData(eventHandler); - - // The lambda for a custom resource provider that deletes dangling record - // sets when the stack is deleted. - const cleanupResourceProviderHandler = new lambda.Function(this, 'CleanupResourceProviderHandler', { - code: code, - handler: 'index.cleanup_resource_handler', - runtime: lambda.Runtime.PYTHON_3_8, - timeout: cdk.Duration.minutes(5), - initialPolicy: [ - dnsPolicyStatement, - ], - }); - - const cleanupResourceProvider = new customresources.Provider(this, 'CleanupResourceProvider', { - onEventHandler: cleanupResourceProviderHandler, - }); - - const cleanupResource = new cdk.CustomResource(this, 'Cleanup', { - serviceToken: cleanupResourceProvider.serviceToken, - properties: { - HostedZoneId: props.dnsZone.hostedZoneId, - RecordName: recordFqdn, - }, - }); - - // Prime the event queue with a message so that changes to dns config are - // quickly applied. - const primingSdkCall: customresources.AwsSdkCall = { - service: 'SQS', - action: 'sendMessage', - parameters: { - QueueUrl: eventsQueue.queueUrl, - DelaySeconds: 10, - MessageBody: '{ "prime": true }', - // Add the hosted zone id and record name so that priming occurs with - // dns config updates. - MessageAttributes: { - HostedZoneId: { DataType: 'String', StringValue: props.dnsZone.hostedZoneId }, - RecordName: { DataType: 'String', StringValue: props.dnsRecordName }, - }, - }, - physicalResourceId: customresources.PhysicalResourceId.fromResponse('MessageId'), - }; - - const primingCall = new customresources.AwsCustomResource(this, 'PrimingCall', { - onCreate: primingSdkCall, - onUpdate: primingSdkCall, - policy: customresources.AwsCustomResourcePolicy.fromStatements([ - new iam.PolicyStatement({ - effect: iam.Effect.ALLOW, - actions: ['sqs:SendMessage'], - resources: [eventsQueue.queueArn], - }), - ]), - }); - - // Send the priming call after the handler is created/updated. - primingCall.node.addDependency(eventHandler); - - // Ensure that the cleanup resource is deleted last (so it can clean up) - props.service.taskDefinition.node.addDependency(cleanupResource); - // Ensure that the event rules are created first so we can catch the first - // state transitions. - props.service.taskDefinition.node.addDependency(runningEventRule); - props.service.taskDefinition.node.addDependency(stoppedEventRule); - } -} diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/cloudwatch-agent.ts b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/cloudwatch-agent.ts deleted file mode 100644 index 5ca7106cfa968..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/cloudwatch-agent.ts +++ /dev/null @@ -1,73 +0,0 @@ -import * as ecs from '@aws-cdk/aws-ecs'; -import * as iam from '@aws-cdk/aws-iam'; -import { Construct } from 'constructs'; -import { Service } from '../service'; -import { ServiceExtension } from './extension-interfaces'; - -const CLOUDWATCH_AGENT_IMAGE = 'amazon/cloudwatch-agent:latest'; - -/** - * This extension adds a CloudWatch agent to the task definition and - * configures the task to be able to publish metrics to CloudWatch. - */ -export class CloudwatchAgentExtension extends ServiceExtension { - private CW_CONFIG_CONTENT = { - logs: { - metrics_collected: { - emf: {}, - }, - }, - metrics: { - metrics_collected: { - statsd: {}, - }, - }, - }; - - constructor() { - super('cloudwatchAgent'); - } - - public prehook(service: Service, scope: Construct) { - this.parentService = service; - this.scope = scope; - } - - public useTaskDefinition(taskDefinition: ecs.TaskDefinition) { - // Add the CloudWatch Agent to this task - this.container = taskDefinition.addContainer('cloudwatch-agent', { - image: ecs.ContainerImage.fromRegistry(CLOUDWATCH_AGENT_IMAGE), - environment: { - CW_CONFIG_CONTENT: JSON.stringify(this.CW_CONFIG_CONTENT), - }, - logging: new ecs.AwsLogDriver({ streamPrefix: 'cloudwatch-agent' }), - user: '0:1338', // Ensure that CloudWatch agent outbound traffic doesn't go through proxy - memoryReservationMiB: 50, - }); - - // Add permissions that allow the cloudwatch agent to publish metrics - new iam.Policy(this.scope, `${this.parentService.id}-publish-metrics`, { - roles: [taskDefinition.taskRole], - statements: [ - new iam.PolicyStatement({ - resources: ['*'], - actions: ['cloudwatch:PutMetricData'], - }), - ], - }); - } - - public resolveContainerDependencies() { - if (!this.container) { - throw new Error('The container dependency hook was called before the container was created'); - } - - const appmeshextension = this.parentService.serviceDescription.get('appmesh'); - if (appmeshextension && appmeshextension.container) { - this.container.addContainerDependencies({ - container: appmeshextension.container, - condition: ecs.ContainerDependencyCondition.HEALTHY, - }); - } - } -} diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/container.ts b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/container.ts deleted file mode 100644 index ee4eee5d99327..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/container.ts +++ /dev/null @@ -1,187 +0,0 @@ -import * as ecs from '@aws-cdk/aws-ecs'; -import * as awslogs from '@aws-cdk/aws-logs'; -import * as cdk from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; -import { Construct, Node } from 'constructs'; -import { Service } from '../service'; -import { ServiceExtension } from './extension-interfaces'; - -/** - * Setting for the main application container of a service. - */ -export interface ContainerExtensionProps { - /** - * How much CPU the container requires. - */ - readonly cpu: number, - - /** - * How much memory in megabytes the container requires. - */ - readonly memoryMiB: number, - - /** - * The image to run. - */ - readonly image: ecs.ContainerImage, - - /** - * What port the image listen for traffic on. - */ - readonly trafficPort: number, - - /** - * Environment variables to pass into the container. - * - * @default - No environment variables. - */ - readonly environment?: { - [key: string]: string, - } - - /** - * The log group into which application container logs should be routed. - * - * @default - A log group is automatically created for you if the `ECS_SERVICE_EXTENSIONS_ENABLE_DEFAULT_LOG_DRIVER` feature flag is set. - */ - readonly logGroup?: awslogs.ILogGroup; -} - -/** - * The main container of a service. This is generally the container - * which runs your application business logic. Other extensions will attach - * sidecars alongside this main container. - */ -export class Container extends ServiceExtension { - /** - * The port on which the container expects to receive network traffic - */ - public readonly trafficPort: number; - - /** - * The log group into which application container logs should be routed. - */ - public logGroup?: awslogs.ILogGroup; - - /** - * The settings for the container. - */ - private props: ContainerExtensionProps; - - constructor(props: ContainerExtensionProps) { - super('service-container'); - this.props = props; - this.trafficPort = props.trafficPort; - this.logGroup = props.logGroup; - } - - public prehook(service: Service, scope: Construct) { - this.parentService = service; - this.scope = scope; - } - - // This hook sets the overall task resource requirements to the - // resource requirements of the application itself. - public modifyTaskDefinitionProps(props: ecs.TaskDefinitionProps): ecs.TaskDefinitionProps { - return { - ...props, - cpu: this.props.cpu.toString(), - memoryMiB: this.props.memoryMiB.toString(), - } as ecs.TaskDefinitionProps; - } - - // This hook adds the application container to the task definition. - public useTaskDefinition(taskDefinition: ecs.TaskDefinition) { - let containerProps = { - image: this.props.image, - cpu: Number(this.props.cpu), - memoryLimitMiB: Number(this.props.memoryMiB), - environment: this.props.environment, - } as ecs.ContainerDefinitionOptions; - - // Let other extensions mutate the container definition. This is - // used by extensions which want to add environment variables, modify - // logging parameters, etc. - this.containerMutatingHooks.forEach((hookProvider) => { - containerProps = hookProvider.mutateContainerDefinition(containerProps); - }); - - // If no observability extensions have been added to the service description then we can configure the `awslogs` log driver - if (!containerProps.logging) { - // Create a log group for the service if one is not provided by the user (only if feature flag is set) - if (!this.logGroup && Node.of(this.parentService).tryGetContext(cxapi.ECS_SERVICE_EXTENSIONS_ENABLE_DEFAULT_LOG_DRIVER)) { - this.logGroup = new awslogs.LogGroup(this.scope, `${this.parentService.id}-logs`, { - logGroupName: `${this.parentService.id}-logs`, - removalPolicy: cdk.RemovalPolicy.DESTROY, - retention: awslogs.RetentionDays.ONE_MONTH, - }); - } - - if (this.logGroup) { - containerProps = { - ...containerProps, - logging: new ecs.AwsLogDriver({ - streamPrefix: this.parentService.id, - logGroup: this.logGroup, - }), - }; - } - } else { - if (this.logGroup) { - throw Error(`Log configuration already specified. You cannot provide a log group for the application container of service '${this.parentService.id}' while also adding log configuration separately using service extensions.`); - } - } - this.container = taskDefinition.addContainer('app', containerProps); - - // Create a port mapping for the container - this.container.addPortMappings({ - containerPort: this.trafficPort, - }); - - // Raise the ulimits for this main application container - // so that it can handle more concurrent requests - this.container.addUlimits({ - softLimit: 1024000, - hardLimit: 1024000, - name: ecs.UlimitName.NOFILE, - }); - } - - public resolveContainerDependencies() { - if (!this.container) { - throw new Error('The container dependency hook was called before the container was created'); - } - - const firelens = this.parentService.serviceDescription.get('firelens'); - if (firelens && firelens.container) { - this.container.addContainerDependencies({ - container: firelens.container, - condition: ecs.ContainerDependencyCondition.START, - }); - } - - const appmeshextension = this.parentService.serviceDescription.get('appmesh'); - if (appmeshextension && appmeshextension.container) { - this.container.addContainerDependencies({ - container: appmeshextension.container, - condition: ecs.ContainerDependencyCondition.HEALTHY, - }); - } - - const cloudwatchextension = this.parentService.serviceDescription.get('cloudwatchAgent'); - if (cloudwatchextension && cloudwatchextension.container) { - this.container.addContainerDependencies({ - container: cloudwatchextension.container, - condition: ecs.ContainerDependencyCondition.START, - }); - } - - const xrayextension = this.parentService.serviceDescription.get('xray'); - if (xrayextension && xrayextension.container) { - this.container.addContainerDependencies({ - container: xrayextension.container, - condition: ecs.ContainerDependencyCondition.HEALTHY, - }); - } - } -} diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/extension-interfaces.ts b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/extension-interfaces.ts deleted file mode 100644 index bc75242d0a68c..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/extension-interfaces.ts +++ /dev/null @@ -1,249 +0,0 @@ -import * as ecs from '@aws-cdk/aws-ecs'; -import * as cdk from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { Service, ConnectToProps } from '../service'; - -/** - * The types of capacity that are supported. These capacity types may change the - * behavior of an extension. - */ -export enum EnvironmentCapacityType { - /** - * Specify that the environment should use AWS Fargate for - * hosting containers. - */ - FARGATE = 'fargate', - - /** - * Specify that the environment should launch containers onto - * EC2 instances. - */ - EC2 = 'ec2' -} - -/** - * A set of mutable service props in the process of being assembled using a - * builder pattern. They will eventually to be translated into an - * ecs.Ec2ServiceProps or ecs.FargateServiceProps interface, depending on the - * environment's capacity type. - */ -export interface ServiceBuild { - /** - * The cluster in which to launch the service. - */ - readonly cluster: ecs.ICluster, - - /** - * The task definition registered to this service. - */ - readonly taskDefinition: ecs.TaskDefinition, - - /** - * Specifies whether the task's elastic network interface receives a public IP - * address. - * - * If true, each task will receive a public IP address. - * - * @default - false - */ - readonly assignPublicIp?: boolean; - - /** - * Configuration for how to register the service in service discovery. - * - * @default - No Cloud Map configured - */ - readonly cloudMapOptions?: ecs.CloudMapOptions - - /** - * How long the healthcheck can fail during initial task startup before - * the task is considered unhealthy. This is used to give the task more - * time to start passing healthchecks. - * - * @default - No grace period - */ - readonly healthCheckGracePeriod?: cdk.Duration, - - /** - * How many tasks to run. - * - * @default - 1 - */ - readonly desiredCount?: number; - - /** - * Minimum healthy task percentage. - * - * @default - 100 - */ - readonly minHealthyPercent?: number; - - /** - * Maximum percentage of tasks that can be launched. - * - * @default - 200 - */ - readonly maxHealthyPercent?: number; -} - -/** - * The shape of a service extension. This abstract class is implemented - * by other extensions that extend the hooks to implement any custom - * logic that they want to run during each step of preparing the service. - */ -export abstract class ServiceExtension { - /** - * The name of the extension. - */ - public name: string; - - /** - * The container for this extension. Most extensions have a container, but not - * every extension is required to have a container. Some extensions may just - * modify the properties of the service, or create external resources - * connected to the service. - */ - public container?: ecs.ContainerDefinition; - - /** - * The service which this extension is being added to. - * Initially, extensions are collected into a ServiceDescription, but no service - * exists yet. Later, when the ServiceDescription is used to create a service, - * the extension is told what Service it is now working on. - */ - protected parentService!: Service; - protected scope!: Construct; - - // A list of other extensions which want to mutate the - // container definition for this extension. - protected containerMutatingHooks: ContainerMutatingHook[] = []; - - constructor(name: string) { - this.name = name; - } - - /** - * A hook that allows the extension to add hooks to other - * extensions that are registered. - */ - public addHooks() { } // tslint:disable-line - - /** - * This hook allows another service extension to register a mutating hook for - * changing the primary container of this extension. This is primarily used - * for the application extension. For example, the Firelens extension wants to - * be able to modify the settings of the application container to - * route logs through Firelens. - * - * @param hook - */ - public addContainerMutatingHook(hook: ContainerMutatingHook) { - this.containerMutatingHooks.push(hook); - } - - /** - * This is a hook which allows extensions to modify the settings of the - * task definition prior to it being created. For example, the App Mesh - * extension needs to configure an Envoy proxy in the task definition, - * or the Application extension wants to set the overall resource for - * the task. - * - * @param props - Properties of the task definition to be created - */ - public modifyTaskDefinitionProps(props: ecs.TaskDefinitionProps): ecs.TaskDefinitionProps { - return { - ...props, - } as ecs.TaskDefinitionProps; - } - - /** - * A hook that is called for each extension ahead of time to - * allow for any initial setup, such as creating resources in - * advance. - * - * @param parent - The parent service which this extension has been added to - * @param scope - The scope that this extension should create resources in - */ - public prehook(parent: Service, scope: Construct) { - this.parentService = parent; - this.scope = scope; - } - - /** - * Once the task definition is created, this hook is called for each - * extension to give it a chance to add containers to the task definition, - * change the task definition's role to add permissions, etc. - * - * @param taskDefinition - The created task definition to add containers to - */ - public useTaskDefinition(taskDefinition: ecs.TaskDefinition) { - taskDefinition = taskDefinition; - } - - /** - * Once all containers are added to the task definition, this hook is - * called for each extension to give it a chance to resolve its dependency - * graph so that its container starts in the right order based on the - * other extensions that were enabled. - */ - public resolveContainerDependencies() { - return; - } - - /** - * Prior to launching the task definition as a service, this hook - * is called on each extension to give it a chance to mutate the properties - * of the service to be created. - * - * @param props - The service properties to mutate. - */ - public modifyServiceProps(props: ServiceBuild): ServiceBuild { - return { - ...props, - } as ServiceBuild; - } - - /** - * When this hook is implemented by extension, it allows the extension - * to use the service which has been created. It is generally used to - * create any final resources which might depend on the service itself. - * - * @param service - The generated service. - */ - public useService(service: ecs.Ec2Service | ecs.FargateService) { - service = service; - } - - /** - * This hook allows the extension to establish a connection to - * extensions from another service. Usually used for things like - * allowing one service to talk to the load balancer or service mesh - * proxy for another service. - * - * @param service - The other service to connect to. - */ - public connectToService(service: Service, connectToProps: ConnectToProps) { - service = service; - connectToProps = connectToProps; - } -} - -/** - * This is an abstract class wrapper for a mutating hook. It is - * extended by any extension which wants to mutate other extension's containers. - */ -export abstract class ContainerMutatingHook { - /** - * This is a hook for modifying the container definition of any upstream - * containers. This is primarily used for the main application container. - * For example, the Firelens extension wants to be able to modify the logging - * settings of the application container. - * - * @param props - The container definition to mutate. - */ - public mutateContainerDefinition(props: ecs.ContainerDefinitionOptions): ecs.ContainerDefinitionOptions { - return { - ...props, - } as ecs.ContainerDefinitionOptions; - } -} diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/firelens.ts b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/firelens.ts deleted file mode 100644 index d0684edeac474..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/firelens.ts +++ /dev/null @@ -1,127 +0,0 @@ -import * as ecs from '@aws-cdk/aws-ecs'; -import * as awslogs from '@aws-cdk/aws-logs'; -import * as cdk from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { Service } from '../service'; -import { Container } from './container'; -import { ContainerMutatingHook, ServiceExtension } from './extension-interfaces'; - -/** - * Settings for the hook which mutates the application container - * to route logs through FireLens. - */ -export interface FirelensProps { - /** - * The parent service that is being mutated. - */ - readonly parentService: Service; - - /** - * The log group into which logs should be routed. - */ - readonly logGroup: awslogs.LogGroup; -} - -/** - * This hook modifies the application container's settings so that - * it routes logs using FireLens. - */ -export class FirelensMutatingHook extends ContainerMutatingHook { - private parentService: Service; - private logGroup: awslogs.LogGroup; - - constructor(props: FirelensProps) { - super(); - this.parentService = props.parentService; - this.logGroup = props.logGroup; - } - - public mutateContainerDefinition(props: ecs.ContainerDefinitionOptions): ecs.ContainerDefinitionOptions { - return { - ...props, - - logging: ecs.LogDrivers.firelens({ - options: { - Name: 'cloudwatch', - region: cdk.Stack.of(this.parentService).region, - log_group_name: this.logGroup.logGroupName, - log_stream_prefix: `${this.parentService.id}/`, - }, - }), - } as ecs.ContainerDefinitionOptions; - } -} - -/** - * This extension adds a FluentBit log router to the task definition - * and does all the configuration necessarily to enable log routing - * for the task using FireLens. - */ -export class FireLensExtension extends ServiceExtension { - private logGroup!: awslogs.LogGroup; - - constructor() { - super('firelens'); - } - - public prehook(service: Service, scope: Construct) { - this.parentService = service; - - // Create a log group for the service, into which FireLens - // will route the service's logs - this.logGroup = new awslogs.LogGroup(scope, `${service.id}-logs`, { - logGroupName: `${service.id}-logs`, - removalPolicy: cdk.RemovalPolicy.DESTROY, - retention: awslogs.RetentionDays.ONE_WEEK, - }); - } - - // Add hooks to the main application extension so that it is modified to - // have logging properties that enable sending logs via the - // Firelens log router container - public addHooks() { - const container = this.parentService.serviceDescription.get('service-container') as Container; - - if (!container) { - throw new Error('Firelens extension requires an application extension'); - } - - container.addContainerMutatingHook(new FirelensMutatingHook({ - parentService: this.parentService, - logGroup: this.logGroup, - })); - } - - public useTaskDefinition(taskDefinition: ecs.TaskDefinition) { - // Manually add a firelens log router, so that we can manually manage the dependencies - // to ensure that the Firelens log router depends on the Envoy proxy - this.container = taskDefinition.addFirelensLogRouter('firelens', { - image: ecs.obtainDefaultFluentBitECRImage(taskDefinition, { - logDriver: 'awsfirelens', - options: { - Name: 'cloudwatch', - }, - }), - firelensConfig: { - type: ecs.FirelensLogRouterType.FLUENTBIT, - }, - logging: new ecs.AwsLogDriver({ streamPrefix: 'firelens' }), - memoryReservationMiB: 50, - user: '0:1338', // Give Firelens a group ID that allows its outbound logs to bypass Envoy - }); - } - - public resolveContainerDependencies() { - if (!this.container) { - throw new Error('The container dependency hook was called before the container was created'); - } - - const appmeshextension = this.parentService.serviceDescription.get('appmesh'); - if (appmeshextension && appmeshextension.container) { - this.container.addContainerDependencies({ - container: appmeshextension.container, - condition: ecs.ContainerDependencyCondition.HEALTHY, - }); - } - } -} diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/http-load-balancer.ts b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/http-load-balancer.ts deleted file mode 100644 index 89787447d681a..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/http-load-balancer.ts +++ /dev/null @@ -1,81 +0,0 @@ -import * as ecs from '@aws-cdk/aws-ecs'; -import * as alb from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as cdk from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { Service } from '../service'; -import { ServiceExtension, ServiceBuild } from './extension-interfaces'; - -export interface HttpLoadBalancerProps { - /** - * The number of ALB requests per target. - */ - readonly requestsPerTarget?: number; -} - -/** - * This extension add a public facing load balancer for sending traffic - * to one or more replicas of the application container. - */ -export class HttpLoadBalancerExtension extends ServiceExtension { - private loadBalancer!: alb.IApplicationLoadBalancer; - private listener!: alb.IApplicationListener; - private requestsPerTarget?: number; - - constructor(props: HttpLoadBalancerProps = {}) { - super('load-balancer'); - this.requestsPerTarget = props.requestsPerTarget; - } - - // Before the service is created, go ahead and create the load balancer itself. - public prehook(service: Service, scope: Construct) { - this.parentService = service; - - this.loadBalancer = new alb.ApplicationLoadBalancer(scope, `${this.parentService.id}-load-balancer`, { - vpc: this.parentService.vpc, - internetFacing: true, - }); - - this.listener = this.loadBalancer.addListener(`${this.parentService.id}-listener`, { - port: 80, - open: true, - }); - - // Automatically create an output - new cdk.CfnOutput(scope, `${this.parentService.id}-load-balancer-dns-output`, { - value: this.loadBalancer.loadBalancerDnsName, - }); - } - - // Minor service configuration tweaks to work better with a load balancer - public modifyServiceProps(props: ServiceBuild): ServiceBuild { - return { - ...props, - - // Give the task a little bit of grace time to start passing - // healthchecks. Without this it is possible for a slow starting task - // to cause the ALB to consider the task unhealthy, causing ECS to stop - // the task before it actually has a chance to finish starting up - healthCheckGracePeriod: cdk.Duration.minutes(1), - } as ServiceBuild; - } - - // After the service is created add the service to the load balancer's listener - public useService(service: ecs.Ec2Service | ecs.FargateService) { - const targetGroup = this.listener.addTargets(this.parentService.id, { - deregistrationDelay: cdk.Duration.seconds(10), - port: 80, - targets: [service], - }); - - if (this.requestsPerTarget) { - if (!this.parentService.scalableTaskCount) { - throw Error(`Auto scaling target for the service '${this.parentService.id}' hasn't been configured. Please use Service construct to configure 'minTaskCount' and 'maxTaskCount'.`); - } - this.parentService.scalableTaskCount.scaleOnRequestCount(`${this.parentService.id}-target-request-count-${this.requestsPerTarget}`, { - requestsPerTarget: this.requestsPerTarget, - targetGroup, - }); - this.parentService.enableAutoScalingPolicy(); - } - } -} diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/index.ts b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/index.ts deleted file mode 100644 index 2a7a55bb348ec..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -export * from './container'; -export * from './firelens'; -export * from './appmesh'; -export * from './http-load-balancer'; -export * from './cloudwatch-agent'; -export * from './scale-on-cpu-utilization'; -export * from './xray'; -export * from './assign-public-ip'; -export * from './queue/queue'; -export * from './injecter'; diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/injecter.ts b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/injecter.ts deleted file mode 100644 index a6b54464c0e9c..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/injecter.ts +++ /dev/null @@ -1,151 +0,0 @@ -import * as ecs from '@aws-cdk/aws-ecs'; -import * as sns from '@aws-cdk/aws-sns'; -import { Construct } from 'constructs'; -import { Service } from '../service'; -import { Container } from './container'; -import { ContainerMutatingHook, ServiceExtension } from './extension-interfaces'; - -/** - * An interface that will be implemented by all the resources that can be published events or written data to. - */ -export interface Injectable { - environmentVariables(): { [key: string]: string }; -} - -/** - * An interface that will be implemented by all the injectable resources that need to grant permissions to the task role. - */ -export interface GrantInjectable extends Injectable { - grant(taskDefinition: ecs.TaskDefinition): void; -} - -/** - * The settings for the `InjectableTopic` class. - */ -export interface InjectableTopicProps { - /** - * The SNS Topic to publish events to. - */ - readonly topic: sns.ITopic; -} - -/** - * The `InjectableTopic` class represents SNS Topic resource that can be published events to by the parent service. - */ - -export class InjectableTopic implements GrantInjectable { - public readonly topic: sns.ITopic; - - constructor(props: InjectableTopicProps) { - this.topic = props.topic; - } - - public grant(taskDefinition: ecs.TaskDefinition) { - this.topic.grantPublish(taskDefinition.taskRole); - } - - public environmentVariables(): { [key: string]: string } { - let environment: { [key: string]: string } = {}; - environment[`${this.topic.node.id.toUpperCase()}_TOPIC_ARN`] = this.topic.topicArn; - return environment; - } -} - -/** - * The settings for the Injecter extension. - */ -export interface InjecterExtensionProps { - /** - * The list of injectable resources for this service. - */ - readonly injectables: Injectable[]; -} - -/** - * Settings for the hook which mutates the application container - * to add the injectable resource environment variables. - */ -interface ContainerMutatingProps { - /** - * The resource environment variables to be added to the container environment. - */ - readonly environment: { [key: string]: string }; -} - -/** - * This hook modifies the application container's environment to - * add the injectable resource environment variables. - */ -class InjecterExtensionMutatingHook extends ContainerMutatingHook { - private environment: { [key: string]: string }; - - constructor(props: ContainerMutatingProps) { - super(); - this.environment = props.environment; - } - - public mutateContainerDefinition(props: ecs.ContainerDefinitionOptions): ecs.ContainerDefinitionOptions { - return { - ...props, - - environment: { ...(props.environment || {}), ...this.environment }, - } as ecs.ContainerDefinitionOptions; - } -} - -/** - * This extension accepts a list of `Injectable` resources that the parent service can publish events or write data to. - * It sets up the corresponding permissions for the task role of the parent service. - */ -export class InjecterExtension extends ServiceExtension { - private props: InjecterExtensionProps; - - private environment: { [key: string]: string } = {}; - - constructor(props: InjecterExtensionProps) { - super('injecter'); - - this.props = props; - } - - // @ts-ignore - Ignore unused params that are required for abstract class extend - public prehook(service: Service, scope: Construct) { - this.parentService = service; - - for (const injectable of this.props.injectables) { - for (const [key, val] of Object.entries(injectable.environmentVariables())) { - this.environment[key] = val; - } - } - } - - /** - * Add hooks to the main application extension so that it is modified to - * add the injectable resource environment variables to the container environment. - */ - public addHooks() { - const container = this.parentService.serviceDescription.get('service-container') as Container; - - if (!container) { - throw new Error('Injecter Extension requires an application extension'); - } - - container.addContainerMutatingHook(new InjecterExtensionMutatingHook({ - environment: this.environment, - })); - } - - /** - * After the task definition has been created, this hook grants the required permissions to the task role for the - * parent service. - * - * @param taskDefinition The created task definition - */ - public useTaskDefinition(taskDefinition: ecs.TaskDefinition) { - for (const injectable of this.props.injectables) { - if ((injectable as GrantInjectable).grant !== undefined) { - (injectable as GrantInjectable).grant(taskDefinition); - } - } - } -} diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/queue/index.ts b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/queue/index.ts deleted file mode 100644 index 1abfa1e06c359..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/queue/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './queue'; \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/queue/lambda/index.py b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/queue/lambda/index.py deleted file mode 100644 index d24454171e478..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/queue/lambda/index.py +++ /dev/null @@ -1,15 +0,0 @@ -import os -import boto3 -from queue_backlog_calculator import QueueHandler - -def queue_handler(event, context): - """ - Handler for the lambda trigger - """ - - ecs = boto3.client('ecs') - sqs = boto3.client('sqs') - - queue_handler = QueueHandler(ecs_client=ecs, sqs_client=sqs, environ=os.environ) - - return queue_handler.emit() diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/queue/lambda/queue_backlog_calculator.py b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/queue/lambda/queue_backlog_calculator.py deleted file mode 100644 index 5f14d74a76bd2..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/queue/lambda/queue_backlog_calculator.py +++ /dev/null @@ -1,71 +0,0 @@ -from math import ceil -import time -import json - -class QueueHandler: - def __init__(self, ecs_client, sqs_client, environ): - self.ecs = ecs_client - self.sqs = sqs_client - self.cluster_name = environ['CLUSTER_NAME'] - self.service_name = environ['SERVICE_NAME'] - self.namespace = environ['NAMESPACE'] - self.queue_names = environ['QUEUE_NAMES'].split(',') - - def emit(self): - try: - running_count = self.get_running_task_count() - backlogs = [self.get_queue_backlog(queue_name, running_count) for queue_name in self.queue_names] - self.timestamp = int(time.time() * 1000) - for backlog in backlogs: - self.emit_backlog_per_task_metric(backlog['queueName'], backlog['backlogPerTask']) - except Exception as e: - Exception('Exception: {}'.format(e)) - - """ - Write the backlogPerTask metric to the stdout according to the Cloudwatch embedded metric format. - """ - def emit_backlog_per_task_metric(self, queue_name, backlog_per_task): - print(json.dumps({ - "_aws": { - "Timestamp": self.timestamp, - "CloudWatchMetrics": [{ - "Namespace": self.namespace, - "Dimensions": [["QueueName"]], - "Metrics": [{"Name":"BacklogPerTask", "Unit": "Count"}] - }], - }, - "QueueName": queue_name, - "BacklogPerTask": backlog_per_task, - })) - - """ - Get the number of tasks in the 'RUNNING' state for the service 'service_name'. - """ - def get_running_task_count(self): - service_desc = self.ecs.describe_services( - cluster=self.cluster_name, - services=[self.service_name], - ) - if len(service_desc['services']) == 0: - raise Exception('There are no services with name {} in cluster: {}'.format(self.service_name, self.cluster_name)) - return service_desc['services'][0].get('runningCount', 0) - - """ - This method calculates and returns the backlogPerTask metric for the given queue. - """ - def get_queue_backlog(self, queue_name, count): - queue_url = self.sqs.get_queue_url(QueueName=queue_name) - running_count = 1 if count == 0 else count - - def get_backlog_per_task(): - queue_attributes = self.sqs.get_queue_attributes( - QueueUrl=queue_url['QueueUrl'], - AttributeNames=['ApproximateNumberOfMessages'] - ) - num_of_msgs = int(queue_attributes['Attributes'].get('ApproximateNumberOfMessages', 0)) - return ceil(num_of_msgs/running_count) - - return { - 'queueName': queue_name, - 'backlogPerTask': get_backlog_per_task() - } \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/queue/queue.ts b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/queue/queue.ts deleted file mode 100644 index 8fff61170176d..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/queue/queue.ts +++ /dev/null @@ -1,415 +0,0 @@ -import * as path from 'path'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as events from '@aws-cdk/aws-events'; -import * as events_targets from '@aws-cdk/aws-events-targets'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as logs from '@aws-cdk/aws-logs'; -import * as sns from '@aws-cdk/aws-sns'; -import * as subscription from '@aws-cdk/aws-sns-subscriptions'; -import * as sqs from '@aws-cdk/aws-sqs'; -import * as cdk from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { Service } from '../../service'; -import { Container } from '../container'; -import { ContainerMutatingHook, ServiceExtension } from '../extension-interfaces'; - -/** - * An interface that will be implemented by all the resources that can be subscribed to. - */ -export interface ISubscribable { - /** - * The `SubscriptionQueue` object for the `ISubscribable` object. - * - * @default none - */ - readonly subscriptionQueue?: SubscriptionQueue; - - /** - * All classes implementing this interface must also implement the `subscribe()` method - */ - subscribe(extension: QueueExtension): sqs.IQueue; -} - -/** - * The settings for the Queue extension. - */ -export interface QueueExtensionProps { - /** - * The list of subscriptions for this service. - * - * @default none - */ - readonly subscriptions?: ISubscribable[]; - - /** - * The user-provided default queue for this service. - * If the `eventsQueue` is not provided, a default SQS Queue is created for the service. - * - * @default none - */ - readonly eventsQueue?: sqs.IQueue; - - /** - * The user-provided queue delay fields to configure auto scaling for the default queue. - * - * @default none - */ - readonly scaleOnLatency?: QueueAutoScalingOptions; -} - -/** - * The topic-specific settings for creating the queue subscriptions. - */ -export interface TopicSubscriptionProps { - /** - * The SNS Topic to subscribe to. - */ - readonly topic: sns.ITopic; - - /** - * The user-provided queue to subscribe to the given topic. - * - * @default none - * @deprecated use `topicSubscriptionQueue` - */ - readonly queue?: sqs.IQueue; - - /** - * The object representing topic-specific queue and corresponding queue delay fields to configure auto scaling. - * If not provided, the default `eventsQueue` will subscribe to the given topic. - * - * @default none - */ - readonly topicSubscriptionQueue?: SubscriptionQueue; -} - -/** - * `SubscriptionQueue` represents the subscription queue object which includes the topic-specific queue and its - * corresponding auto scaling fields. - */ -interface SubscriptionQueue { - /** - * The user-provided queue to subscribe to the given topic. - */ - readonly queue: sqs.IQueue; - - /** - * The user-provided queue delay fields to configure auto scaling for the topic-specific queue. - * - * @default none - */ - readonly scaleOnLatency?: QueueAutoScalingOptions; -} - -/** - * Options for configuring SQS Queue auto scaling. - */ -interface QueueAutoScalingOptions { - /** - * Average amount of time for processing a single message in the queue. - */ - readonly messageProcessingTime: cdk.Duration; - - /** - * Acceptable amount of time a message can sit in the queue (including the time required to process it). - */ - readonly acceptableLatency: cdk.Duration; -} - -/** - * The `TopicSubscription` class represents an SNS Topic resource that can be subscribed to by the service queues. - */ -export class TopicSubscription implements ISubscribable { - public readonly topic: sns.ITopic; - - /** - * The queue that subscribes to the given topic. - * - * @default none - * @deprecated use `subscriptionQueue` - */ - public readonly queue?: sqs.IQueue; - - /** - * The subscription queue object for this subscription. - * - * @default none - */ - public readonly subscriptionQueue?: SubscriptionQueue; - - constructor(props: TopicSubscriptionProps) { - this.topic = props.topic; - - if (props.topicSubscriptionQueue && props.queue) { - throw Error('Either provide the `subscriptionQueue` or the `queue` (deprecated) for the topic subscription, but not both.'); - } - this.subscriptionQueue = props.topicSubscriptionQueue; - this.queue = props.queue ?? props.topicSubscriptionQueue?.queue; - } - - /** - * This method sets up SNS Topic subscriptions for the SQS queue provided by the user. If a `queue` is not provided, - * the default `eventsQueue` subscribes to the given topic. - * - * @param extension `QueueExtension` added to the service - * @returns the queue subscribed to the given topic - */ - public subscribe(extension: QueueExtension) : sqs.IQueue { - const queue = this.subscriptionQueue?.queue ?? this.queue ?? extension.eventsQueue; - this.topic.addSubscription(new subscription.SqsSubscription(queue)); - return queue; - } -} - -/** - * Settings for the hook which mutates the application container - * to add the events queue URI to its environment. - */ -interface ContainerMutatingProps { - /** - * The events queue name and URI to be added to the container environment. - */ - readonly environment: { [key: string]: string }; -} - -/** - * This hook modifies the application container's environment to - * add the queue URL for the events queue of the service. - */ -class QueueExtensionMutatingHook extends ContainerMutatingHook { - private environment: { [key: string]: string }; - - constructor(props: ContainerMutatingProps) { - super(); - this.environment = props.environment; - } - - public mutateContainerDefinition(props: ecs.ContainerDefinitionOptions): ecs.ContainerDefinitionOptions { - return { - ...props, - - environment: { ...(props.environment || {}), ...this.environment }, - } as ecs.ContainerDefinitionOptions; - } -} - -/** - * This extension creates a default `eventsQueue` for the service (if not provided) and accepts a list of objects of - * type `ISubscribable` that the `eventsQueue` subscribes to. It creates the subscriptions and sets up permissions - * for the service to consume messages from the SQS Queues. - * - * It also configures a target tracking scaling policy for the service to maintain an acceptable queue latency by tracking - * the backlog per task. For more information, please refer: https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-using-sqs-queue.html . - * - * The default queue for this service can be accessed using the getter `.eventsQueue`. - */ -export class QueueExtension extends ServiceExtension { - private _eventsQueue!: sqs.IQueue; - - private _autoscalingOptions?: QueueAutoScalingOptions; - - private subscriptionQueues = new Set(); - - private environment: { [key: string]: string } = {}; - - private props?: QueueExtensionProps; - - /** - * The log group created by the extension where the AWS Lambda function logs are stored. - */ - public logGroup?: logs.ILogGroup; - - constructor(props?: QueueExtensionProps) { - super('queue'); - - this.props = props; - } - - /** - * This hook creates (if required) and sets the default queue `eventsQueue`. It also sets up the subscriptions for - * the provided `ISubscribable` objects. - * - * @param service The parent service which this extension has been added to - * @param scope The scope that this extension should create resources in - */ - public prehook(service: Service, scope: Construct) { - this.parentService = service; - this.scope = scope; - - let eventsQueue = this.props?.eventsQueue; - if (!eventsQueue) { - const deadLetterQueue = new sqs.Queue(this.scope, 'EventsDeadLetterQueue', { - retentionPeriod: cdk.Duration.days(14), - }); - - eventsQueue = new sqs.Queue(this.scope, 'EventsQueue', { - deadLetterQueue: { - queue: deadLetterQueue, - maxReceiveCount: 3, - }, - }); - } - this._eventsQueue = eventsQueue; - this._autoscalingOptions = this.props?.scaleOnLatency; - - this.environment[`${this.parentService.id.toUpperCase()}_QUEUE_URI`] = this._eventsQueue.queueUrl; - - if (this.props?.subscriptions) { - for (const subs of this.props.subscriptions) { - const subsQueue = subs.subscribe(this); - if (subsQueue !== this._eventsQueue) { - if (subs.subscriptionQueue?.scaleOnLatency && !this._autoscalingOptions) { - throw Error(`Autoscaling for a topic-specific queue cannot be configured as autoscaling based on SQS Queues hasn’t been set up for the service '${this.parentService.id}'. If you want to enable autoscaling for this service, please also specify 'scaleOnLatency' in the 'QueueExtension'.`); - } - const subscriptionQueue = subs.subscriptionQueue ?? { - queue: subsQueue, - } as SubscriptionQueue; - this.subscriptionQueues.add(subscriptionQueue); - } - } - } - } - - /** - * Add hooks to the main application extension so that it is modified to - * add the events queue URL to the container environment. - */ - public addHooks() { - const container = this.parentService.serviceDescription.get('service-container') as Container; - - if (!container) { - throw new Error('Queue Extension requires an application extension'); - } - - container.addContainerMutatingHook(new QueueExtensionMutatingHook({ - environment: this.environment, - })); - } - - /** - * After the task definition has been created, this hook grants SQS permissions to the task role. - * - * @param taskDefinition The created task definition - */ - public useTaskDefinition(taskDefinition: ecs.TaskDefinition) { - this._eventsQueue.grantConsumeMessages(taskDefinition.taskRole); - for (const subsQueue of this.subscriptionQueues) { - subsQueue.queue.grantConsumeMessages(taskDefinition.taskRole); - } - } - - /** - * When this hook is implemented by extension, it allows the extension - * to use the service which has been created. It is used to add target tracking - * scaling policies for the SQS Queues of the service. It also creates an AWS Lambda - * Function for calculating the backlog per task metric. - * - * @param service - The generated service. - */ - public useService(service: ecs.Ec2Service | ecs.FargateService) { - if (!this._autoscalingOptions) { - return; - } - if (!this.parentService.scalableTaskCount) { - throw Error(`Auto scaling target for the service '${this.parentService.id}' hasn't been configured. Please use Service construct to configure 'minTaskCount' and 'maxTaskCount'.`); - } - - this.addQueueScalingPolicy(this._eventsQueue, this._autoscalingOptions); - for (const subsQueue of this.subscriptionQueues) { - const autoscalingOpts = subsQueue.scaleOnLatency ?? this._autoscalingOptions; - this.addQueueScalingPolicy(subsQueue.queue, autoscalingOpts!); - } - this.parentService.enableAutoScalingPolicy(); - - this.createLambdaFunction(service); - } - - /** - * This method adds a target tracking policy based on the backlog per task custom metric - * to the auto scaling target configured for this service. - * - * @param queue The queue for which backlog per task metric is being configured - * @param queueDelay The auto scaling options for the queue - */ - private addQueueScalingPolicy(queue: sqs.IQueue, queueDelay: QueueAutoScalingOptions) { - const messageProcessingTime = queueDelay.messageProcessingTime.toSeconds(); - const acceptableLatency = queueDelay.acceptableLatency.toSeconds(); - if (messageProcessingTime > acceptableLatency) { - throw Error(`Message processing time (${messageProcessingTime}s) for the queue cannot be greater acceptable queue latency (${acceptableLatency}s).`); - } - const acceptableBacklog = acceptableLatency/messageProcessingTime; - - this.parentService.scalableTaskCount?.scaleToTrackCustomMetric(`${queue.node.id}-autoscaling-policy`, { - metric: new cloudwatch.Metric({ - namespace: `${this.parentService.environment.id}-${this.parentService.id}`, - metricName: 'BacklogPerTask', - dimensionsMap: { QueueName: queue.queueName }, - unit: cloudwatch.Unit.COUNT, - }), - targetValue: acceptableBacklog, - }); - } - - /** - * This method is used to create the AWS Lambda Function for calculating backlog - * per task metric and a Cloudwatch event trigger for this function. - * - * @param service - The generated service. - */ - private createLambdaFunction(service: ecs.Ec2Service | ecs.FargateService) { - const queueNames = [this._eventsQueue.queueName]; - this.subscriptionQueues.forEach(subs => queueNames.push(subs.queue.queueName)); - - const backLogPerTaskCalculator = new lambda.Function(this.scope, 'BackLogPerTaskCalculatorFunction', { - runtime: lambda.Runtime.PYTHON_3_9, - code: lambda.Code.fromAsset(path.join(__dirname, 'lambda')), - handler: 'index.queue_handler', - environment: { - CLUSTER_NAME: this.parentService.cluster.clusterName, - SERVICE_NAME: service.serviceName, - NAMESPACE: `${this.parentService.environment.id}-${this.parentService.id}`, - QUEUE_NAMES: queueNames.join(','), - }, - initialPolicy: [new iam.PolicyStatement({ - actions: ['ecs:DescribeServices'], - resources: [`${service.serviceArn}`], - conditions: { - ArnEquals: { - 'ecs:cluster': this.parentService.cluster.clusterArn, - }, - }, - })], - }); - - const queueArns = [this._eventsQueue.queueArn]; - this.subscriptionQueues.forEach(subs => queueArns.push(subs.queue.queueArn)); - backLogPerTaskCalculator.grantPrincipal.addToPrincipalPolicy(new iam.PolicyStatement({ - actions: [ - 'sqs:GetQueueAttributes', - 'sqs:GetQueueUrl', - ], - resources: queueArns, - })); - - new events.Rule(this.scope, 'BacklogPerTaskScheduledRule', { - schedule: events.Schedule.rate(cdk.Duration.seconds(60)), - targets: [new events_targets.LambdaFunction(backLogPerTaskCalculator)], - }); - - this.logGroup = new logs.LogGroup(this.scope, `${this.parentService.id}-BackLogPerTaskCalculatorLogs`, { - logGroupName: `/aws/lambda/${backLogPerTaskCalculator.functionName}`, - removalPolicy: cdk.RemovalPolicy.DESTROY, - retention: logs.RetentionDays.THREE_DAYS, - }); - } - - public get eventsQueue() : sqs.IQueue { - return this._eventsQueue; - } - - public get autoscalingOptions() : QueueAutoScalingOptions | undefined { - return this._autoscalingOptions; - } -} diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/scale-on-cpu-utilization.ts b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/scale-on-cpu-utilization.ts deleted file mode 100644 index 4c3661424f52f..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/scale-on-cpu-utilization.ts +++ /dev/null @@ -1,152 +0,0 @@ -import * as ecs from '@aws-cdk/aws-ecs'; -import * as cdk from '@aws-cdk/core'; -import { ServiceExtension, ServiceBuild } from './extension-interfaces'; - - -/** - * The autoscaling settings. - * - * @deprecated use the `minTaskCount` and `maxTaskCount` properties of `autoScaleTaskCount` in the `Service` construct - * to configure the auto scaling target for the service. For more information, please refer - * https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk-containers/ecs-service-extensions/README.md#task-auto-scaling . - */ -export interface CpuScalingProps { - /** - * How many tasks to launch initially. - * - * @default - 2 - */ - readonly initialTaskCount?: number; - - /** - * The minimum number of tasks when scaling in. - * - * @default - 2 - */ - readonly minTaskCount?: number; - - /** - * The maximum number of tasks when scaling out. - * - * @default - 8 - */ - readonly maxTaskCount?: number; - - /** - * The CPU utilization to try ot maintain. - * - * @default - 50% - */ - readonly targetCpuUtilization?: number; - - /** - * How long to wait between scale out actions. - * - * @default - 60 seconds - */ - readonly scaleOutCooldown?: cdk.Duration; - - /** - * How long to wait between scale in actions. - * - * @default - 60 seconds - */ - readonly scaleInCooldown?: cdk.Duration; -} - -// The default autoscaling settings -const cpuScalingPropsDefault = { - initialTaskCount: 2, - minTaskCount: 2, - maxTaskCount: 8, - targetCpuUtilization: 50, - scaleOutCooldown: cdk.Duration.seconds(60), - scaleInCooldown: cdk.Duration.seconds(60), -}; - -/** - * This extension helps you scale your service according to CPU utilization. - * - * @deprecated To enable target tracking based on CPU utilization, use the `targetCpuUtilization` property of `autoScaleTaskCount` in the `Service` construct. - * For more information, please refer https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk-containers/ecs-service-extensions/README.md#task-auto-scaling . - */ -export class ScaleOnCpuUtilization extends ServiceExtension { - /** - * How many tasks to launch initially. - */ - public readonly initialTaskCount: number; - - /** - * The minimum number of tasks when scaling in. - */ - public readonly minTaskCount: number; - - /** - * The maximum number of tasks when scaling out. - */ - public readonly maxTaskCount: number; - - /** - * The CPU utilization to try ot maintain. - */ - public readonly targetCpuUtilization: number; - - /** - * How long to wait between scale out actions. - */ - public readonly scaleOutCooldown: cdk.Duration; - - /** - * How long to wait between scale in actions. - */ - public readonly scaleInCooldown: cdk.Duration; - - constructor(props?: CpuScalingProps) { - super('scale-on-cpu-utilization'); - - let combinedProps = { - ...cpuScalingPropsDefault, - ...props, - }; - - this.initialTaskCount = combinedProps.initialTaskCount; - this.minTaskCount = combinedProps.minTaskCount; - this.maxTaskCount = combinedProps.maxTaskCount; - this.targetCpuUtilization = combinedProps.targetCpuUtilization; - this.scaleOutCooldown = combinedProps.scaleOutCooldown; - this.scaleInCooldown = combinedProps.scaleInCooldown; - } - - // This service modifies properties of the service prior - // to construct creation. - public modifyServiceProps(props: ServiceBuild): ServiceBuild { - return { - ...props, - - // Launch an initial number of tasks - // In the future we should change this to use a custom resource - // to read the current task count set by autoscaling, so that the task - // count doesn't rollback to the initial level on each deploy. - desiredCount: this.initialTaskCount, - } as ServiceBuild; - } - - // This hook utilizes the resulting service construct - // once it is created. - public useService(service: ecs.Ec2Service | ecs.FargateService) { - if (this.parentService.scalableTaskCount) { - throw Error('Cannot specify \'autoScaleTaskCount\' in the Service construct and also provide a \'ScaleOnCpuUtilization\' extension. \'ScaleOnCpuUtilization\' is deprecated. Please only provide \'autoScaleTaskCount\'.'); - } - const scalingTarget = service.autoScaleTaskCount({ - minCapacity: this.minTaskCount, - maxCapacity: this.maxTaskCount, - }); - - scalingTarget.scaleOnCpuUtilization(`${this.parentService.id}-target-cpu-utilization-${this.targetCpuUtilization}`, { - targetUtilizationPercent: this.targetCpuUtilization, - scaleInCooldown: this.scaleInCooldown, - scaleOutCooldown: this.scaleOutCooldown, - }); - this.parentService.enableAutoScalingPolicy(); - } -} diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/xray.ts b/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/xray.ts deleted file mode 100644 index 1950360b2e17c..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/xray.ts +++ /dev/null @@ -1,67 +0,0 @@ -import * as ecs from '@aws-cdk/aws-ecs'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { Service } from '../service'; -import { ServiceExtension } from './extension-interfaces'; - -const XRAY_DAEMON_IMAGE = 'amazon/aws-xray-daemon:latest'; - -/** - * This extension adds an X-Ray daemon inside the task definition for - * capturing application trace spans and submitting them to the AWS - * X-Ray service. - */ -export class XRayExtension extends ServiceExtension { - constructor() { - super('xray'); - } - - // @ts-ignore - Ignore unused params that are required for abstract class extend - public prehook(service: Service, scope: Construct) { - this.parentService = service; - } - - public useTaskDefinition(taskDefinition: ecs.TaskDefinition) { - // Add the XRay Daemon to the task - this.container = taskDefinition.addContainer('xray', { - image: ecs.ContainerImage.fromRegistry(XRAY_DAEMON_IMAGE), - essential: true, - memoryReservationMiB: 256, - environment: { - AWS_REGION: cdk.Stack.of(this.parentService).region, - }, - healthCheck: { - command: [ - 'CMD-SHELL', - 'curl -s http://localhost:2000', - ], - startPeriod: cdk.Duration.seconds(10), - interval: cdk.Duration.seconds(5), - timeout: cdk.Duration.seconds(2), - retries: 3, - }, - logging: new ecs.AwsLogDriver({ streamPrefix: 'xray' }), - user: '1337', // X-Ray traffic should not go through Envoy proxy - }); - - // Add permissions to this task to allow it to talk to X-Ray - taskDefinition.taskRole.addManagedPolicy( - iam.ManagedPolicy.fromAwsManagedPolicyName('AWSXRayDaemonWriteAccess'), - ); - } - - public resolveContainerDependencies() { - if (!this.container) { - throw new Error('The container dependency hook was called before the container was created'); - } - - const appmeshextension = this.parentService.serviceDescription.get('appmesh'); - if (appmeshextension && appmeshextension.container) { - this.container.addContainerDependencies({ - container: appmeshextension.container, - condition: ecs.ContainerDependencyCondition.HEALTHY, - }); - } - } -} diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/index.ts b/packages/@aws-cdk-containers/ecs-service-extensions/lib/index.ts deleted file mode 100644 index 04a891f556dd7..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './service'; -export * from './service-description'; -export * from './environment'; -export * from './extensions'; -export * from './extensions/extension-interfaces'; \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/service-description.ts b/packages/@aws-cdk-containers/ecs-service-extensions/lib/service-description.ts deleted file mode 100644 index eb26905a5baa9..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/service-description.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { ServiceExtension } from './extensions/extension-interfaces'; - -/** - * A ServiceDescription is a wrapper for all of the extensions that a user wants - * to add to an ECS Service. It collects all of the extensions that are added - * to a service, allowing each extension to query the full list of extensions - * added to a service to determine information about how to self-configure. - */ -export class ServiceDescription { - /** - * The list of extensions that have been registered to run when - * preparing this service. - */ - public extensions: Record = {}; - - /** - * Adds a new extension to the service. The extensions mutate a service - * to add resources to or configure properties for the service. - * - * @param extension - The extension that you wish to add - */ - public add(extension: ServiceExtension) { - if (this.extensions[extension.name]) { - throw new Error(`An extension called ${extension.name} has already been added`); - } - - this.extensions[extension.name] = extension; - - return this; - } - - /** - * Get the extension with a specific name. This is generally used by - * extensions in order to discover each other. - * - * @param name - */ - public get(name: string) { - return this.extensions[name]; - } -}; diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/lib/service.ts b/packages/@aws-cdk-containers/ecs-service-extensions/lib/service.ts deleted file mode 100644 index 41b90085953a3..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/lib/service.ts +++ /dev/null @@ -1,372 +0,0 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as iam from '@aws-cdk/aws-iam'; -import { Construct } from 'constructs'; -import { IEnvironment } from './environment'; -import { EnvironmentCapacityType, ServiceBuild } from './extensions/extension-interfaces'; -import { ServiceDescription } from './service-description'; - -/** - * connectToProps will have all the extra parameters which are required for connecting services. - */ -export interface ConnectToProps { - /** - * local_bind_port is the local port that this application should - * use when calling the upstream service in ECS Consul Mesh Extension - * Currently, this parameter will only be used in the ECSConsulMeshExtension - * https://github.com/aws-ia/ecs-consul-mesh-extension - */ - readonly local_bind_port?: number; -} - -/** - * The settings for an ECS Service. - */ -export interface ServiceProps { - /** - * The ServiceDescription used to build the service. - */ - readonly serviceDescription: ServiceDescription; - - /** - * The environment to launch the service in. - */ - readonly environment: IEnvironment - - /** - * The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf. - * - * @default - A task role is automatically created for you. - */ - readonly taskRole?: iam.IRole; - - /** - * The desired number of instantiations of the task definition to keep running on the service. - * - * @default - When creating the service, default is 1; when updating the service, default uses - * the current task number. - */ - readonly desiredCount?: number; - - /** - * The options for configuring the auto scaling target. - * - * @default none - */ - readonly autoScaleTaskCount?: AutoScalingOptions; -} - -export interface AutoScalingOptions { - /** - * The minimum number of tasks when scaling in. - * - * @default - 1 - */ - readonly minTaskCount?: number; - - /** - * The maximum number of tasks when scaling out. - */ - readonly maxTaskCount: number; - - /** - * The target value for CPU utilization across all tasks in the service. - */ - readonly targetCpuUtilization?: number; - - /** - * The target value for memory utilization across all tasks in the service. - */ - readonly targetMemoryUtilization?: number; -} - -/** - * This Service construct serves as a Builder class for an ECS service. It - * supports various extensions and keeps track of any mutating state, allowing - * it to build up an ECS service progressively. - */ -export class Service extends Construct { - /** - * The underlying ECS service that was created. - */ - public ecsService!: ecs.Ec2Service | ecs.FargateService; - - /** - * The name of the service. - */ - public readonly id: string; - - /** - * The VPC where this service should be placed. - */ - public readonly vpc: ec2.IVpc; - - /** - * The cluster that is providing capacity for this service. - * [disable-awslint:ref-via-interface] - */ - public readonly cluster: ecs.ICluster; - - /** - * The capacity type that this service will use. - * Valid values are EC2 or FARGATE. - */ - public readonly capacityType: EnvironmentCapacityType; - - /** - * The ServiceDescription used to build this service. - */ - public readonly serviceDescription: ServiceDescription; - - /** - * The environment where this service was launched. - */ - public readonly environment: IEnvironment; - - /** - * The scalable attribute representing task count. - */ - public readonly scalableTaskCount?: ecs.ScalableTaskCount; - - /** - * The flag to track if auto scaling policies have been configured - * for the service. - */ - private autoScalingPoliciesEnabled: boolean = false; - - /** - * The generated task definition for this service. It is only - * generated after .prepare() has been executed. - */ - protected taskDefinition!: ecs.TaskDefinition; - - /** - * The list of URLs associated with this service. - */ - private urls: Record = {}; - - private readonly scope: Construct; - - constructor(scope: Construct, id: string, props: ServiceProps) { - super(scope, id); - - this.scope = scope; - this.id = id; - this.environment = props.environment; - this.vpc = props.environment.vpc; - this.cluster = props.environment.cluster; - this.capacityType = props.environment.capacityType; - this.serviceDescription = props.serviceDescription; - - // Check to make sure that the user has actually added a container - const containerextension = this.serviceDescription.get('service-container'); - - if (!containerextension) { - throw new Error(`Service '${this.id}' must have a Container extension`); - } - - // First set the scope for all the extensions - for (const extensions in this.serviceDescription.extensions) { - if (this.serviceDescription.extensions[extensions]) { - this.serviceDescription.extensions[extensions].prehook(this, this.scope); - } - } - - // At the point of preparation all extensions have been defined on the service - // so give each extension a chance to now add hooks to other extensions if - // needed - for (const extensions in this.serviceDescription.extensions) { - if (this.serviceDescription.extensions[extensions]) { - this.serviceDescription.extensions[extensions].addHooks(); - } - } - - // Give each extension a chance to mutate the task def creation properties - let taskDefProps = { - // Default CPU and memory - cpu: '256', - memory: '512', - - // Allow user to pre-define the taskRole so that it can be used in resource policies that may - // be defined before the ECS service exists in a CDK application - taskRole: props.taskRole, - - // Ensure that the task definition supports both EC2 and Fargate - compatibility: ecs.Compatibility.EC2_AND_FARGATE, - } as ecs.TaskDefinitionProps; - for (const extensions in this.serviceDescription.extensions) { - if (this.serviceDescription.extensions[extensions]) { - taskDefProps = this.serviceDescription.extensions[extensions].modifyTaskDefinitionProps(taskDefProps); - } - } - - // Now that the task definition properties are assembled, create it - this.taskDefinition = new ecs.TaskDefinition(this.scope, `${this.id}-task-definition`, taskDefProps); - - // Now give each extension a chance to use the task definition - for (const extensions in this.serviceDescription.extensions) { - if (this.serviceDescription.extensions[extensions]) { - this.serviceDescription.extensions[extensions].useTaskDefinition(this.taskDefinition); - } - } - - // Now that all containers are created, give each extension a chance - // to bake its dependency graph - for (const extensions in this.serviceDescription.extensions) { - if (this.serviceDescription.extensions[extensions]) { - this.serviceDescription.extensions[extensions].resolveContainerDependencies(); - } - } - - // Give each extension a chance to mutate the service props before - // service creation - let serviceProps = { - cluster: this.cluster, - taskDefinition: this.taskDefinition, - minHealthyPercent: 100, - maxHealthyPercent: 200, - desiredCount: props.desiredCount ?? 1, - } as ServiceBuild; - - for (const extensions in this.serviceDescription.extensions) { - if (this.serviceDescription.extensions[extensions]) { - serviceProps = this.serviceDescription.extensions[extensions].modifyServiceProps(serviceProps); - } - } - - // If a maxHealthyPercent and desired count has been set while minHealthyPercent == 100% then we - // need to do some failsafe checking to ensure that the maxHealthyPercent - // actually allows a rolling deploy. Otherwise it is possible to end up with - // blocked deploys that can take no action because minHealtyhPercent == 100% - // prevents running, healthy tasks from being stopped, but a low maxHealthyPercent - // can also prevents new parallel tasks from being started. - if (serviceProps.maxHealthyPercent && serviceProps.desiredCount && serviceProps.minHealthyPercent && serviceProps.minHealthyPercent == 100) { - if (serviceProps.desiredCount == 1) { - // If there is one task then we must allow max percentage to be at - // least 200% for another replacement task to be added - serviceProps = { - ...serviceProps, - maxHealthyPercent: Math.max(200, serviceProps.maxHealthyPercent), - }; - } else if (serviceProps.desiredCount <= 3) { - // If task count is 2 or 3 then max percent must be at least 150% to - // allow one replacement task to be launched at a time. - serviceProps = { - ...serviceProps, - maxHealthyPercent: Math.max(150, serviceProps.maxHealthyPercent), - }; - } else { - // For anything higher than 3 tasks set max percent to at least 125% - // For 4 tasks this will allow exactly one extra replacement task - // at a time, for any higher task count it will allow 25% of the tasks - // to be replaced at a time. - serviceProps = { - ...serviceProps, - maxHealthyPercent: Math.max(125, serviceProps.maxHealthyPercent), - }; - } - } - - // Set desiredCount to `undefined` if auto scaling is configured for the service - if (props.autoScaleTaskCount || this.autoScalingPoliciesEnabled) { - serviceProps = { - ...serviceProps, - desiredCount: undefined, - }; - } - - // Now that the service props are determined we can create - // the service - if (this.capacityType === EnvironmentCapacityType.EC2) { - this.ecsService = new ecs.Ec2Service(this.scope, `${this.id}-service`, serviceProps); - } else if (this.capacityType === EnvironmentCapacityType.FARGATE) { - this.ecsService = new ecs.FargateService(this.scope, `${this.id}-service`, serviceProps); - } else { - throw new Error(`Unknown capacity type for service ${this.id}`); - } - - // Create the auto scaling target and configure target tracking policies after the service is created - if (props.autoScaleTaskCount) { - this.scalableTaskCount = this.ecsService.autoScaleTaskCount({ - maxCapacity: props.autoScaleTaskCount.maxTaskCount, - minCapacity: props.autoScaleTaskCount.minTaskCount, - }); - - if (props.autoScaleTaskCount.targetCpuUtilization) { - const targetCpuUtilizationPercent = props.autoScaleTaskCount.targetCpuUtilization; - this.scalableTaskCount.scaleOnCpuUtilization(`${this.id}-target-cpu-utilization-${targetCpuUtilizationPercent}`, { - targetUtilizationPercent: targetCpuUtilizationPercent, - }); - this.enableAutoScalingPolicy(); - } - - if (props.autoScaleTaskCount.targetMemoryUtilization) { - const targetMemoryUtilizationPercent = props.autoScaleTaskCount.targetMemoryUtilization; - this.scalableTaskCount.scaleOnMemoryUtilization(`${this.id}-target-memory-utilization-${targetMemoryUtilizationPercent}`, { - targetUtilizationPercent: targetMemoryUtilizationPercent, - }); - this.enableAutoScalingPolicy(); - } - } - - // Now give all extensions a chance to use the service - for (const extensions in this.serviceDescription.extensions) { - if (this.serviceDescription.extensions[extensions]) { - this.serviceDescription.extensions[extensions].useService(this.ecsService); - } - } - - // Error out if the auto scaling target is created but no scaling policies have been configured - if (this.scalableTaskCount && !this.autoScalingPoliciesEnabled) { - throw Error(`The auto scaling target for the service '${this.id}' has been created but no auto scaling policies have been configured.`); - } - } - - /** - * Tell extensions from one service to connect to extensions from - * another sevice if they have implemented a hook for it. - * - * @param service - */ - public connectTo(service: Service, connectToProps: ConnectToProps = {}) { - for (const extensions in this.serviceDescription.extensions) { - if (this.serviceDescription.extensions[extensions]) { - this.serviceDescription.extensions[extensions].connectToService(service, connectToProps); - } - } - } - - /** - * This method adds a new URL for the service. This allows extensions to - * submit a URL for the service. For example, a load balancer might add its - * URL, or App Mesh can add its DNS name for the service. - * - * @param urlName - The identifier name for this URL - * @param url - The URL itself. - */ - public addURL(urlName: string, url: string) { - this.urls[urlName] = url; - } - - /** - * Retrieve a URL for the service. The URL must have previously been - * stored by one of the URL providing extensions. - * - * @param urlName - The URL to look up. - */ - public getURL(urlName: string) { - if (!this.urls[urlName]) { - throw new Error(`Unable to find a URL with name '${urlName}'`); - } - - return this.urls[urlName]; - } - - /** - * This helper method is used to set the `autoScalingPoliciesEnabled` attribute - * whenever an auto scaling policy is configured for the service. - */ - public enableAutoScalingPolicy() { - this.autoScalingPoliciesEnabled = true; - } -} diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/package.json b/packages/@aws-cdk-containers/ecs-service-extensions/package.json deleted file mode 100644 index c75e2ec6b364e..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/package.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "name": "@aws-cdk-containers/ecs-service-extensions", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library that helps you build ECS services using simple extensions", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk-containers/ecs-service-extensions" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "build+extract": "yarn build", - "build+test+extract": "yarn build+test" - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "ecs" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@types/jest": "^27.5.2", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/aws-autoscaling": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "jest": "^27.5.1", - "@aws-cdk/pkglint": "0.0.0", - "@aws-cdk/assertions": "0.0.0" - }, - "dependencies": { - "@aws-cdk/aws-applicationautoscaling": "0.0.0", - "@aws-cdk/aws-appmesh": "0.0.0", - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-dynamodb": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecr": "0.0.0", - "@aws-cdk/aws-ecs": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-events-targets": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-lambda-event-sources": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/aws-route53-targets": "0.0.0", - "@aws-cdk/aws-servicediscovery": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/aws-sns-subscriptions": "0.0.0", - "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "@aws-cdk/region-info": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-applicationautoscaling": "0.0.0", - "@aws-cdk/aws-appmesh": "0.0.0", - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-dynamodb": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecr": "0.0.0", - "@aws-cdk/aws-ecs": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-events-targets": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-lambda-event-sources": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/aws-route53-targets": "0.0.0", - "@aws-cdk/aws-servicediscovery": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/aws-sns-subscriptions": "0.0.0", - "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "@aws-cdk/region-info": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "stability": "stable", - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/all-service-addons.integ.snapshot/aws-ecs-integ.assets.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/all-service-addons.integ.snapshot/aws-ecs-integ.assets.json deleted file mode 100644 index d4a8ca27c5381..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/all-service-addons.integ.snapshot/aws-ecs-integ.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "20.0.0", - "files": { - "ad006ddc477f947f0d63b6eb67b02371ef18c9f3cb86353a3cab3704778a8be1": { - "source": { - "path": "aws-ecs-integ.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "ad006ddc477f947f0d63b6eb67b02371ef18c9f3cb86353a3cab3704778a8be1.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-containers/ecs-service-extensions/test/all-service-addons.integ.snapshot/aws-ecs-integ.template.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/all-service-addons.integ.snapshot/aws-ecs-integ.template.json deleted file mode 100644 index 4cde019057409..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/all-service-addons.integ.snapshot/aws-ecs-integ.template.json +++ /dev/null @@ -1,3321 +0,0 @@ -{ - "Resources": { - "mymeshEA67EDEF": { - "Type": "AWS::AppMesh::Mesh", - "Properties": { - "MeshName": "awsecsintegmymeshFCC0D554", - "Spec": {} - } - }, - "productionenvironmentvpcAEB47DF7": { - "Type": "AWS::EC2::VPC", - "Properties": { - "CidrBlock": "10.0.0.0/16", - "EnableDnsHostnames": true, - "EnableDnsSupport": true, - "InstanceTenancy": "default", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1Subnet8D92C089": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1RouteTableAssociationA8117374": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - } - } - }, - "productionenvironmentvpcPublicSubnet1DefaultRoute524C894D": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - }, - "DependsOn": [ - "productionenvironmentvpcVPCGW1B428D07" - ] - }, - "productionenvironmentvpcPublicSubnet1EIP54BA88DB": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1NATGateway6075E4CA": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - }, - "AllocationId": { - "Fn::GetAtt": [ - "productionenvironmentvpcPublicSubnet1EIP54BA88DB", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - }, - "DependsOn": [ - "productionenvironmentvpcPublicSubnet1DefaultRoute524C894D", - "productionenvironmentvpcPublicSubnet1RouteTableAssociationA8117374" - ] - }, - "productionenvironmentvpcPublicSubnet2Subnet298E6C31": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet2RouteTable842A68D7": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet2RouteTableAssociation0A7549F3": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet2RouteTable842A68D7" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - } - } - }, - "productionenvironmentvpcPublicSubnet2DefaultRoute92CD697D": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet2RouteTable842A68D7" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - }, - "DependsOn": [ - "productionenvironmentvpcVPCGW1B428D07" - ] - }, - "productionenvironmentvpcPublicSubnet2EIP14CA46AA": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet2NATGatewayE1850FCC": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - }, - "AllocationId": { - "Fn::GetAtt": [ - "productionenvironmentvpcPublicSubnet2EIP14CA46AA", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - }, - "DependsOn": [ - "productionenvironmentvpcPublicSubnet2DefaultRoute92CD697D", - "productionenvironmentvpcPublicSubnet2RouteTableAssociation0A7549F3" - ] - }, - "productionenvironmentvpcPrivateSubnet1Subnet53F632E6": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet1RouteTableAssociation8BA32463": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - } - } - }, - "productionenvironmentvpcPrivateSubnet1DefaultRouteFBB3DE6C": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "productionenvironmentvpcPublicSubnet1NATGateway6075E4CA" - } - } - }, - "productionenvironmentvpcPrivateSubnet2Subnet756FB93C": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet2RouteTableAssociation09188261": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - } - }, - "productionenvironmentvpcPrivateSubnet2DefaultRoute5F9AB6C1": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "productionenvironmentvpcPublicSubnet2NATGatewayE1850FCC" - } - } - }, - "productionenvironmentvpcIGWE7C39890": { - "Type": "AWS::EC2::InternetGateway", - "Properties": { - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc" - } - ] - } - }, - "productionenvironmentvpcVPCGW1B428D07": { - "Type": "AWS::EC2::VPCGatewayAttachment", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "InternetGatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - } - }, - "productionenvironmentclusterC6599D2D": { - "Type": "AWS::ECS::Cluster" - }, - "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D": { - "Type": "AWS::ServiceDiscovery::PrivateDnsNamespace", - "Properties": { - "Name": "production", - "Vpc": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "namelogsF4B17D31": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "name-logs", - "RetentionInDays": 7 - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "nametaskdefinitionTaskRole50FE844E": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/AWSXRayDaemonWriteAccess" - ] - ] - } - ] - } - }, - "nametaskdefinitionTaskRoleDefaultPolicyE66EDC68": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:DescribeLogStreams", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "nametaskdefinitionTaskRoleDefaultPolicyE66EDC68", - "Roles": [ - { - "Ref": "nametaskdefinitionTaskRole50FE844E" - } - ] - } - }, - "nametaskdefinition690762BB": { - "Type": "AWS::ECS::TaskDefinition", - "Properties": { - "ContainerDefinitions": [ - { - "Cpu": 1024, - "DependsOn": [ - { - "Condition": "START", - "ContainerName": "firelens" - }, - { - "Condition": "HEALTHY", - "ContainerName": "envoy" - }, - { - "Condition": "START", - "ContainerName": "cloudwatch-agent" - }, - { - "Condition": "HEALTHY", - "ContainerName": "xray" - } - ], - "Environment": [ - { - "Name": "PORT", - "Value": "80" - } - ], - "Essential": true, - "Image": "nathanpeck/name", - "LogConfiguration": { - "LogDriver": "awsfirelens", - "Options": { - "Name": "cloudwatch", - "region": { - "Ref": "AWS::Region" - }, - "log_group_name": { - "Ref": "namelogsF4B17D31" - }, - "log_stream_prefix": "name/" - } - }, - "Memory": 2048, - "Name": "app", - "PortMappings": [ - { - "ContainerPort": 80, - "Protocol": "tcp" - } - ], - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ] - }, - { - "Environment": [ - { - "Name": "APPMESH_VIRTUAL_NODE_NAME", - "Value": { - "Fn::Join": [ - "", - [ - "mesh/", - { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "/virtualNode/name" - ] - ] - } - }, - { - "Name": "AWS_REGION", - "Value": { - "Ref": "AWS::Region" - } - }, - { - "Name": "ENABLE_ENVOY_STATS_TAGS", - "Value": "1" - }, - { - "Name": "ENABLE_ENVOY_DOG_STATSD", - "Value": "1" - } - ], - "Essential": true, - "HealthCheck": { - "Command": [ - "CMD-SHELL", - "curl -s http://localhost:9901/server_info | grep state | grep -q LIVE" - ], - "Interval": 5, - "Retries": 3, - "StartPeriod": 10, - "Timeout": 2 - }, - "Image": { - "Fn::Join": [ - "", - [ - { - "Fn::FindInMap": [ - "nameenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ".dkr.ecr.", - { - "Ref": "AWS::Region" - }, - ".", - { - "Ref": "AWS::URLSuffix" - }, - "/aws-appmesh-envoy:v1.15.1.0-prod" - ] - ] - }, - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "nametaskdefinitionenvoyLogGroup258B673B" - }, - "awslogs-stream-prefix": "envoy", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "MemoryReservation": 128, - "Name": "envoy", - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ], - "User": "1337" - }, - { - "DependsOn": [ - { - "Condition": "HEALTHY", - "ContainerName": "envoy" - } - ], - "Essential": true, - "FirelensConfiguration": { - "Type": "fluentbit" - }, - "Image": { - "Ref": "SsmParameterValueawsserviceawsforfluentbitlatestC96584B6F00A464EAD1953AFF4B05118Parameter" - }, - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "nametaskdefinitionfirelensLogGroup80DDA60F" - }, - "awslogs-stream-prefix": "firelens", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "MemoryReservation": 50, - "Name": "firelens", - "User": "0:1338" - }, - { - "DependsOn": [ - { - "Condition": "HEALTHY", - "ContainerName": "envoy" - } - ], - "Environment": [ - { - "Name": "AWS_REGION", - "Value": { - "Ref": "AWS::Region" - } - } - ], - "Essential": true, - "HealthCheck": { - "Command": [ - "CMD-SHELL", - "curl -s http://localhost:2000" - ], - "Interval": 5, - "Retries": 3, - "StartPeriod": 10, - "Timeout": 2 - }, - "Image": "amazon/aws-xray-daemon:latest", - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "nametaskdefinitionxrayLogGroup4AF4CA37" - }, - "awslogs-stream-prefix": "xray", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "MemoryReservation": 256, - "Name": "xray", - "User": "1337" - }, - { - "DependsOn": [ - { - "Condition": "HEALTHY", - "ContainerName": "envoy" - } - ], - "Environment": [ - { - "Name": "CW_CONFIG_CONTENT", - "Value": "{\"logs\":{\"metrics_collected\":{\"emf\":{}}},\"metrics\":{\"metrics_collected\":{\"statsd\":{}}}}" - } - ], - "Essential": true, - "Image": "amazon/cloudwatch-agent:latest", - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "nametaskdefinitioncloudwatchagentLogGroup78DDC685" - }, - "awslogs-stream-prefix": "cloudwatch-agent", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "MemoryReservation": 50, - "Name": "cloudwatch-agent", - "User": "0:1338" - } - ], - "Cpu": "1024", - "ExecutionRoleArn": { - "Fn::GetAtt": [ - "nametaskdefinitionExecutionRole45AC5C9A", - "Arn" - ] - }, - "Family": "awsecsintegnametaskdefinition0EA6A1A0", - "Memory": "2048", - "NetworkMode": "awsvpc", - "ProxyConfiguration": { - "ContainerName": "envoy", - "ProxyConfigurationProperties": [ - { - "Name": "AppPorts", - "Value": "80" - }, - { - "Name": "ProxyEgressPort", - "Value": "15001" - }, - { - "Name": "ProxyIngressPort", - "Value": "15000" - }, - { - "Name": "IgnoredUID", - "Value": "1337" - }, - { - "Name": "IgnoredGID", - "Value": "1338" - }, - { - "Name": "EgressIgnoredIPs", - "Value": "169.254.170.2,169.254.169.254" - } - ], - "Type": "APPMESH" - }, - "RequiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "TaskRoleArn": { - "Fn::GetAtt": [ - "nametaskdefinitionTaskRole50FE844E", - "Arn" - ] - } - } - }, - "nametaskdefinitionenvoyLogGroup258B673B": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "nametaskdefinitionExecutionRole45AC5C9A": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "nametaskdefinitionExecutionRoleDefaultPolicyF7942D20": { - "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" - }, - ":", - { - "Fn::FindInMap": [ - "nameenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ":repository/aws-appmesh-envoy" - ] - ] - } - }, - { - "Action": [ - "ecr:BatchCheckLayerAvailability", - "ecr:BatchGetImage", - "ecr:GetAuthorizationToken", - "ecr:GetDownloadUrlForLayer" - ], - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "nametaskdefinitioncloudwatchagentLogGroup78DDC685", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "nametaskdefinitionenvoyLogGroup258B673B", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "nametaskdefinitionfirelensLogGroup80DDA60F", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "nametaskdefinitionxrayLogGroup4AF4CA37", - "Arn" - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "nametaskdefinitionExecutionRoleDefaultPolicyF7942D20", - "Roles": [ - { - "Ref": "nametaskdefinitionExecutionRole45AC5C9A" - } - ] - } - }, - "nametaskdefinitionfirelensLogGroup80DDA60F": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "nametaskdefinitionxrayLogGroup4AF4CA37": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "nametaskdefinitioncloudwatchagentLogGroup78DDC685": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "nameenvoytoappmesh2767D3E6": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "appmesh:StreamAggregatedResources", - "Effect": "Allow", - "Resource": { - "Ref": "mymeshEA67EDEF" - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "nameenvoytoappmesh2767D3E6", - "Roles": [ - { - "Ref": "nametaskdefinitionTaskRole50FE844E" - } - ] - } - }, - "namepublishmetricsF329C7AE": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "cloudwatch:PutMetricData", - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "namepublishmetricsF329C7AE", - "Roles": [ - { - "Ref": "nametaskdefinitionTaskRole50FE844E" - } - ] - } - }, - "nameserviceService8015C8D6": { - "Type": "AWS::ECS::Service", - "Properties": { - "Cluster": { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "DeploymentConfiguration": { - "MaximumPercent": 150, - "MinimumHealthyPercent": 100 - }, - "DesiredCount": 2, - "EnableECSManagedTags": false, - "LaunchType": "FARGATE", - "NetworkConfiguration": { - "AwsvpcConfiguration": { - "AssignPublicIp": "DISABLED", - "SecurityGroups": [ - { - "Fn::GetAtt": [ - "nameserviceSecurityGroup33F4662C", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - }, - { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - ] - } - }, - "ServiceRegistries": [ - { - "RegistryArn": { - "Fn::GetAtt": [ - "nameserviceCloudmapService3D5B0548", - "Arn" - ] - } - } - ], - "TaskDefinition": { - "Ref": "nametaskdefinition690762BB" - } - } - }, - "nameserviceCloudmapService3D5B0548": { - "Type": "AWS::ServiceDiscovery::Service", - "Properties": { - "DnsConfig": { - "DnsRecords": [ - { - "TTL": 10, - "Type": "A" - } - ], - "NamespaceId": { - "Fn::GetAtt": [ - "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D", - "Id" - ] - }, - "RoutingPolicy": "MULTIVALUE" - }, - "HealthCheckCustomConfig": { - "FailureThreshold": 2 - }, - "Name": "name", - "NamespaceId": { - "Fn::GetAtt": [ - "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D", - "Id" - ] - } - } - }, - "nameserviceSecurityGroup33F4662C": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "aws-ecs-integ/name-service/SecurityGroup", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "nameserviceSecurityGroupfromawsecsinteggreeterserviceSecurityGroup055DC23B8048057EFF": { - "Type": "AWS::EC2::SecurityGroupIngress", - "Properties": { - "IpProtocol": "tcp", - "Description": "Accept inbound traffic from greeter", - "FromPort": 80, - "GroupId": { - "Fn::GetAtt": [ - "nameserviceSecurityGroup33F4662C", - "GroupId" - ] - }, - "SourceSecurityGroupId": { - "Fn::GetAtt": [ - "greeterserviceSecurityGroupDB4AC3A9", - "GroupId" - ] - }, - "ToPort": 80 - } - }, - "nameserviceTaskCountTarget366C2B3A": { - "Type": "AWS::ApplicationAutoScaling::ScalableTarget", - "Properties": { - "MaxCapacity": 8, - "MinCapacity": 2, - "ResourceId": { - "Fn::Join": [ - "", - [ - "service/", - { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "/", - { - "Fn::GetAtt": [ - "nameserviceService8015C8D6", - "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" - } - }, - "nameserviceTaskCountTargetnametargetcpuutilization5018B16243": { - "Type": "AWS::ApplicationAutoScaling::ScalingPolicy", - "Properties": { - "PolicyName": "awsecsintegnameserviceTaskCountTargetnametargetcpuutilization50CAB59E05", - "PolicyType": "TargetTrackingScaling", - "ScalingTargetId": { - "Ref": "nameserviceTaskCountTarget366C2B3A" - }, - "TargetTrackingScalingPolicyConfiguration": { - "PredefinedMetricSpecification": { - "PredefinedMetricType": "ECSServiceAverageCPUUtilization" - }, - "ScaleInCooldown": 60, - "ScaleOutCooldown": 60, - "TargetValue": 50 - } - } - }, - "namevirtualnode6C99CB14": { - "Type": "AWS::AppMesh::VirtualNode", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "Spec": { - "Listeners": [ - { - "PortMapping": { - "Port": 80, - "Protocol": "http" - } - } - ], - "ServiceDiscovery": { - "AWSCloudMap": { - "NamespaceName": "production", - "ServiceName": { - "Fn::GetAtt": [ - "nameserviceCloudmapService3D5B0548", - "Name" - ] - } - } - } - }, - "VirtualNodeName": "name" - } - }, - "namevirtualrouterC00E1ACE": { - "Type": "AWS::AppMesh::VirtualRouter", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "Spec": { - "Listeners": [ - { - "PortMapping": { - "Port": 80, - "Protocol": "http" - } - } - ] - }, - "VirtualRouterName": "name" - } - }, - "namevirtualrouternamerouteDCDF3715": { - "Type": "AWS::AppMesh::Route", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "Spec": { - "HttpRoute": { - "Action": { - "WeightedTargets": [ - { - "VirtualNode": { - "Fn::GetAtt": [ - "namevirtualnode6C99CB14", - "VirtualNodeName" - ] - }, - "Weight": 1 - } - ] - }, - "Match": { - "Prefix": "/" - } - } - }, - "VirtualRouterName": { - "Fn::GetAtt": [ - "namevirtualrouterC00E1ACE", - "VirtualRouterName" - ] - }, - "RouteName": "name-route" - } - }, - "namevirtualservice3DDDDF1E": { - "Type": "AWS::AppMesh::VirtualService", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "Spec": { - "Provider": { - "VirtualRouter": { - "VirtualRouterName": { - "Fn::GetAtt": [ - "namevirtualrouterC00E1ACE", - "VirtualRouterName" - ] - } - } - } - }, - "VirtualServiceName": "name.production" - } - }, - "greetinglogsCC360934": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "greeting-logs", - "RetentionInDays": 7 - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "greetingtaskdefinitionTaskRole9179DA4A": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/AWSXRayDaemonWriteAccess" - ] - ] - } - ] - } - }, - "greetingtaskdefinitionTaskRoleDefaultPolicy5DB4510A": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:DescribeLogStreams", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "greetingtaskdefinitionTaskRoleDefaultPolicy5DB4510A", - "Roles": [ - { - "Ref": "greetingtaskdefinitionTaskRole9179DA4A" - } - ] - } - }, - "greetingtaskdefinition31690093": { - "Type": "AWS::ECS::TaskDefinition", - "Properties": { - "ContainerDefinitions": [ - { - "Cpu": 1024, - "DependsOn": [ - { - "Condition": "START", - "ContainerName": "firelens" - }, - { - "Condition": "HEALTHY", - "ContainerName": "envoy" - }, - { - "Condition": "START", - "ContainerName": "cloudwatch-agent" - }, - { - "Condition": "HEALTHY", - "ContainerName": "xray" - } - ], - "Environment": [ - { - "Name": "PORT", - "Value": "80" - } - ], - "Essential": true, - "Image": "nathanpeck/greeting", - "LogConfiguration": { - "LogDriver": "awsfirelens", - "Options": { - "Name": "cloudwatch", - "region": { - "Ref": "AWS::Region" - }, - "log_group_name": { - "Ref": "greetinglogsCC360934" - }, - "log_stream_prefix": "greeting/" - } - }, - "Memory": 2048, - "Name": "app", - "PortMappings": [ - { - "ContainerPort": 80, - "Protocol": "tcp" - } - ], - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ] - }, - { - "Environment": [ - { - "Name": "APPMESH_VIRTUAL_NODE_NAME", - "Value": { - "Fn::Join": [ - "", - [ - "mesh/", - { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "/virtualNode/greeting" - ] - ] - } - }, - { - "Name": "AWS_REGION", - "Value": { - "Ref": "AWS::Region" - } - }, - { - "Name": "ENABLE_ENVOY_STATS_TAGS", - "Value": "1" - }, - { - "Name": "ENABLE_ENVOY_DOG_STATSD", - "Value": "1" - } - ], - "Essential": true, - "HealthCheck": { - "Command": [ - "CMD-SHELL", - "curl -s http://localhost:9901/server_info | grep state | grep -q LIVE" - ], - "Interval": 5, - "Retries": 3, - "StartPeriod": 10, - "Timeout": 2 - }, - "Image": { - "Fn::Join": [ - "", - [ - { - "Fn::FindInMap": [ - "greetingenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ".dkr.ecr.", - { - "Ref": "AWS::Region" - }, - ".", - { - "Ref": "AWS::URLSuffix" - }, - "/aws-appmesh-envoy:v1.15.1.0-prod" - ] - ] - }, - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "greetingtaskdefinitionenvoyLogGroup6556AC35" - }, - "awslogs-stream-prefix": "envoy", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "MemoryReservation": 128, - "Name": "envoy", - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ], - "User": "1337" - }, - { - "DependsOn": [ - { - "Condition": "HEALTHY", - "ContainerName": "envoy" - } - ], - "Essential": true, - "FirelensConfiguration": { - "Type": "fluentbit" - }, - "Image": { - "Ref": "SsmParameterValueawsserviceawsforfluentbitlatestC96584B6F00A464EAD1953AFF4B05118Parameter" - }, - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "greetingtaskdefinitionfirelensLogGroupD7A398A7" - }, - "awslogs-stream-prefix": "firelens", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "MemoryReservation": 50, - "Name": "firelens", - "User": "0:1338" - }, - { - "DependsOn": [ - { - "Condition": "HEALTHY", - "ContainerName": "envoy" - } - ], - "Environment": [ - { - "Name": "AWS_REGION", - "Value": { - "Ref": "AWS::Region" - } - } - ], - "Essential": true, - "HealthCheck": { - "Command": [ - "CMD-SHELL", - "curl -s http://localhost:2000" - ], - "Interval": 5, - "Retries": 3, - "StartPeriod": 10, - "Timeout": 2 - }, - "Image": "amazon/aws-xray-daemon:latest", - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "greetingtaskdefinitionxrayLogGroupD25C072D" - }, - "awslogs-stream-prefix": "xray", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "MemoryReservation": 256, - "Name": "xray", - "User": "1337" - }, - { - "DependsOn": [ - { - "Condition": "HEALTHY", - "ContainerName": "envoy" - } - ], - "Environment": [ - { - "Name": "CW_CONFIG_CONTENT", - "Value": "{\"logs\":{\"metrics_collected\":{\"emf\":{}}},\"metrics\":{\"metrics_collected\":{\"statsd\":{}}}}" - } - ], - "Essential": true, - "Image": "amazon/cloudwatch-agent:latest", - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "greetingtaskdefinitioncloudwatchagentLogGroupCEF72742" - }, - "awslogs-stream-prefix": "cloudwatch-agent", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "MemoryReservation": 50, - "Name": "cloudwatch-agent", - "User": "0:1338" - } - ], - "Cpu": "1024", - "ExecutionRoleArn": { - "Fn::GetAtt": [ - "greetingtaskdefinitionExecutionRole9E3A7CF3", - "Arn" - ] - }, - "Family": "awsecsinteggreetingtaskdefinitionA6E8A57B", - "Memory": "2048", - "NetworkMode": "awsvpc", - "ProxyConfiguration": { - "ContainerName": "envoy", - "ProxyConfigurationProperties": [ - { - "Name": "AppPorts", - "Value": "80" - }, - { - "Name": "ProxyEgressPort", - "Value": "15001" - }, - { - "Name": "ProxyIngressPort", - "Value": "15000" - }, - { - "Name": "IgnoredUID", - "Value": "1337" - }, - { - "Name": "IgnoredGID", - "Value": "1338" - }, - { - "Name": "EgressIgnoredIPs", - "Value": "169.254.170.2,169.254.169.254" - } - ], - "Type": "APPMESH" - }, - "RequiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "TaskRoleArn": { - "Fn::GetAtt": [ - "greetingtaskdefinitionTaskRole9179DA4A", - "Arn" - ] - } - } - }, - "greetingtaskdefinitionenvoyLogGroup6556AC35": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "greetingtaskdefinitionExecutionRole9E3A7CF3": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "greetingtaskdefinitionExecutionRoleDefaultPolicy31B93022": { - "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" - }, - ":", - { - "Fn::FindInMap": [ - "greetingenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ":repository/aws-appmesh-envoy" - ] - ] - } - }, - { - "Action": [ - "ecr:BatchCheckLayerAvailability", - "ecr:BatchGetImage", - "ecr:GetAuthorizationToken", - "ecr:GetDownloadUrlForLayer" - ], - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "greetingtaskdefinitioncloudwatchagentLogGroupCEF72742", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "greetingtaskdefinitionenvoyLogGroup6556AC35", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "greetingtaskdefinitionfirelensLogGroupD7A398A7", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "greetingtaskdefinitionxrayLogGroupD25C072D", - "Arn" - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "greetingtaskdefinitionExecutionRoleDefaultPolicy31B93022", - "Roles": [ - { - "Ref": "greetingtaskdefinitionExecutionRole9E3A7CF3" - } - ] - } - }, - "greetingtaskdefinitionfirelensLogGroupD7A398A7": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "greetingtaskdefinitionxrayLogGroupD25C072D": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "greetingtaskdefinitioncloudwatchagentLogGroupCEF72742": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "greetingenvoytoappmesh97051B23": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "appmesh:StreamAggregatedResources", - "Effect": "Allow", - "Resource": { - "Ref": "mymeshEA67EDEF" - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "greetingenvoytoappmesh97051B23", - "Roles": [ - { - "Ref": "greetingtaskdefinitionTaskRole9179DA4A" - } - ] - } - }, - "greetingpublishmetricsF17124EF": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "cloudwatch:PutMetricData", - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "greetingpublishmetricsF17124EF", - "Roles": [ - { - "Ref": "greetingtaskdefinitionTaskRole9179DA4A" - } - ] - } - }, - "greetingserviceService8DA58640": { - "Type": "AWS::ECS::Service", - "Properties": { - "Cluster": { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "DeploymentConfiguration": { - "MaximumPercent": 150, - "MinimumHealthyPercent": 100 - }, - "DesiredCount": 2, - "EnableECSManagedTags": false, - "LaunchType": "FARGATE", - "NetworkConfiguration": { - "AwsvpcConfiguration": { - "AssignPublicIp": "DISABLED", - "SecurityGroups": [ - { - "Fn::GetAtt": [ - "greetingserviceSecurityGroupE9BE665B", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - }, - { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - ] - } - }, - "ServiceRegistries": [ - { - "RegistryArn": { - "Fn::GetAtt": [ - "greetingserviceCloudmapService0A2D7385", - "Arn" - ] - } - } - ], - "TaskDefinition": { - "Ref": "greetingtaskdefinition31690093" - } - } - }, - "greetingserviceCloudmapService0A2D7385": { - "Type": "AWS::ServiceDiscovery::Service", - "Properties": { - "DnsConfig": { - "DnsRecords": [ - { - "TTL": 10, - "Type": "A" - } - ], - "NamespaceId": { - "Fn::GetAtt": [ - "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D", - "Id" - ] - }, - "RoutingPolicy": "MULTIVALUE" - }, - "HealthCheckCustomConfig": { - "FailureThreshold": 2 - }, - "Name": "greeting", - "NamespaceId": { - "Fn::GetAtt": [ - "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D", - "Id" - ] - } - } - }, - "greetingserviceSecurityGroupE9BE665B": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "aws-ecs-integ/greeting-service/SecurityGroup", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "greetingserviceSecurityGroupfromawsecsinteggreeterserviceSecurityGroup055DC23B807B9C4357": { - "Type": "AWS::EC2::SecurityGroupIngress", - "Properties": { - "IpProtocol": "tcp", - "Description": "Accept inbound traffic from greeter", - "FromPort": 80, - "GroupId": { - "Fn::GetAtt": [ - "greetingserviceSecurityGroupE9BE665B", - "GroupId" - ] - }, - "SourceSecurityGroupId": { - "Fn::GetAtt": [ - "greeterserviceSecurityGroupDB4AC3A9", - "GroupId" - ] - }, - "ToPort": 80 - } - }, - "greetingserviceTaskCountTargetA036048C": { - "Type": "AWS::ApplicationAutoScaling::ScalableTarget", - "Properties": { - "MaxCapacity": 8, - "MinCapacity": 2, - "ResourceId": { - "Fn::Join": [ - "", - [ - "service/", - { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "/", - { - "Fn::GetAtt": [ - "greetingserviceService8DA58640", - "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" - } - }, - "greetingserviceTaskCountTargetgreetingtargetcpuutilization50FEAF6434": { - "Type": "AWS::ApplicationAutoScaling::ScalingPolicy", - "Properties": { - "PolicyName": "awsecsinteggreetingserviceTaskCountTargetgreetingtargetcpuutilization504C76B1F4", - "PolicyType": "TargetTrackingScaling", - "ScalingTargetId": { - "Ref": "greetingserviceTaskCountTargetA036048C" - }, - "TargetTrackingScalingPolicyConfiguration": { - "PredefinedMetricSpecification": { - "PredefinedMetricType": "ECSServiceAverageCPUUtilization" - }, - "ScaleInCooldown": 60, - "ScaleOutCooldown": 60, - "TargetValue": 50 - } - } - }, - "greetingvirtualnodeC4A2C517": { - "Type": "AWS::AppMesh::VirtualNode", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "Spec": { - "Listeners": [ - { - "PortMapping": { - "Port": 80, - "Protocol": "http" - } - } - ], - "ServiceDiscovery": { - "AWSCloudMap": { - "NamespaceName": "production", - "ServiceName": { - "Fn::GetAtt": [ - "greetingserviceCloudmapService0A2D7385", - "Name" - ] - } - } - } - }, - "VirtualNodeName": "greeting" - } - }, - "greetingvirtualrouter0F898D1A": { - "Type": "AWS::AppMesh::VirtualRouter", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "Spec": { - "Listeners": [ - { - "PortMapping": { - "Port": 80, - "Protocol": "http" - } - } - ] - }, - "VirtualRouterName": "greeting" - } - }, - "greetingvirtualroutergreetingroute46305F50": { - "Type": "AWS::AppMesh::Route", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "Spec": { - "HttpRoute": { - "Action": { - "WeightedTargets": [ - { - "VirtualNode": { - "Fn::GetAtt": [ - "greetingvirtualnodeC4A2C517", - "VirtualNodeName" - ] - }, - "Weight": 1 - } - ] - }, - "Match": { - "Prefix": "/" - } - } - }, - "VirtualRouterName": { - "Fn::GetAtt": [ - "greetingvirtualrouter0F898D1A", - "VirtualRouterName" - ] - }, - "RouteName": "greeting-route" - } - }, - "greetingvirtualservice60AD3AD9": { - "Type": "AWS::AppMesh::VirtualService", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "Spec": { - "Provider": { - "VirtualRouter": { - "VirtualRouterName": { - "Fn::GetAtt": [ - "greetingvirtualrouter0F898D1A", - "VirtualRouterName" - ] - } - } - } - }, - "VirtualServiceName": "greeting.production" - } - }, - "greeterlogsCCD2F8B2": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "greeter-logs", - "RetentionInDays": 7 - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "greeterloadbalancer85256741": { - "Type": "AWS::ElasticLoadBalancingV2::LoadBalancer", - "Properties": { - "LoadBalancerAttributes": [ - { - "Key": "deletion_protection.enabled", - "Value": "false" - } - ], - "Scheme": "internet-facing", - "SecurityGroups": [ - { - "Fn::GetAtt": [ - "greeterloadbalancerSecurityGroupEE1B20F3", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Ref": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - }, - { - "Ref": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - } - ], - "Type": "application" - }, - "DependsOn": [ - "productionenvironmentvpcPublicSubnet1DefaultRoute524C894D", - "productionenvironmentvpcPublicSubnet1RouteTableAssociationA8117374", - "productionenvironmentvpcPublicSubnet2DefaultRoute92CD697D", - "productionenvironmentvpcPublicSubnet2RouteTableAssociation0A7549F3" - ] - }, - "greeterloadbalancerSecurityGroupEE1B20F3": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "Automatically created Security Group for ELB awsecsinteggreeterloadbalancer147D1D5C", - "SecurityGroupIngress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow from anyone on port 80", - "FromPort": 80, - "IpProtocol": "tcp", - "ToPort": 80 - } - ], - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "greeterloadbalancerSecurityGrouptoawsecsinteggreeterserviceSecurityGroup055DC23B803EEF3320": { - "Type": "AWS::EC2::SecurityGroupEgress", - "Properties": { - "GroupId": { - "Fn::GetAtt": [ - "greeterloadbalancerSecurityGroupEE1B20F3", - "GroupId" - ] - }, - "IpProtocol": "tcp", - "Description": "Load balancer to target", - "DestinationSecurityGroupId": { - "Fn::GetAtt": [ - "greeterserviceSecurityGroupDB4AC3A9", - "GroupId" - ] - }, - "FromPort": 80, - "ToPort": 80 - } - }, - "greeterloadbalancergreeterlistener952E028B": { - "Type": "AWS::ElasticLoadBalancingV2::Listener", - "Properties": { - "DefaultActions": [ - { - "TargetGroupArn": { - "Ref": "greeterloadbalancergreeterlistenergreeterGroupFFBFF0C2" - }, - "Type": "forward" - } - ], - "LoadBalancerArn": { - "Ref": "greeterloadbalancer85256741" - }, - "Port": 80, - "Protocol": "HTTP" - } - }, - "greeterloadbalancergreeterlistenergreeterGroupFFBFF0C2": { - "Type": "AWS::ElasticLoadBalancingV2::TargetGroup", - "Properties": { - "Port": 80, - "Protocol": "HTTP", - "TargetGroupAttributes": [ - { - "Key": "deregistration_delay.timeout_seconds", - "Value": "10" - }, - { - "Key": "stickiness.enabled", - "Value": "false" - } - ], - "TargetType": "ip", - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "greetertaskdefinitionTaskRole2A098ACC": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/AWSXRayDaemonWriteAccess" - ] - ] - } - ] - } - }, - "greetertaskdefinitionTaskRoleDefaultPolicyD0F53B1C": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:DescribeLogStreams", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "greetertaskdefinitionTaskRoleDefaultPolicyD0F53B1C", - "Roles": [ - { - "Ref": "greetertaskdefinitionTaskRole2A098ACC" - } - ] - } - }, - "greetertaskdefinitionE956EEA2": { - "Type": "AWS::ECS::TaskDefinition", - "Properties": { - "ContainerDefinitions": [ - { - "Cpu": 1024, - "DependsOn": [ - { - "Condition": "START", - "ContainerName": "firelens" - }, - { - "Condition": "HEALTHY", - "ContainerName": "envoy" - }, - { - "Condition": "START", - "ContainerName": "cloudwatch-agent" - }, - { - "Condition": "HEALTHY", - "ContainerName": "xray" - } - ], - "Environment": [ - { - "Name": "PORT", - "Value": "80" - }, - { - "Name": "GREETING_URL", - "Value": "http://greeting.production" - }, - { - "Name": "NAME_URL", - "Value": "http://name.production" - } - ], - "Essential": true, - "Image": "nathanpeck/greeter", - "LogConfiguration": { - "LogDriver": "awsfirelens", - "Options": { - "Name": "cloudwatch", - "region": { - "Ref": "AWS::Region" - }, - "log_group_name": { - "Ref": "greeterlogsCCD2F8B2" - }, - "log_stream_prefix": "greeter/" - } - }, - "Memory": 2048, - "Name": "app", - "PortMappings": [ - { - "ContainerPort": 80, - "Protocol": "tcp" - } - ], - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ] - }, - { - "Environment": [ - { - "Name": "APPMESH_VIRTUAL_NODE_NAME", - "Value": { - "Fn::Join": [ - "", - [ - "mesh/", - { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "/virtualNode/greeter" - ] - ] - } - }, - { - "Name": "AWS_REGION", - "Value": { - "Ref": "AWS::Region" - } - }, - { - "Name": "ENABLE_ENVOY_STATS_TAGS", - "Value": "1" - }, - { - "Name": "ENABLE_ENVOY_DOG_STATSD", - "Value": "1" - } - ], - "Essential": true, - "HealthCheck": { - "Command": [ - "CMD-SHELL", - "curl -s http://localhost:9901/server_info | grep state | grep -q LIVE" - ], - "Interval": 5, - "Retries": 3, - "StartPeriod": 10, - "Timeout": 2 - }, - "Image": { - "Fn::Join": [ - "", - [ - { - "Fn::FindInMap": [ - "greeterenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ".dkr.ecr.", - { - "Ref": "AWS::Region" - }, - ".", - { - "Ref": "AWS::URLSuffix" - }, - "/aws-appmesh-envoy:v1.15.1.0-prod" - ] - ] - }, - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "greetertaskdefinitionenvoyLogGroup6E10B93E" - }, - "awslogs-stream-prefix": "envoy", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "MemoryReservation": 128, - "Name": "envoy", - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ], - "User": "1337" - }, - { - "DependsOn": [ - { - "Condition": "HEALTHY", - "ContainerName": "envoy" - } - ], - "Essential": true, - "FirelensConfiguration": { - "Type": "fluentbit" - }, - "Image": { - "Ref": "SsmParameterValueawsserviceawsforfluentbitlatestC96584B6F00A464EAD1953AFF4B05118Parameter" - }, - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "greetertaskdefinitionfirelensLogGroupD5BAAC35" - }, - "awslogs-stream-prefix": "firelens", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "MemoryReservation": 50, - "Name": "firelens", - "User": "0:1338" - }, - { - "DependsOn": [ - { - "Condition": "HEALTHY", - "ContainerName": "envoy" - } - ], - "Environment": [ - { - "Name": "AWS_REGION", - "Value": { - "Ref": "AWS::Region" - } - } - ], - "Essential": true, - "HealthCheck": { - "Command": [ - "CMD-SHELL", - "curl -s http://localhost:2000" - ], - "Interval": 5, - "Retries": 3, - "StartPeriod": 10, - "Timeout": 2 - }, - "Image": "amazon/aws-xray-daemon:latest", - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "greetertaskdefinitionxrayLogGroupBC1558B6" - }, - "awslogs-stream-prefix": "xray", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "MemoryReservation": 256, - "Name": "xray", - "User": "1337" - }, - { - "DependsOn": [ - { - "Condition": "HEALTHY", - "ContainerName": "envoy" - } - ], - "Environment": [ - { - "Name": "CW_CONFIG_CONTENT", - "Value": "{\"logs\":{\"metrics_collected\":{\"emf\":{}}},\"metrics\":{\"metrics_collected\":{\"statsd\":{}}}}" - } - ], - "Essential": true, - "Image": "amazon/cloudwatch-agent:latest", - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "greetertaskdefinitioncloudwatchagentLogGroupE7EAF327" - }, - "awslogs-stream-prefix": "cloudwatch-agent", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "MemoryReservation": 50, - "Name": "cloudwatch-agent", - "User": "0:1338" - } - ], - "Cpu": "1024", - "ExecutionRoleArn": { - "Fn::GetAtt": [ - "greetertaskdefinitionExecutionRoleAED0EC79", - "Arn" - ] - }, - "Family": "awsecsinteggreetertaskdefinitionB95239FB", - "Memory": "2048", - "NetworkMode": "awsvpc", - "ProxyConfiguration": { - "ContainerName": "envoy", - "ProxyConfigurationProperties": [ - { - "Name": "AppPorts", - "Value": "80" - }, - { - "Name": "ProxyEgressPort", - "Value": "15001" - }, - { - "Name": "ProxyIngressPort", - "Value": "15000" - }, - { - "Name": "IgnoredUID", - "Value": "1337" - }, - { - "Name": "IgnoredGID", - "Value": "1338" - }, - { - "Name": "EgressIgnoredIPs", - "Value": "169.254.170.2,169.254.169.254" - } - ], - "Type": "APPMESH" - }, - "RequiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "TaskRoleArn": { - "Fn::GetAtt": [ - "greetertaskdefinitionTaskRole2A098ACC", - "Arn" - ] - } - } - }, - "greetertaskdefinitionenvoyLogGroup6E10B93E": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "greetertaskdefinitionExecutionRoleAED0EC79": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "greetertaskdefinitionExecutionRoleDefaultPolicy0D8E9106": { - "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" - }, - ":", - { - "Fn::FindInMap": [ - "greeterenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ":repository/aws-appmesh-envoy" - ] - ] - } - }, - { - "Action": [ - "ecr:BatchCheckLayerAvailability", - "ecr:BatchGetImage", - "ecr:GetAuthorizationToken", - "ecr:GetDownloadUrlForLayer" - ], - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "greetertaskdefinitioncloudwatchagentLogGroupE7EAF327", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "greetertaskdefinitionenvoyLogGroup6E10B93E", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "greetertaskdefinitionfirelensLogGroupD5BAAC35", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "greetertaskdefinitionxrayLogGroupBC1558B6", - "Arn" - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "greetertaskdefinitionExecutionRoleDefaultPolicy0D8E9106", - "Roles": [ - { - "Ref": "greetertaskdefinitionExecutionRoleAED0EC79" - } - ] - } - }, - "greetertaskdefinitionfirelensLogGroupD5BAAC35": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "greetertaskdefinitionxrayLogGroupBC1558B6": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "greetertaskdefinitioncloudwatchagentLogGroupE7EAF327": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "greeterenvoytoappmesh1A94938B": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "appmesh:StreamAggregatedResources", - "Effect": "Allow", - "Resource": { - "Ref": "mymeshEA67EDEF" - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "greeterenvoytoappmesh1A94938B", - "Roles": [ - { - "Ref": "greetertaskdefinitionTaskRole2A098ACC" - } - ] - } - }, - "greeterpublishmetrics0CCA359A": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "cloudwatch:PutMetricData", - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "greeterpublishmetrics0CCA359A", - "Roles": [ - { - "Ref": "greetertaskdefinitionTaskRole2A098ACC" - } - ] - } - }, - "greeterserviceService8EDD3244": { - "Type": "AWS::ECS::Service", - "Properties": { - "Cluster": { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "DeploymentConfiguration": { - "MaximumPercent": 150, - "MinimumHealthyPercent": 100 - }, - "DesiredCount": 2, - "EnableECSManagedTags": false, - "HealthCheckGracePeriodSeconds": 60, - "LaunchType": "FARGATE", - "LoadBalancers": [ - { - "ContainerName": "app", - "ContainerPort": 80, - "TargetGroupArn": { - "Ref": "greeterloadbalancergreeterlistenergreeterGroupFFBFF0C2" - } - } - ], - "NetworkConfiguration": { - "AwsvpcConfiguration": { - "AssignPublicIp": "DISABLED", - "SecurityGroups": [ - { - "Fn::GetAtt": [ - "greeterserviceSecurityGroupDB4AC3A9", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - }, - { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - ] - } - }, - "ServiceRegistries": [ - { - "RegistryArn": { - "Fn::GetAtt": [ - "greeterserviceCloudmapServiceEE292978", - "Arn" - ] - } - } - ], - "TaskDefinition": { - "Ref": "greetertaskdefinitionE956EEA2" - } - }, - "DependsOn": [ - "greeterloadbalancergreeterlistenergreeterGroupFFBFF0C2", - "greeterloadbalancergreeterlistener952E028B" - ] - }, - "greeterserviceCloudmapServiceEE292978": { - "Type": "AWS::ServiceDiscovery::Service", - "Properties": { - "DnsConfig": { - "DnsRecords": [ - { - "TTL": 10, - "Type": "A" - } - ], - "NamespaceId": { - "Fn::GetAtt": [ - "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D", - "Id" - ] - }, - "RoutingPolicy": "MULTIVALUE" - }, - "HealthCheckCustomConfig": { - "FailureThreshold": 2 - }, - "Name": "greeter", - "NamespaceId": { - "Fn::GetAtt": [ - "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D", - "Id" - ] - } - } - }, - "greeterserviceSecurityGroupDB4AC3A9": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "aws-ecs-integ/greeter-service/SecurityGroup", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "greeterserviceSecurityGroupfromawsecsinteggreeterloadbalancerSecurityGroupF791FA838037FDF8F5": { - "Type": "AWS::EC2::SecurityGroupIngress", - "Properties": { - "IpProtocol": "tcp", - "Description": "Load balancer to target", - "FromPort": 80, - "GroupId": { - "Fn::GetAtt": [ - "greeterserviceSecurityGroupDB4AC3A9", - "GroupId" - ] - }, - "SourceSecurityGroupId": { - "Fn::GetAtt": [ - "greeterloadbalancerSecurityGroupEE1B20F3", - "GroupId" - ] - }, - "ToPort": 80 - } - }, - "greeterserviceTaskCountTargetAB95B3D0": { - "Type": "AWS::ApplicationAutoScaling::ScalableTarget", - "Properties": { - "MaxCapacity": 8, - "MinCapacity": 2, - "ResourceId": { - "Fn::Join": [ - "", - [ - "service/", - { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "/", - { - "Fn::GetAtt": [ - "greeterserviceService8EDD3244", - "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" - } - }, - "greeterserviceTaskCountTargetgreetertargetcpuutilization50299508D1": { - "Type": "AWS::ApplicationAutoScaling::ScalingPolicy", - "Properties": { - "PolicyName": "awsecsinteggreeterserviceTaskCountTargetgreetertargetcpuutilization50A75D0C0D", - "PolicyType": "TargetTrackingScaling", - "ScalingTargetId": { - "Ref": "greeterserviceTaskCountTargetAB95B3D0" - }, - "TargetTrackingScalingPolicyConfiguration": { - "PredefinedMetricSpecification": { - "PredefinedMetricType": "ECSServiceAverageCPUUtilization" - }, - "ScaleInCooldown": 60, - "ScaleOutCooldown": 60, - "TargetValue": 50 - } - } - }, - "greetervirtualnode21EA7CC9": { - "Type": "AWS::AppMesh::VirtualNode", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "Spec": { - "Backends": [ - { - "VirtualService": { - "VirtualServiceName": "name.production" - } - }, - { - "VirtualService": { - "VirtualServiceName": "greeting.production" - } - } - ], - "Listeners": [ - { - "PortMapping": { - "Port": 80, - "Protocol": "http" - } - } - ], - "ServiceDiscovery": { - "AWSCloudMap": { - "NamespaceName": "production", - "ServiceName": { - "Fn::GetAtt": [ - "greeterserviceCloudmapServiceEE292978", - "Name" - ] - } - } - } - }, - "VirtualNodeName": "greeter" - } - }, - "greetervirtualrouter193840BB": { - "Type": "AWS::AppMesh::VirtualRouter", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "Spec": { - "Listeners": [ - { - "PortMapping": { - "Port": 80, - "Protocol": "http" - } - } - ] - }, - "VirtualRouterName": "greeter" - } - }, - "greetervirtualroutergreeterroute3EC6ACB0": { - "Type": "AWS::AppMesh::Route", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "Spec": { - "HttpRoute": { - "Action": { - "WeightedTargets": [ - { - "VirtualNode": { - "Fn::GetAtt": [ - "greetervirtualnode21EA7CC9", - "VirtualNodeName" - ] - }, - "Weight": 1 - } - ] - }, - "Match": { - "Prefix": "/" - } - } - }, - "VirtualRouterName": { - "Fn::GetAtt": [ - "greetervirtualrouter193840BB", - "VirtualRouterName" - ] - }, - "RouteName": "greeter-route" - } - }, - "greetervirtualservice6559950C": { - "Type": "AWS::AppMesh::VirtualService", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "Spec": { - "Provider": { - "VirtualRouter": { - "VirtualRouterName": { - "Fn::GetAtt": [ - "greetervirtualrouter193840BB", - "VirtualRouterName" - ] - } - } - } - }, - "VirtualServiceName": "greeter.production" - } - } - }, - "Mappings": { - "nameenvoyimageaccountmapping": { - "ap-northeast-1": { - "ecrRepo": "840364872350" - }, - "ap-northeast-2": { - "ecrRepo": "840364872350" - }, - "ap-south-1": { - "ecrRepo": "840364872350" - }, - "ap-southeast-1": { - "ecrRepo": "840364872350" - }, - "ap-southeast-2": { - "ecrRepo": "840364872350" - }, - "ca-central-1": { - "ecrRepo": "840364872350" - }, - "cn-north-1": { - "ecrRepo": "919366029133" - }, - "cn-northwest-1": { - "ecrRepo": "919830735681" - }, - "eu-central-1": { - "ecrRepo": "840364872350" - }, - "eu-north-1": { - "ecrRepo": "840364872350" - }, - "eu-south-1": { - "ecrRepo": "422531588944" - }, - "eu-west-1": { - "ecrRepo": "840364872350" - }, - "eu-west-2": { - "ecrRepo": "840364872350" - }, - "eu-west-3": { - "ecrRepo": "840364872350" - }, - "sa-east-1": { - "ecrRepo": "840364872350" - }, - "us-east-1": { - "ecrRepo": "840364872350" - }, - "us-east-2": { - "ecrRepo": "840364872350" - }, - "us-west-1": { - "ecrRepo": "840364872350" - }, - "us-west-2": { - "ecrRepo": "840364872350" - }, - "me-south-1": { - "ecrRepo": "772975370895" - }, - "ap-east-1": { - "ecrRepo": "856666278305" - }, - "af-south-1": { - "ecrRepo": "924023996002" - } - }, - "greetingenvoyimageaccountmapping": { - "ap-northeast-1": { - "ecrRepo": "840364872350" - }, - "ap-northeast-2": { - "ecrRepo": "840364872350" - }, - "ap-south-1": { - "ecrRepo": "840364872350" - }, - "ap-southeast-1": { - "ecrRepo": "840364872350" - }, - "ap-southeast-2": { - "ecrRepo": "840364872350" - }, - "ca-central-1": { - "ecrRepo": "840364872350" - }, - "cn-north-1": { - "ecrRepo": "919366029133" - }, - "cn-northwest-1": { - "ecrRepo": "919830735681" - }, - "eu-central-1": { - "ecrRepo": "840364872350" - }, - "eu-north-1": { - "ecrRepo": "840364872350" - }, - "eu-south-1": { - "ecrRepo": "422531588944" - }, - "eu-west-1": { - "ecrRepo": "840364872350" - }, - "eu-west-2": { - "ecrRepo": "840364872350" - }, - "eu-west-3": { - "ecrRepo": "840364872350" - }, - "sa-east-1": { - "ecrRepo": "840364872350" - }, - "us-east-1": { - "ecrRepo": "840364872350" - }, - "us-east-2": { - "ecrRepo": "840364872350" - }, - "us-west-1": { - "ecrRepo": "840364872350" - }, - "us-west-2": { - "ecrRepo": "840364872350" - }, - "me-south-1": { - "ecrRepo": "772975370895" - }, - "ap-east-1": { - "ecrRepo": "856666278305" - }, - "af-south-1": { - "ecrRepo": "924023996002" - } - }, - "greeterenvoyimageaccountmapping": { - "ap-northeast-1": { - "ecrRepo": "840364872350" - }, - "ap-northeast-2": { - "ecrRepo": "840364872350" - }, - "ap-south-1": { - "ecrRepo": "840364872350" - }, - "ap-southeast-1": { - "ecrRepo": "840364872350" - }, - "ap-southeast-2": { - "ecrRepo": "840364872350" - }, - "ca-central-1": { - "ecrRepo": "840364872350" - }, - "cn-north-1": { - "ecrRepo": "919366029133" - }, - "cn-northwest-1": { - "ecrRepo": "919830735681" - }, - "eu-central-1": { - "ecrRepo": "840364872350" - }, - "eu-north-1": { - "ecrRepo": "840364872350" - }, - "eu-south-1": { - "ecrRepo": "422531588944" - }, - "eu-west-1": { - "ecrRepo": "840364872350" - }, - "eu-west-2": { - "ecrRepo": "840364872350" - }, - "eu-west-3": { - "ecrRepo": "840364872350" - }, - "sa-east-1": { - "ecrRepo": "840364872350" - }, - "us-east-1": { - "ecrRepo": "840364872350" - }, - "us-east-2": { - "ecrRepo": "840364872350" - }, - "us-west-1": { - "ecrRepo": "840364872350" - }, - "us-west-2": { - "ecrRepo": "840364872350" - }, - "me-south-1": { - "ecrRepo": "772975370895" - }, - "ap-east-1": { - "ecrRepo": "856666278305" - }, - "af-south-1": { - "ecrRepo": "924023996002" - } - } - }, - "Parameters": { - "SsmParameterValueawsserviceawsforfluentbitlatestC96584B6F00A464EAD1953AFF4B05118Parameter": { - "Type": "AWS::SSM::Parameter::Value", - "Default": "/aws/service/aws-for-fluent-bit/latest" - } - }, - "Outputs": { - "greeterloadbalancerdnsoutput": { - "Value": { - "Fn::GetAtt": [ - "greeterloadbalancer85256741", - "DNSName" - ] - } - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/all-service-addons.integ.snapshot/cdk.out b/packages/@aws-cdk-containers/ecs-service-extensions/test/all-service-addons.integ.snapshot/cdk.out deleted file mode 100644 index 588d7b269d34f..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/all-service-addons.integ.snapshot/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/all-service-addons.integ.snapshot/integ.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/all-service-addons.integ.snapshot/integ.json deleted file mode 100644 index ac45f4b794326..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/all-service-addons.integ.snapshot/integ.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "version": "20.0.0", - "testCases": { - "integ.all-service-addons": { - "stacks": [ - "aws-ecs-integ" - ], - "diffAssets": false, - "stackUpdateWorkflow": true - } - }, - "synthContext": {}, - "enableLookups": false -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/all-service-addons.integ.snapshot/manifest.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/all-service-addons.integ.snapshot/manifest.json deleted file mode 100644 index 11a8c51ac58ac..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/all-service-addons.integ.snapshot/manifest.json +++ /dev/null @@ -1,644 +0,0 @@ -{ - "version": "20.0.0", - "artifacts": { - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - }, - "aws-ecs-integ": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "aws-ecs-integ.template.json", - "validateOnSynth": false - }, - "metadata": { - "/aws-ecs-integ/my-mesh/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "mymeshEA67EDEF" - } - ], - "/aws-ecs-integ/production-environment-vpc/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcAEB47DF7" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet1/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet1/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet1/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet1RouteTableAssociationA8117374" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet1/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet1DefaultRoute524C894D" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet1/EIP": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet1EIP54BA88DB" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet1/NATGateway": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet1NATGateway6075E4CA" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet2/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet2/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet2RouteTable842A68D7" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet2/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet2RouteTableAssociation0A7549F3" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet2/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet2DefaultRoute92CD697D" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet2/EIP": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet2EIP14CA46AA" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet2/NATGateway": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet2NATGatewayE1850FCC" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet1/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet1/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet1/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet1RouteTableAssociation8BA32463" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet1/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet1DefaultRouteFBB3DE6C" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet2/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet2/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet2/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet2RouteTableAssociation09188261" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet2/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet2DefaultRoute5F9AB6C1" - } - ], - "/aws-ecs-integ/production-environment-vpc/IGW": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcIGWE7C39890" - } - ], - "/aws-ecs-integ/production-environment-vpc/VPCGW": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcVPCGW1B428D07" - } - ], - "/aws-ecs-integ/production-environment-cluster/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentclusterC6599D2D" - } - ], - "/aws-ecs-integ/production-environment-cluster/DefaultServiceDiscoveryNamespace/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D" - } - ], - "/aws-ecs-integ/name-logs/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "namelogsF4B17D31" - } - ], - "/aws-ecs-integ/name-task-definition/TaskRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nametaskdefinitionTaskRole50FE844E" - } - ], - "/aws-ecs-integ/name-task-definition/TaskRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nametaskdefinitionTaskRoleDefaultPolicyE66EDC68" - } - ], - "/aws-ecs-integ/name-task-definition/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nametaskdefinition690762BB" - } - ], - "/aws-ecs-integ/name-task-definition/envoy/LogGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nametaskdefinitionenvoyLogGroup258B673B" - } - ], - "/aws-ecs-integ/name-task-definition/ExecutionRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nametaskdefinitionExecutionRole45AC5C9A" - } - ], - "/aws-ecs-integ/name-task-definition/ExecutionRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nametaskdefinitionExecutionRoleDefaultPolicyF7942D20" - } - ], - "/aws-ecs-integ/name-task-definition/firelens/LogGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nametaskdefinitionfirelensLogGroup80DDA60F" - } - ], - "/aws-ecs-integ/name-task-definition/xray/LogGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nametaskdefinitionxrayLogGroup4AF4CA37" - } - ], - "/aws-ecs-integ/name-task-definition/cloudwatch-agent/LogGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nametaskdefinitioncloudwatchagentLogGroup78DDC685" - } - ], - "/aws-ecs-integ/name-envoy-image-account-mapping": [ - { - "type": "aws:cdk:logicalId", - "data": "nameenvoyimageaccountmapping" - } - ], - "/aws-ecs-integ/name-envoy-to-appmesh/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameenvoytoappmesh2767D3E6" - } - ], - "/aws-ecs-integ/SsmParameterValue:--aws--service--aws-for-fluent-bit--latest:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter": [ - { - "type": "aws:cdk:logicalId", - "data": "SsmParameterValueawsserviceawsforfluentbitlatestC96584B6F00A464EAD1953AFF4B05118Parameter" - } - ], - "/aws-ecs-integ/name-publish-metrics/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "namepublishmetricsF329C7AE" - } - ], - "/aws-ecs-integ/name-service/Service": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceService8015C8D6" - } - ], - "/aws-ecs-integ/name-service/CloudmapService/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceCloudmapService3D5B0548" - } - ], - "/aws-ecs-integ/name-service/SecurityGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceSecurityGroup33F4662C" - } - ], - "/aws-ecs-integ/name-service/SecurityGroup/from awsecsinteggreeterserviceSecurityGroup055DC23B:80": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceSecurityGroupfromawsecsinteggreeterserviceSecurityGroup055DC23B8048057EFF" - } - ], - "/aws-ecs-integ/name-service/TaskCount/Target/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceTaskCountTarget366C2B3A" - } - ], - "/aws-ecs-integ/name-service/TaskCount/Target/name-target-cpu-utilization-50/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceTaskCountTargetnametargetcpuutilization5018B16243" - } - ], - "/aws-ecs-integ/name-virtual-node/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "namevirtualnode6C99CB14" - } - ], - "/aws-ecs-integ/name-virtual-router/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "namevirtualrouterC00E1ACE" - } - ], - "/aws-ecs-integ/name-virtual-router/name-route/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "namevirtualrouternamerouteDCDF3715" - } - ], - "/aws-ecs-integ/name-virtual-service/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "namevirtualservice3DDDDF1E" - } - ], - "/aws-ecs-integ/greeting-logs/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetinglogsCC360934" - } - ], - "/aws-ecs-integ/greeting-task-definition/TaskRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetingtaskdefinitionTaskRole9179DA4A" - } - ], - "/aws-ecs-integ/greeting-task-definition/TaskRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetingtaskdefinitionTaskRoleDefaultPolicy5DB4510A" - } - ], - "/aws-ecs-integ/greeting-task-definition/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetingtaskdefinition31690093" - } - ], - "/aws-ecs-integ/greeting-task-definition/envoy/LogGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetingtaskdefinitionenvoyLogGroup6556AC35" - } - ], - "/aws-ecs-integ/greeting-task-definition/ExecutionRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetingtaskdefinitionExecutionRole9E3A7CF3" - } - ], - "/aws-ecs-integ/greeting-task-definition/ExecutionRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetingtaskdefinitionExecutionRoleDefaultPolicy31B93022" - } - ], - "/aws-ecs-integ/greeting-task-definition/firelens/LogGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetingtaskdefinitionfirelensLogGroupD7A398A7" - } - ], - "/aws-ecs-integ/greeting-task-definition/xray/LogGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetingtaskdefinitionxrayLogGroupD25C072D" - } - ], - "/aws-ecs-integ/greeting-task-definition/cloudwatch-agent/LogGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetingtaskdefinitioncloudwatchagentLogGroupCEF72742" - } - ], - "/aws-ecs-integ/greeting-envoy-image-account-mapping": [ - { - "type": "aws:cdk:logicalId", - "data": "greetingenvoyimageaccountmapping" - } - ], - "/aws-ecs-integ/greeting-envoy-to-appmesh/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetingenvoytoappmesh97051B23" - } - ], - "/aws-ecs-integ/greeting-publish-metrics/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetingpublishmetricsF17124EF" - } - ], - "/aws-ecs-integ/greeting-service/Service": [ - { - "type": "aws:cdk:logicalId", - "data": "greetingserviceService8DA58640" - } - ], - "/aws-ecs-integ/greeting-service/CloudmapService/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetingserviceCloudmapService0A2D7385" - } - ], - "/aws-ecs-integ/greeting-service/SecurityGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetingserviceSecurityGroupE9BE665B" - } - ], - "/aws-ecs-integ/greeting-service/SecurityGroup/from awsecsinteggreeterserviceSecurityGroup055DC23B:80": [ - { - "type": "aws:cdk:logicalId", - "data": "greetingserviceSecurityGroupfromawsecsinteggreeterserviceSecurityGroup055DC23B807B9C4357" - } - ], - "/aws-ecs-integ/greeting-service/TaskCount/Target/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetingserviceTaskCountTargetA036048C" - } - ], - "/aws-ecs-integ/greeting-service/TaskCount/Target/greeting-target-cpu-utilization-50/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetingserviceTaskCountTargetgreetingtargetcpuutilization50FEAF6434" - } - ], - "/aws-ecs-integ/greeting-virtual-node/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetingvirtualnodeC4A2C517" - } - ], - "/aws-ecs-integ/greeting-virtual-router/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetingvirtualrouter0F898D1A" - } - ], - "/aws-ecs-integ/greeting-virtual-router/greeting-route/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetingvirtualroutergreetingroute46305F50" - } - ], - "/aws-ecs-integ/greeting-virtual-service/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetingvirtualservice60AD3AD9" - } - ], - "/aws-ecs-integ/greeter-logs/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greeterlogsCCD2F8B2" - } - ], - "/aws-ecs-integ/greeter-load-balancer/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greeterloadbalancer85256741" - } - ], - "/aws-ecs-integ/greeter-load-balancer/SecurityGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greeterloadbalancerSecurityGroupEE1B20F3" - } - ], - "/aws-ecs-integ/greeter-load-balancer/SecurityGroup/to awsecsinteggreeterserviceSecurityGroup055DC23B:80": [ - { - "type": "aws:cdk:logicalId", - "data": "greeterloadbalancerSecurityGrouptoawsecsinteggreeterserviceSecurityGroup055DC23B803EEF3320" - } - ], - "/aws-ecs-integ/greeter-load-balancer/greeter-listener/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greeterloadbalancergreeterlistener952E028B" - } - ], - "/aws-ecs-integ/greeter-load-balancer/greeter-listener/greeterGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greeterloadbalancergreeterlistenergreeterGroupFFBFF0C2" - } - ], - "/aws-ecs-integ/greeter-load-balancer-dns-output": [ - { - "type": "aws:cdk:logicalId", - "data": "greeterloadbalancerdnsoutput" - } - ], - "/aws-ecs-integ/greeter-task-definition/TaskRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetertaskdefinitionTaskRole2A098ACC" - } - ], - "/aws-ecs-integ/greeter-task-definition/TaskRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetertaskdefinitionTaskRoleDefaultPolicyD0F53B1C" - } - ], - "/aws-ecs-integ/greeter-task-definition/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetertaskdefinitionE956EEA2" - } - ], - "/aws-ecs-integ/greeter-task-definition/envoy/LogGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetertaskdefinitionenvoyLogGroup6E10B93E" - } - ], - "/aws-ecs-integ/greeter-task-definition/ExecutionRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetertaskdefinitionExecutionRoleAED0EC79" - } - ], - "/aws-ecs-integ/greeter-task-definition/ExecutionRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetertaskdefinitionExecutionRoleDefaultPolicy0D8E9106" - } - ], - "/aws-ecs-integ/greeter-task-definition/firelens/LogGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetertaskdefinitionfirelensLogGroupD5BAAC35" - } - ], - "/aws-ecs-integ/greeter-task-definition/xray/LogGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetertaskdefinitionxrayLogGroupBC1558B6" - } - ], - "/aws-ecs-integ/greeter-task-definition/cloudwatch-agent/LogGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetertaskdefinitioncloudwatchagentLogGroupE7EAF327" - } - ], - "/aws-ecs-integ/greeter-envoy-image-account-mapping": [ - { - "type": "aws:cdk:logicalId", - "data": "greeterenvoyimageaccountmapping" - } - ], - "/aws-ecs-integ/greeter-envoy-to-appmesh/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greeterenvoytoappmesh1A94938B" - } - ], - "/aws-ecs-integ/greeter-publish-metrics/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greeterpublishmetrics0CCA359A" - } - ], - "/aws-ecs-integ/greeter-service/Service": [ - { - "type": "aws:cdk:logicalId", - "data": "greeterserviceService8EDD3244" - } - ], - "/aws-ecs-integ/greeter-service/CloudmapService/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greeterserviceCloudmapServiceEE292978" - } - ], - "/aws-ecs-integ/greeter-service/SecurityGroup": [ - { - "type": "aws:cdk:warning", - "data": "Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customized rules, set allowAllOutbound=false on the SecurityGroup" - }, - { - "type": "aws:cdk:warning", - "data": "Ignoring Egress rule since 'allowAllOutbound' is set to true; To add customized rules, set allowAllOutbound=false on the SecurityGroup" - } - ], - "/aws-ecs-integ/greeter-service/SecurityGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greeterserviceSecurityGroupDB4AC3A9" - } - ], - "/aws-ecs-integ/greeter-service/SecurityGroup/from awsecsinteggreeterloadbalancerSecurityGroupF791FA83:80": [ - { - "type": "aws:cdk:logicalId", - "data": "greeterserviceSecurityGroupfromawsecsinteggreeterloadbalancerSecurityGroupF791FA838037FDF8F5" - } - ], - "/aws-ecs-integ/greeter-service/TaskCount/Target/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greeterserviceTaskCountTargetAB95B3D0" - } - ], - "/aws-ecs-integ/greeter-service/TaskCount/Target/greeter-target-cpu-utilization-50/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greeterserviceTaskCountTargetgreetertargetcpuutilization50299508D1" - } - ], - "/aws-ecs-integ/greeter-virtual-node/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetervirtualnode21EA7CC9" - } - ], - "/aws-ecs-integ/greeter-virtual-router/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetervirtualrouter193840BB" - } - ], - "/aws-ecs-integ/greeter-virtual-router/greeter-route/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetervirtualroutergreeterroute3EC6ACB0" - } - ], - "/aws-ecs-integ/greeter-virtual-service/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "greetervirtualservice6559950C" - } - ] - }, - "displayName": "aws-ecs-integ" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/all-service-addons.integ.snapshot/tree.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/all-service-addons.integ.snapshot/tree.json deleted file mode 100644 index 3a7fcab3b79a5..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/all-service-addons.integ.snapshot/tree.json +++ /dev/null @@ -1,4945 +0,0 @@ -{ - "version": "tree-0.1", - "tree": { - "id": "App", - "path": "", - "children": { - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.78" - } - }, - "aws-ecs-integ": { - "id": "aws-ecs-integ", - "path": "aws-ecs-integ", - "children": { - "my-mesh": { - "id": "my-mesh", - "path": "aws-ecs-integ/my-mesh", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/my-mesh/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::AppMesh::Mesh", - "aws:cdk:cloudformation:props": { - "meshName": "awsecsintegmymeshFCC0D554", - "spec": {} - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.CfnMesh", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.Mesh", - "version": "0.0.0" - } - }, - "production": { - "id": "production", - "path": "aws-ecs-integ/production", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.78" - } - }, - "production-environment-vpc": { - "id": "production-environment-vpc", - "path": "aws-ecs-integ/production-environment-vpc", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/production-environment-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-integ/production-environment-vpc" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnVPC", - "version": "0.0.0" - } - }, - "PublicSubnet1": { - "id": "PublicSubnet1", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21" - }, - "subnetId": { - "Ref": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21" - }, - "destinationCidrBlock": "0.0.0.0/0", - "gatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - }, - "EIP": { - "id": "EIP", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1/EIP", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::EIP", - "aws:cdk:cloudformation:props": { - "domain": "vpc", - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnEIP", - "version": "0.0.0" - } - }, - "NATGateway": { - "id": "NATGateway", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1/NATGateway", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", - "aws:cdk:cloudformation:props": { - "subnetId": { - "Ref": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - }, - "allocationId": { - "Fn::GetAtt": [ - "productionenvironmentvpcPublicSubnet1EIP54BA88DB", - "AllocationId" - ] - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnNatGateway", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PublicSubnet", - "version": "0.0.0" - } - }, - "PublicSubnet2": { - "id": "PublicSubnet2", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPublicSubnet2RouteTable842A68D7" - }, - "subnetId": { - "Ref": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPublicSubnet2RouteTable842A68D7" - }, - "destinationCidrBlock": "0.0.0.0/0", - "gatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - }, - "EIP": { - "id": "EIP", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2/EIP", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::EIP", - "aws:cdk:cloudformation:props": { - "domain": "vpc", - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnEIP", - "version": "0.0.0" - } - }, - "NATGateway": { - "id": "NATGateway", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2/NATGateway", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", - "aws:cdk:cloudformation:props": { - "subnetId": { - "Ref": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - }, - "allocationId": { - "Fn::GetAtt": [ - "productionenvironmentvpcPublicSubnet2EIP14CA46AA", - "AllocationId" - ] - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnNatGateway", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PublicSubnet", - "version": "0.0.0" - } - }, - "PrivateSubnet1": { - "id": "PrivateSubnet1", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C" - }, - "subnetId": { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C" - }, - "destinationCidrBlock": "0.0.0.0/0", - "natGatewayId": { - "Ref": "productionenvironmentvpcPublicSubnet1NATGateway6075E4CA" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PrivateSubnet", - "version": "0.0.0" - } - }, - "PrivateSubnet2": { - "id": "PrivateSubnet2", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2" - }, - "subnetId": { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2" - }, - "destinationCidrBlock": "0.0.0.0/0", - "natGatewayId": { - "Ref": "productionenvironmentvpcPublicSubnet2NATGatewayE1850FCC" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PrivateSubnet", - "version": "0.0.0" - } - }, - "IGW": { - "id": "IGW", - "path": "aws-ecs-integ/production-environment-vpc/IGW", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::InternetGateway", - "aws:cdk:cloudformation:props": { - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnInternetGateway", - "version": "0.0.0" - } - }, - "VPCGW": { - "id": "VPCGW", - "path": "aws-ecs-integ/production-environment-vpc/VPCGW", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "internetGatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnVPCGatewayAttachment", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.Vpc", - "version": "0.0.0" - } - }, - "production-environment-cluster": { - "id": "production-environment-cluster", - "path": "aws-ecs-integ/production-environment-cluster", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/production-environment-cluster/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ECS::Cluster", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.CfnCluster", - "version": "0.0.0" - } - }, - "DefaultServiceDiscoveryNamespace": { - "id": "DefaultServiceDiscoveryNamespace", - "path": "aws-ecs-integ/production-environment-cluster/DefaultServiceDiscoveryNamespace", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/production-environment-cluster/DefaultServiceDiscoveryNamespace/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ServiceDiscovery::PrivateDnsNamespace", - "aws:cdk:cloudformation:props": { - "name": "production", - "vpc": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-servicediscovery.CfnPrivateDnsNamespace", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-servicediscovery.PrivateDnsNamespace", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.Cluster", - "version": "0.0.0" - } - }, - "name": { - "id": "name", - "path": "aws-ecs-integ/name", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.78" - } - }, - "name-logs": { - "id": "name-logs", - "path": "aws-ecs-integ/name-logs", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-logs/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", - "aws:cdk:cloudformation:props": { - "logGroupName": "name-logs", - "retentionInDays": 7 - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.CfnLogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.LogGroup", - "version": "0.0.0" - } - }, - "name-task-definition": { - "id": "name-task-definition", - "path": "aws-ecs-integ/name-task-definition", - "children": { - "TaskRole": { - "id": "TaskRole", - "path": "aws-ecs-integ/name-task-definition/TaskRole", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-task-definition/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" - }, - "managedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/AWSXRayDaemonWriteAccess" - ] - ] - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "aws-ecs-integ/name-task-definition/TaskRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-task-definition/TaskRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:DescribeLogStreams", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "policyName": "nametaskdefinitionTaskRoleDefaultPolicyE66EDC68", - "roles": [ - { - "Ref": "nametaskdefinitionTaskRole50FE844E" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-task-definition/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ECS::TaskDefinition", - "aws:cdk:cloudformation:props": { - "containerDefinitions": [ - { - "cpu": 1024, - "dependsOn": [ - { - "containerName": "firelens", - "condition": "START" - }, - { - "containerName": "envoy", - "condition": "HEALTHY" - }, - { - "containerName": "cloudwatch-agent", - "condition": "START" - }, - { - "containerName": "xray", - "condition": "HEALTHY" - } - ], - "essential": true, - "image": "nathanpeck/name", - "memory": 2048, - "name": "app", - "portMappings": [ - { - "containerPort": 80, - "protocol": "tcp" - } - ], - "ulimits": [ - { - "name": "nofile", - "softLimit": 1024000, - "hardLimit": 1024000 - } - ], - "logConfiguration": { - "logDriver": "awsfirelens", - "options": { - "Name": "cloudwatch", - "region": { - "Ref": "AWS::Region" - }, - "log_group_name": { - "Ref": "namelogsF4B17D31" - }, - "log_stream_prefix": "name/" - } - }, - "environment": [ - { - "name": "PORT", - "value": "80" - } - ] - }, - { - "essential": true, - "image": { - "Fn::Join": [ - "", - [ - { - "Fn::FindInMap": [ - "nameenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ".dkr.ecr.", - { - "Ref": "AWS::Region" - }, - ".", - { - "Ref": "AWS::URLSuffix" - }, - "/aws-appmesh-envoy:v1.15.1.0-prod" - ] - ] - }, - "memoryReservation": 128, - "name": "envoy", - "ulimits": [ - { - "name": "nofile", - "softLimit": 1024000, - "hardLimit": 1024000 - } - ], - "user": "1337", - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-group": { - "Ref": "nametaskdefinitionenvoyLogGroup258B673B" - }, - "awslogs-stream-prefix": "envoy", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "environment": [ - { - "name": "APPMESH_VIRTUAL_NODE_NAME", - "value": { - "Fn::Join": [ - "", - [ - "mesh/", - { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "/virtualNode/name" - ] - ] - } - }, - { - "name": "AWS_REGION", - "value": { - "Ref": "AWS::Region" - } - }, - { - "name": "ENABLE_ENVOY_STATS_TAGS", - "value": "1" - }, - { - "name": "ENABLE_ENVOY_DOG_STATSD", - "value": "1" - } - ], - "healthCheck": { - "command": [ - "CMD-SHELL", - "curl -s http://localhost:9901/server_info | grep state | grep -q LIVE" - ], - "interval": 5, - "retries": 3, - "startPeriod": 10, - "timeout": 2 - } - }, - { - "dependsOn": [ - { - "containerName": "envoy", - "condition": "HEALTHY" - } - ], - "essential": true, - "image": { - "Ref": "SsmParameterValueawsserviceawsforfluentbitlatestC96584B6F00A464EAD1953AFF4B05118Parameter" - }, - "memoryReservation": 50, - "name": "firelens", - "user": "0:1338", - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-group": { - "Ref": "nametaskdefinitionfirelensLogGroup80DDA60F" - }, - "awslogs-stream-prefix": "firelens", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "firelensConfiguration": { - "type": "fluentbit" - } - }, - { - "dependsOn": [ - { - "containerName": "envoy", - "condition": "HEALTHY" - } - ], - "essential": true, - "image": "amazon/aws-xray-daemon:latest", - "memoryReservation": 256, - "name": "xray", - "user": "1337", - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-group": { - "Ref": "nametaskdefinitionxrayLogGroup4AF4CA37" - }, - "awslogs-stream-prefix": "xray", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "environment": [ - { - "name": "AWS_REGION", - "value": { - "Ref": "AWS::Region" - } - } - ], - "healthCheck": { - "command": [ - "CMD-SHELL", - "curl -s http://localhost:2000" - ], - "interval": 5, - "retries": 3, - "startPeriod": 10, - "timeout": 2 - } - }, - { - "dependsOn": [ - { - "containerName": "envoy", - "condition": "HEALTHY" - } - ], - "essential": true, - "image": "amazon/cloudwatch-agent:latest", - "memoryReservation": 50, - "name": "cloudwatch-agent", - "user": "0:1338", - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-group": { - "Ref": "nametaskdefinitioncloudwatchagentLogGroup78DDC685" - }, - "awslogs-stream-prefix": "cloudwatch-agent", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "environment": [ - { - "name": "CW_CONFIG_CONTENT", - "value": "{\"logs\":{\"metrics_collected\":{\"emf\":{}}},\"metrics\":{\"metrics_collected\":{\"statsd\":{}}}}" - } - ] - } - ], - "cpu": "1024", - "executionRoleArn": { - "Fn::GetAtt": [ - "nametaskdefinitionExecutionRole45AC5C9A", - "Arn" - ] - }, - "family": "awsecsintegnametaskdefinition0EA6A1A0", - "memory": "2048", - "networkMode": "awsvpc", - "proxyConfiguration": { - "containerName": "envoy", - "proxyConfigurationProperties": [ - { - "name": "AppPorts", - "value": "80" - }, - { - "name": "ProxyEgressPort", - "value": "15001" - }, - { - "name": "ProxyIngressPort", - "value": "15000" - }, - { - "name": "IgnoredUID", - "value": "1337" - }, - { - "name": "IgnoredGID", - "value": "1338" - }, - { - "name": "EgressIgnoredIPs", - "value": "169.254.170.2,169.254.169.254" - } - ], - "type": "APPMESH" - }, - "requiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "taskRoleArn": { - "Fn::GetAtt": [ - "nametaskdefinitionTaskRole50FE844E", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.CfnTaskDefinition", - "version": "0.0.0" - } - }, - "app": { - "id": "app", - "path": "aws-ecs-integ/name-task-definition/app", - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.ContainerDefinition", - "version": "0.0.0" - } - }, - "envoy": { - "id": "envoy", - "path": "aws-ecs-integ/name-task-definition/envoy", - "children": { - "LogGroup": { - "id": "LogGroup", - "path": "aws-ecs-integ/name-task-definition/envoy/LogGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-task-definition/envoy/LogGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.CfnLogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.LogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.ContainerDefinition", - "version": "0.0.0" - } - }, - "ExecutionRole": { - "id": "ExecutionRole", - "path": "aws-ecs-integ/name-task-definition/ExecutionRole", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-task-definition/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/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "aws-ecs-integ/name-task-definition/ExecutionRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-task-definition/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" - }, - ":", - { - "Fn::FindInMap": [ - "nameenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ":repository/aws-appmesh-envoy" - ] - ] - } - }, - { - "Action": [ - "ecr:BatchCheckLayerAvailability", - "ecr:BatchGetImage", - "ecr:GetAuthorizationToken", - "ecr:GetDownloadUrlForLayer" - ], - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "nametaskdefinitioncloudwatchagentLogGroup78DDC685", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "nametaskdefinitionenvoyLogGroup258B673B", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "nametaskdefinitionfirelensLogGroup80DDA60F", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "nametaskdefinitionxrayLogGroup4AF4CA37", - "Arn" - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "policyName": "nametaskdefinitionExecutionRoleDefaultPolicyF7942D20", - "roles": [ - { - "Ref": "nametaskdefinitionExecutionRole45AC5C9A" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "firelens": { - "id": "firelens", - "path": "aws-ecs-integ/name-task-definition/firelens", - "children": { - "LogGroup": { - "id": "LogGroup", - "path": "aws-ecs-integ/name-task-definition/firelens/LogGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-task-definition/firelens/LogGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.CfnLogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.LogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.FirelensLogRouter", - "version": "0.0.0" - } - }, - "xray": { - "id": "xray", - "path": "aws-ecs-integ/name-task-definition/xray", - "children": { - "LogGroup": { - "id": "LogGroup", - "path": "aws-ecs-integ/name-task-definition/xray/LogGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-task-definition/xray/LogGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.CfnLogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.LogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.ContainerDefinition", - "version": "0.0.0" - } - }, - "cloudwatch-agent": { - "id": "cloudwatch-agent", - "path": "aws-ecs-integ/name-task-definition/cloudwatch-agent", - "children": { - "LogGroup": { - "id": "LogGroup", - "path": "aws-ecs-integ/name-task-definition/cloudwatch-agent/LogGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-task-definition/cloudwatch-agent/LogGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.CfnLogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.LogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.ContainerDefinition", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.TaskDefinition", - "version": "0.0.0" - } - }, - "name-envoy-image-account-mapping": { - "id": "name-envoy-image-account-mapping", - "path": "aws-ecs-integ/name-envoy-image-account-mapping", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnMapping", - "version": "0.0.0" - } - }, - "name-envoy-repo": { - "id": "name-envoy-repo", - "path": "aws-ecs-integ/name-envoy-repo", - "constructInfo": { - "fqn": "@aws-cdk/aws-ecr.RepositoryBase", - "version": "0.0.0" - } - }, - "name-envoy-to-appmesh": { - "id": "name-envoy-to-appmesh", - "path": "aws-ecs-integ/name-envoy-to-appmesh", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-envoy-to-appmesh/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": "appmesh:StreamAggregatedResources", - "Effect": "Allow", - "Resource": { - "Ref": "mymeshEA67EDEF" - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "nameenvoytoappmesh2767D3E6", - "roles": [ - { - "Ref": "nametaskdefinitionTaskRole50FE844E" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - }, - "SsmParameterValue:--aws--service--aws-for-fluent-bit--latest:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter": { - "id": "SsmParameterValue:--aws--service--aws-for-fluent-bit--latest:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter", - "path": "aws-ecs-integ/SsmParameterValue:--aws--service--aws-for-fluent-bit--latest:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnParameter", - "version": "0.0.0" - } - }, - "SsmParameterValue:--aws--service--aws-for-fluent-bit--latest:C96584B6-F00A-464E-AD19-53AFF4B05118": { - "id": "SsmParameterValue:--aws--service--aws-for-fluent-bit--latest:C96584B6-F00A-464E-AD19-53AFF4B05118", - "path": "aws-ecs-integ/SsmParameterValue:--aws--service--aws-for-fluent-bit--latest:C96584B6-F00A-464E-AD19-53AFF4B05118", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "name-publish-metrics": { - "id": "name-publish-metrics", - "path": "aws-ecs-integ/name-publish-metrics", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-publish-metrics/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": "cloudwatch:PutMetricData", - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "policyName": "namepublishmetricsF329C7AE", - "roles": [ - { - "Ref": "nametaskdefinitionTaskRole50FE844E" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - }, - "name-service": { - "id": "name-service", - "path": "aws-ecs-integ/name-service", - "children": { - "Service": { - "id": "Service", - "path": "aws-ecs-integ/name-service/Service", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ECS::Service", - "aws:cdk:cloudformation:props": { - "cluster": { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "deploymentConfiguration": { - "maximumPercent": 150, - "minimumHealthyPercent": 100 - }, - "desiredCount": 2, - "enableEcsManagedTags": false, - "launchType": "FARGATE", - "networkConfiguration": { - "awsvpcConfiguration": { - "assignPublicIp": "DISABLED", - "subnets": [ - { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - }, - { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - ], - "securityGroups": [ - { - "Fn::GetAtt": [ - "nameserviceSecurityGroup33F4662C", - "GroupId" - ] - } - ] - } - }, - "serviceRegistries": [ - { - "registryArn": { - "Fn::GetAtt": [ - "nameserviceCloudmapService3D5B0548", - "Arn" - ] - } - } - ], - "taskDefinition": { - "Ref": "nametaskdefinition690762BB" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.CfnService", - "version": "0.0.0" - } - }, - "CloudmapService": { - "id": "CloudmapService", - "path": "aws-ecs-integ/name-service/CloudmapService", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-service/CloudmapService/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ServiceDiscovery::Service", - "aws:cdk:cloudformation:props": { - "dnsConfig": { - "dnsRecords": [ - { - "type": "A", - "ttl": 10 - } - ], - "namespaceId": { - "Fn::GetAtt": [ - "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D", - "Id" - ] - }, - "routingPolicy": "MULTIVALUE" - }, - "healthCheckCustomConfig": { - "failureThreshold": 2 - }, - "name": "name", - "namespaceId": { - "Fn::GetAtt": [ - "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D", - "Id" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-servicediscovery.CfnService", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-servicediscovery.Service", - "version": "0.0.0" - } - }, - "SecurityGroup": { - "id": "SecurityGroup", - "path": "aws-ecs-integ/name-service/SecurityGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-service/SecurityGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", - "aws:cdk:cloudformation:props": { - "groupDescription": "aws-ecs-integ/name-service/SecurityGroup", - "securityGroupEgress": [ - { - "cidrIp": "0.0.0.0/0", - "description": "Allow all outbound traffic by default", - "ipProtocol": "-1" - } - ], - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSecurityGroup", - "version": "0.0.0" - } - }, - "from awsecsinteggreeterserviceSecurityGroup055DC23B:80": { - "id": "from awsecsinteggreeterserviceSecurityGroup055DC23B:80", - "path": "aws-ecs-integ/name-service/SecurityGroup/from awsecsinteggreeterserviceSecurityGroup055DC23B:80", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroupIngress", - "aws:cdk:cloudformation:props": { - "ipProtocol": "tcp", - "description": "Accept inbound traffic from greeter", - "fromPort": 80, - "groupId": { - "Fn::GetAtt": [ - "nameserviceSecurityGroup33F4662C", - "GroupId" - ] - }, - "sourceSecurityGroupId": { - "Fn::GetAtt": [ - "greeterserviceSecurityGroupDB4AC3A9", - "GroupId" - ] - }, - "toPort": 80 - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSecurityGroupIngress", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.SecurityGroup", - "version": "0.0.0" - } - }, - "ScalingRole": { - "id": "ScalingRole", - "path": "aws-ecs-integ/name-service/ScalingRole", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "TaskCount": { - "id": "TaskCount", - "path": "aws-ecs-integ/name-service/TaskCount", - "children": { - "Target": { - "id": "Target", - "path": "aws-ecs-integ/name-service/TaskCount/Target", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-service/TaskCount/Target/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ApplicationAutoScaling::ScalableTarget", - "aws:cdk:cloudformation:props": { - "maxCapacity": 8, - "minCapacity": 2, - "resourceId": { - "Fn::Join": [ - "", - [ - "service/", - { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "/", - { - "Fn::GetAtt": [ - "nameserviceService8015C8D6", - "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/aws-applicationautoscaling.CfnScalableTarget", - "version": "0.0.0" - } - }, - "name-target-cpu-utilization-50": { - "id": "name-target-cpu-utilization-50", - "path": "aws-ecs-integ/name-service/TaskCount/Target/name-target-cpu-utilization-50", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-service/TaskCount/Target/name-target-cpu-utilization-50/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ApplicationAutoScaling::ScalingPolicy", - "aws:cdk:cloudformation:props": { - "policyName": "awsecsintegnameserviceTaskCountTargetnametargetcpuutilization50CAB59E05", - "policyType": "TargetTrackingScaling", - "scalingTargetId": { - "Ref": "nameserviceTaskCountTarget366C2B3A" - }, - "targetTrackingScalingPolicyConfiguration": { - "predefinedMetricSpecification": { - "predefinedMetricType": "ECSServiceAverageCPUUtilization" - }, - "scaleInCooldown": 60, - "scaleOutCooldown": 60, - "targetValue": 50 - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-applicationautoscaling.CfnScalingPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-applicationautoscaling.TargetTrackingScalingPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-applicationautoscaling.ScalableTarget", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.ScalableTaskCount", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.FargateService", - "version": "0.0.0" - } - }, - "name-virtual-node": { - "id": "name-virtual-node", - "path": "aws-ecs-integ/name-virtual-node", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-virtual-node/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::AppMesh::VirtualNode", - "aws:cdk:cloudformation:props": { - "meshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "spec": { - "listeners": [ - { - "portMapping": { - "port": 80, - "protocol": "http" - } - } - ], - "serviceDiscovery": { - "awsCloudMap": { - "namespaceName": "production", - "serviceName": { - "Fn::GetAtt": [ - "nameserviceCloudmapService3D5B0548", - "Name" - ] - } - } - } - }, - "virtualNodeName": "name" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.CfnVirtualNode", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.VirtualNode", - "version": "0.0.0" - } - }, - "name-virtual-router": { - "id": "name-virtual-router", - "path": "aws-ecs-integ/name-virtual-router", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-virtual-router/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::AppMesh::VirtualRouter", - "aws:cdk:cloudformation:props": { - "meshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "spec": { - "listeners": [ - { - "portMapping": { - "port": 80, - "protocol": "http" - } - } - ] - }, - "virtualRouterName": "name" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.CfnVirtualRouter", - "version": "0.0.0" - } - }, - "name-route": { - "id": "name-route", - "path": "aws-ecs-integ/name-virtual-router/name-route", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-virtual-router/name-route/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::AppMesh::Route", - "aws:cdk:cloudformation:props": { - "meshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "spec": { - "httpRoute": { - "action": { - "weightedTargets": [ - { - "virtualNode": { - "Fn::GetAtt": [ - "namevirtualnode6C99CB14", - "VirtualNodeName" - ] - }, - "weight": 1 - } - ] - }, - "match": { - "prefix": "/" - } - } - }, - "virtualRouterName": { - "Fn::GetAtt": [ - "namevirtualrouterC00E1ACE", - "VirtualRouterName" - ] - }, - "routeName": "name-route" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.CfnRoute", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.Route", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.VirtualRouter", - "version": "0.0.0" - } - }, - "name-virtual-service": { - "id": "name-virtual-service", - "path": "aws-ecs-integ/name-virtual-service", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-virtual-service/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::AppMesh::VirtualService", - "aws:cdk:cloudformation:props": { - "meshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "spec": { - "provider": { - "virtualRouter": { - "virtualRouterName": { - "Fn::GetAtt": [ - "namevirtualrouterC00E1ACE", - "VirtualRouterName" - ] - } - } - } - }, - "virtualServiceName": "name.production" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.CfnVirtualService", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.VirtualService", - "version": "0.0.0" - } - }, - "greeting": { - "id": "greeting", - "path": "aws-ecs-integ/greeting", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.78" - } - }, - "greeting-logs": { - "id": "greeting-logs", - "path": "aws-ecs-integ/greeting-logs", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeting-logs/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", - "aws:cdk:cloudformation:props": { - "logGroupName": "greeting-logs", - "retentionInDays": 7 - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.CfnLogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.LogGroup", - "version": "0.0.0" - } - }, - "greeting-task-definition": { - "id": "greeting-task-definition", - "path": "aws-ecs-integ/greeting-task-definition", - "children": { - "TaskRole": { - "id": "TaskRole", - "path": "aws-ecs-integ/greeting-task-definition/TaskRole", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeting-task-definition/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" - }, - "managedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/AWSXRayDaemonWriteAccess" - ] - ] - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "aws-ecs-integ/greeting-task-definition/TaskRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeting-task-definition/TaskRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:DescribeLogStreams", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "policyName": "greetingtaskdefinitionTaskRoleDefaultPolicy5DB4510A", - "roles": [ - { - "Ref": "greetingtaskdefinitionTaskRole9179DA4A" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeting-task-definition/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ECS::TaskDefinition", - "aws:cdk:cloudformation:props": { - "containerDefinitions": [ - { - "cpu": 1024, - "dependsOn": [ - { - "containerName": "firelens", - "condition": "START" - }, - { - "containerName": "envoy", - "condition": "HEALTHY" - }, - { - "containerName": "cloudwatch-agent", - "condition": "START" - }, - { - "containerName": "xray", - "condition": "HEALTHY" - } - ], - "essential": true, - "image": "nathanpeck/greeting", - "memory": 2048, - "name": "app", - "portMappings": [ - { - "containerPort": 80, - "protocol": "tcp" - } - ], - "ulimits": [ - { - "name": "nofile", - "softLimit": 1024000, - "hardLimit": 1024000 - } - ], - "logConfiguration": { - "logDriver": "awsfirelens", - "options": { - "Name": "cloudwatch", - "region": { - "Ref": "AWS::Region" - }, - "log_group_name": { - "Ref": "greetinglogsCC360934" - }, - "log_stream_prefix": "greeting/" - } - }, - "environment": [ - { - "name": "PORT", - "value": "80" - } - ] - }, - { - "essential": true, - "image": { - "Fn::Join": [ - "", - [ - { - "Fn::FindInMap": [ - "greetingenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ".dkr.ecr.", - { - "Ref": "AWS::Region" - }, - ".", - { - "Ref": "AWS::URLSuffix" - }, - "/aws-appmesh-envoy:v1.15.1.0-prod" - ] - ] - }, - "memoryReservation": 128, - "name": "envoy", - "ulimits": [ - { - "name": "nofile", - "softLimit": 1024000, - "hardLimit": 1024000 - } - ], - "user": "1337", - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-group": { - "Ref": "greetingtaskdefinitionenvoyLogGroup6556AC35" - }, - "awslogs-stream-prefix": "envoy", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "environment": [ - { - "name": "APPMESH_VIRTUAL_NODE_NAME", - "value": { - "Fn::Join": [ - "", - [ - "mesh/", - { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "/virtualNode/greeting" - ] - ] - } - }, - { - "name": "AWS_REGION", - "value": { - "Ref": "AWS::Region" - } - }, - { - "name": "ENABLE_ENVOY_STATS_TAGS", - "value": "1" - }, - { - "name": "ENABLE_ENVOY_DOG_STATSD", - "value": "1" - } - ], - "healthCheck": { - "command": [ - "CMD-SHELL", - "curl -s http://localhost:9901/server_info | grep state | grep -q LIVE" - ], - "interval": 5, - "retries": 3, - "startPeriod": 10, - "timeout": 2 - } - }, - { - "dependsOn": [ - { - "containerName": "envoy", - "condition": "HEALTHY" - } - ], - "essential": true, - "image": { - "Ref": "SsmParameterValueawsserviceawsforfluentbitlatestC96584B6F00A464EAD1953AFF4B05118Parameter" - }, - "memoryReservation": 50, - "name": "firelens", - "user": "0:1338", - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-group": { - "Ref": "greetingtaskdefinitionfirelensLogGroupD7A398A7" - }, - "awslogs-stream-prefix": "firelens", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "firelensConfiguration": { - "type": "fluentbit" - } - }, - { - "dependsOn": [ - { - "containerName": "envoy", - "condition": "HEALTHY" - } - ], - "essential": true, - "image": "amazon/aws-xray-daemon:latest", - "memoryReservation": 256, - "name": "xray", - "user": "1337", - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-group": { - "Ref": "greetingtaskdefinitionxrayLogGroupD25C072D" - }, - "awslogs-stream-prefix": "xray", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "environment": [ - { - "name": "AWS_REGION", - "value": { - "Ref": "AWS::Region" - } - } - ], - "healthCheck": { - "command": [ - "CMD-SHELL", - "curl -s http://localhost:2000" - ], - "interval": 5, - "retries": 3, - "startPeriod": 10, - "timeout": 2 - } - }, - { - "dependsOn": [ - { - "containerName": "envoy", - "condition": "HEALTHY" - } - ], - "essential": true, - "image": "amazon/cloudwatch-agent:latest", - "memoryReservation": 50, - "name": "cloudwatch-agent", - "user": "0:1338", - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-group": { - "Ref": "greetingtaskdefinitioncloudwatchagentLogGroupCEF72742" - }, - "awslogs-stream-prefix": "cloudwatch-agent", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "environment": [ - { - "name": "CW_CONFIG_CONTENT", - "value": "{\"logs\":{\"metrics_collected\":{\"emf\":{}}},\"metrics\":{\"metrics_collected\":{\"statsd\":{}}}}" - } - ] - } - ], - "cpu": "1024", - "executionRoleArn": { - "Fn::GetAtt": [ - "greetingtaskdefinitionExecutionRole9E3A7CF3", - "Arn" - ] - }, - "family": "awsecsinteggreetingtaskdefinitionA6E8A57B", - "memory": "2048", - "networkMode": "awsvpc", - "proxyConfiguration": { - "containerName": "envoy", - "proxyConfigurationProperties": [ - { - "name": "AppPorts", - "value": "80" - }, - { - "name": "ProxyEgressPort", - "value": "15001" - }, - { - "name": "ProxyIngressPort", - "value": "15000" - }, - { - "name": "IgnoredUID", - "value": "1337" - }, - { - "name": "IgnoredGID", - "value": "1338" - }, - { - "name": "EgressIgnoredIPs", - "value": "169.254.170.2,169.254.169.254" - } - ], - "type": "APPMESH" - }, - "requiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "taskRoleArn": { - "Fn::GetAtt": [ - "greetingtaskdefinitionTaskRole9179DA4A", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.CfnTaskDefinition", - "version": "0.0.0" - } - }, - "app": { - "id": "app", - "path": "aws-ecs-integ/greeting-task-definition/app", - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.ContainerDefinition", - "version": "0.0.0" - } - }, - "envoy": { - "id": "envoy", - "path": "aws-ecs-integ/greeting-task-definition/envoy", - "children": { - "LogGroup": { - "id": "LogGroup", - "path": "aws-ecs-integ/greeting-task-definition/envoy/LogGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeting-task-definition/envoy/LogGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.CfnLogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.LogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.ContainerDefinition", - "version": "0.0.0" - } - }, - "ExecutionRole": { - "id": "ExecutionRole", - "path": "aws-ecs-integ/greeting-task-definition/ExecutionRole", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeting-task-definition/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/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "aws-ecs-integ/greeting-task-definition/ExecutionRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeting-task-definition/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" - }, - ":", - { - "Fn::FindInMap": [ - "greetingenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ":repository/aws-appmesh-envoy" - ] - ] - } - }, - { - "Action": [ - "ecr:BatchCheckLayerAvailability", - "ecr:BatchGetImage", - "ecr:GetAuthorizationToken", - "ecr:GetDownloadUrlForLayer" - ], - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "greetingtaskdefinitioncloudwatchagentLogGroupCEF72742", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "greetingtaskdefinitionenvoyLogGroup6556AC35", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "greetingtaskdefinitionfirelensLogGroupD7A398A7", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "greetingtaskdefinitionxrayLogGroupD25C072D", - "Arn" - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "policyName": "greetingtaskdefinitionExecutionRoleDefaultPolicy31B93022", - "roles": [ - { - "Ref": "greetingtaskdefinitionExecutionRole9E3A7CF3" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "firelens": { - "id": "firelens", - "path": "aws-ecs-integ/greeting-task-definition/firelens", - "children": { - "LogGroup": { - "id": "LogGroup", - "path": "aws-ecs-integ/greeting-task-definition/firelens/LogGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeting-task-definition/firelens/LogGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.CfnLogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.LogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.FirelensLogRouter", - "version": "0.0.0" - } - }, - "xray": { - "id": "xray", - "path": "aws-ecs-integ/greeting-task-definition/xray", - "children": { - "LogGroup": { - "id": "LogGroup", - "path": "aws-ecs-integ/greeting-task-definition/xray/LogGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeting-task-definition/xray/LogGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.CfnLogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.LogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.ContainerDefinition", - "version": "0.0.0" - } - }, - "cloudwatch-agent": { - "id": "cloudwatch-agent", - "path": "aws-ecs-integ/greeting-task-definition/cloudwatch-agent", - "children": { - "LogGroup": { - "id": "LogGroup", - "path": "aws-ecs-integ/greeting-task-definition/cloudwatch-agent/LogGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeting-task-definition/cloudwatch-agent/LogGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.CfnLogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.LogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.ContainerDefinition", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.TaskDefinition", - "version": "0.0.0" - } - }, - "greeting-envoy-image-account-mapping": { - "id": "greeting-envoy-image-account-mapping", - "path": "aws-ecs-integ/greeting-envoy-image-account-mapping", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnMapping", - "version": "0.0.0" - } - }, - "greeting-envoy-repo": { - "id": "greeting-envoy-repo", - "path": "aws-ecs-integ/greeting-envoy-repo", - "constructInfo": { - "fqn": "@aws-cdk/aws-ecr.RepositoryBase", - "version": "0.0.0" - } - }, - "greeting-envoy-to-appmesh": { - "id": "greeting-envoy-to-appmesh", - "path": "aws-ecs-integ/greeting-envoy-to-appmesh", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeting-envoy-to-appmesh/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": "appmesh:StreamAggregatedResources", - "Effect": "Allow", - "Resource": { - "Ref": "mymeshEA67EDEF" - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "greetingenvoytoappmesh97051B23", - "roles": [ - { - "Ref": "greetingtaskdefinitionTaskRole9179DA4A" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - }, - "greeting-publish-metrics": { - "id": "greeting-publish-metrics", - "path": "aws-ecs-integ/greeting-publish-metrics", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeting-publish-metrics/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": "cloudwatch:PutMetricData", - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "policyName": "greetingpublishmetricsF17124EF", - "roles": [ - { - "Ref": "greetingtaskdefinitionTaskRole9179DA4A" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - }, - "greeting-service": { - "id": "greeting-service", - "path": "aws-ecs-integ/greeting-service", - "children": { - "Service": { - "id": "Service", - "path": "aws-ecs-integ/greeting-service/Service", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ECS::Service", - "aws:cdk:cloudformation:props": { - "cluster": { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "deploymentConfiguration": { - "maximumPercent": 150, - "minimumHealthyPercent": 100 - }, - "desiredCount": 2, - "enableEcsManagedTags": false, - "launchType": "FARGATE", - "networkConfiguration": { - "awsvpcConfiguration": { - "assignPublicIp": "DISABLED", - "subnets": [ - { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - }, - { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - ], - "securityGroups": [ - { - "Fn::GetAtt": [ - "greetingserviceSecurityGroupE9BE665B", - "GroupId" - ] - } - ] - } - }, - "serviceRegistries": [ - { - "registryArn": { - "Fn::GetAtt": [ - "greetingserviceCloudmapService0A2D7385", - "Arn" - ] - } - } - ], - "taskDefinition": { - "Ref": "greetingtaskdefinition31690093" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.CfnService", - "version": "0.0.0" - } - }, - "CloudmapService": { - "id": "CloudmapService", - "path": "aws-ecs-integ/greeting-service/CloudmapService", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeting-service/CloudmapService/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ServiceDiscovery::Service", - "aws:cdk:cloudformation:props": { - "dnsConfig": { - "dnsRecords": [ - { - "type": "A", - "ttl": 10 - } - ], - "namespaceId": { - "Fn::GetAtt": [ - "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D", - "Id" - ] - }, - "routingPolicy": "MULTIVALUE" - }, - "healthCheckCustomConfig": { - "failureThreshold": 2 - }, - "name": "greeting", - "namespaceId": { - "Fn::GetAtt": [ - "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D", - "Id" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-servicediscovery.CfnService", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-servicediscovery.Service", - "version": "0.0.0" - } - }, - "SecurityGroup": { - "id": "SecurityGroup", - "path": "aws-ecs-integ/greeting-service/SecurityGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeting-service/SecurityGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", - "aws:cdk:cloudformation:props": { - "groupDescription": "aws-ecs-integ/greeting-service/SecurityGroup", - "securityGroupEgress": [ - { - "cidrIp": "0.0.0.0/0", - "description": "Allow all outbound traffic by default", - "ipProtocol": "-1" - } - ], - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSecurityGroup", - "version": "0.0.0" - } - }, - "from awsecsinteggreeterserviceSecurityGroup055DC23B:80": { - "id": "from awsecsinteggreeterserviceSecurityGroup055DC23B:80", - "path": "aws-ecs-integ/greeting-service/SecurityGroup/from awsecsinteggreeterserviceSecurityGroup055DC23B:80", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroupIngress", - "aws:cdk:cloudformation:props": { - "ipProtocol": "tcp", - "description": "Accept inbound traffic from greeter", - "fromPort": 80, - "groupId": { - "Fn::GetAtt": [ - "greetingserviceSecurityGroupE9BE665B", - "GroupId" - ] - }, - "sourceSecurityGroupId": { - "Fn::GetAtt": [ - "greeterserviceSecurityGroupDB4AC3A9", - "GroupId" - ] - }, - "toPort": 80 - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSecurityGroupIngress", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.SecurityGroup", - "version": "0.0.0" - } - }, - "ScalingRole": { - "id": "ScalingRole", - "path": "aws-ecs-integ/greeting-service/ScalingRole", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "TaskCount": { - "id": "TaskCount", - "path": "aws-ecs-integ/greeting-service/TaskCount", - "children": { - "Target": { - "id": "Target", - "path": "aws-ecs-integ/greeting-service/TaskCount/Target", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeting-service/TaskCount/Target/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ApplicationAutoScaling::ScalableTarget", - "aws:cdk:cloudformation:props": { - "maxCapacity": 8, - "minCapacity": 2, - "resourceId": { - "Fn::Join": [ - "", - [ - "service/", - { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "/", - { - "Fn::GetAtt": [ - "greetingserviceService8DA58640", - "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/aws-applicationautoscaling.CfnScalableTarget", - "version": "0.0.0" - } - }, - "greeting-target-cpu-utilization-50": { - "id": "greeting-target-cpu-utilization-50", - "path": "aws-ecs-integ/greeting-service/TaskCount/Target/greeting-target-cpu-utilization-50", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeting-service/TaskCount/Target/greeting-target-cpu-utilization-50/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ApplicationAutoScaling::ScalingPolicy", - "aws:cdk:cloudformation:props": { - "policyName": "awsecsinteggreetingserviceTaskCountTargetgreetingtargetcpuutilization504C76B1F4", - "policyType": "TargetTrackingScaling", - "scalingTargetId": { - "Ref": "greetingserviceTaskCountTargetA036048C" - }, - "targetTrackingScalingPolicyConfiguration": { - "predefinedMetricSpecification": { - "predefinedMetricType": "ECSServiceAverageCPUUtilization" - }, - "scaleInCooldown": 60, - "scaleOutCooldown": 60, - "targetValue": 50 - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-applicationautoscaling.CfnScalingPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-applicationautoscaling.TargetTrackingScalingPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-applicationautoscaling.ScalableTarget", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.ScalableTaskCount", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.FargateService", - "version": "0.0.0" - } - }, - "greeting-virtual-node": { - "id": "greeting-virtual-node", - "path": "aws-ecs-integ/greeting-virtual-node", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeting-virtual-node/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::AppMesh::VirtualNode", - "aws:cdk:cloudformation:props": { - "meshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "spec": { - "listeners": [ - { - "portMapping": { - "port": 80, - "protocol": "http" - } - } - ], - "serviceDiscovery": { - "awsCloudMap": { - "namespaceName": "production", - "serviceName": { - "Fn::GetAtt": [ - "greetingserviceCloudmapService0A2D7385", - "Name" - ] - } - } - } - }, - "virtualNodeName": "greeting" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.CfnVirtualNode", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.VirtualNode", - "version": "0.0.0" - } - }, - "greeting-virtual-router": { - "id": "greeting-virtual-router", - "path": "aws-ecs-integ/greeting-virtual-router", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeting-virtual-router/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::AppMesh::VirtualRouter", - "aws:cdk:cloudformation:props": { - "meshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "spec": { - "listeners": [ - { - "portMapping": { - "port": 80, - "protocol": "http" - } - } - ] - }, - "virtualRouterName": "greeting" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.CfnVirtualRouter", - "version": "0.0.0" - } - }, - "greeting-route": { - "id": "greeting-route", - "path": "aws-ecs-integ/greeting-virtual-router/greeting-route", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeting-virtual-router/greeting-route/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::AppMesh::Route", - "aws:cdk:cloudformation:props": { - "meshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "spec": { - "httpRoute": { - "action": { - "weightedTargets": [ - { - "virtualNode": { - "Fn::GetAtt": [ - "greetingvirtualnodeC4A2C517", - "VirtualNodeName" - ] - }, - "weight": 1 - } - ] - }, - "match": { - "prefix": "/" - } - } - }, - "virtualRouterName": { - "Fn::GetAtt": [ - "greetingvirtualrouter0F898D1A", - "VirtualRouterName" - ] - }, - "routeName": "greeting-route" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.CfnRoute", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.Route", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.VirtualRouter", - "version": "0.0.0" - } - }, - "greeting-virtual-service": { - "id": "greeting-virtual-service", - "path": "aws-ecs-integ/greeting-virtual-service", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeting-virtual-service/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::AppMesh::VirtualService", - "aws:cdk:cloudformation:props": { - "meshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "spec": { - "provider": { - "virtualRouter": { - "virtualRouterName": { - "Fn::GetAtt": [ - "greetingvirtualrouter0F898D1A", - "VirtualRouterName" - ] - } - } - } - }, - "virtualServiceName": "greeting.production" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.CfnVirtualService", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.VirtualService", - "version": "0.0.0" - } - }, - "greeter": { - "id": "greeter", - "path": "aws-ecs-integ/greeter", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.78" - } - }, - "greeter-logs": { - "id": "greeter-logs", - "path": "aws-ecs-integ/greeter-logs", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeter-logs/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", - "aws:cdk:cloudformation:props": { - "logGroupName": "greeter-logs", - "retentionInDays": 7 - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.CfnLogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.LogGroup", - "version": "0.0.0" - } - }, - "greeter-load-balancer": { - "id": "greeter-load-balancer", - "path": "aws-ecs-integ/greeter-load-balancer", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeter-load-balancer/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ElasticLoadBalancingV2::LoadBalancer", - "aws:cdk:cloudformation:props": { - "loadBalancerAttributes": [ - { - "key": "deletion_protection.enabled", - "value": "false" - } - ], - "scheme": "internet-facing", - "securityGroups": [ - { - "Fn::GetAtt": [ - "greeterloadbalancerSecurityGroupEE1B20F3", - "GroupId" - ] - } - ], - "subnets": [ - { - "Ref": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - }, - { - "Ref": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - } - ], - "type": "application" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-elasticloadbalancingv2.CfnLoadBalancer", - "version": "0.0.0" - } - }, - "SecurityGroup": { - "id": "SecurityGroup", - "path": "aws-ecs-integ/greeter-load-balancer/SecurityGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeter-load-balancer/SecurityGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", - "aws:cdk:cloudformation:props": { - "groupDescription": "Automatically created Security Group for ELB awsecsinteggreeterloadbalancer147D1D5C", - "securityGroupIngress": [ - { - "cidrIp": "0.0.0.0/0", - "ipProtocol": "tcp", - "fromPort": 80, - "toPort": 80, - "description": "Allow from anyone on port 80" - } - ], - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSecurityGroup", - "version": "0.0.0" - } - }, - "to awsecsinteggreeterserviceSecurityGroup055DC23B:80": { - "id": "to awsecsinteggreeterserviceSecurityGroup055DC23B:80", - "path": "aws-ecs-integ/greeter-load-balancer/SecurityGroup/to awsecsinteggreeterserviceSecurityGroup055DC23B:80", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroupEgress", - "aws:cdk:cloudformation:props": { - "groupId": { - "Fn::GetAtt": [ - "greeterloadbalancerSecurityGroupEE1B20F3", - "GroupId" - ] - }, - "ipProtocol": "tcp", - "description": "Load balancer to target", - "destinationSecurityGroupId": { - "Fn::GetAtt": [ - "greeterserviceSecurityGroupDB4AC3A9", - "GroupId" - ] - }, - "fromPort": 80, - "toPort": 80 - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSecurityGroupEgress", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.SecurityGroup", - "version": "0.0.0" - } - }, - "greeter-listener": { - "id": "greeter-listener", - "path": "aws-ecs-integ/greeter-load-balancer/greeter-listener", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeter-load-balancer/greeter-listener/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ElasticLoadBalancingV2::Listener", - "aws:cdk:cloudformation:props": { - "defaultActions": [ - { - "type": "forward", - "targetGroupArn": { - "Ref": "greeterloadbalancergreeterlistenergreeterGroupFFBFF0C2" - } - } - ], - "loadBalancerArn": { - "Ref": "greeterloadbalancer85256741" - }, - "port": 80, - "protocol": "HTTP" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-elasticloadbalancingv2.CfnListener", - "version": "0.0.0" - } - }, - "greeterGroup": { - "id": "greeterGroup", - "path": "aws-ecs-integ/greeter-load-balancer/greeter-listener/greeterGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeter-load-balancer/greeter-listener/greeterGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ElasticLoadBalancingV2::TargetGroup", - "aws:cdk:cloudformation:props": { - "port": 80, - "protocol": "HTTP", - "targetGroupAttributes": [ - { - "key": "deregistration_delay.timeout_seconds", - "value": "10" - }, - { - "key": "stickiness.enabled", - "value": "false" - } - ], - "targetType": "ip", - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-elasticloadbalancingv2.CfnTargetGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-elasticloadbalancingv2.ApplicationTargetGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-elasticloadbalancingv2.ApplicationListener", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-elasticloadbalancingv2.ApplicationLoadBalancer", - "version": "0.0.0" - } - }, - "greeter-load-balancer-dns-output": { - "id": "greeter-load-balancer-dns-output", - "path": "aws-ecs-integ/greeter-load-balancer-dns-output", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnOutput", - "version": "0.0.0" - } - }, - "greeter-task-definition": { - "id": "greeter-task-definition", - "path": "aws-ecs-integ/greeter-task-definition", - "children": { - "TaskRole": { - "id": "TaskRole", - "path": "aws-ecs-integ/greeter-task-definition/TaskRole", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeter-task-definition/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" - }, - "managedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/AWSXRayDaemonWriteAccess" - ] - ] - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "aws-ecs-integ/greeter-task-definition/TaskRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeter-task-definition/TaskRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:DescribeLogStreams", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "policyName": "greetertaskdefinitionTaskRoleDefaultPolicyD0F53B1C", - "roles": [ - { - "Ref": "greetertaskdefinitionTaskRole2A098ACC" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeter-task-definition/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ECS::TaskDefinition", - "aws:cdk:cloudformation:props": { - "containerDefinitions": [ - { - "cpu": 1024, - "dependsOn": [ - { - "containerName": "firelens", - "condition": "START" - }, - { - "containerName": "envoy", - "condition": "HEALTHY" - }, - { - "containerName": "cloudwatch-agent", - "condition": "START" - }, - { - "containerName": "xray", - "condition": "HEALTHY" - } - ], - "essential": true, - "image": "nathanpeck/greeter", - "memory": 2048, - "name": "app", - "portMappings": [ - { - "containerPort": 80, - "protocol": "tcp" - } - ], - "ulimits": [ - { - "name": "nofile", - "softLimit": 1024000, - "hardLimit": 1024000 - } - ], - "logConfiguration": { - "logDriver": "awsfirelens", - "options": { - "Name": "cloudwatch", - "region": { - "Ref": "AWS::Region" - }, - "log_group_name": { - "Ref": "greeterlogsCCD2F8B2" - }, - "log_stream_prefix": "greeter/" - } - }, - "environment": [ - { - "name": "PORT", - "value": "80" - }, - { - "name": "GREETING_URL", - "value": "http://greeting.production" - }, - { - "name": "NAME_URL", - "value": "http://name.production" - } - ] - }, - { - "essential": true, - "image": { - "Fn::Join": [ - "", - [ - { - "Fn::FindInMap": [ - "greeterenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ".dkr.ecr.", - { - "Ref": "AWS::Region" - }, - ".", - { - "Ref": "AWS::URLSuffix" - }, - "/aws-appmesh-envoy:v1.15.1.0-prod" - ] - ] - }, - "memoryReservation": 128, - "name": "envoy", - "ulimits": [ - { - "name": "nofile", - "softLimit": 1024000, - "hardLimit": 1024000 - } - ], - "user": "1337", - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-group": { - "Ref": "greetertaskdefinitionenvoyLogGroup6E10B93E" - }, - "awslogs-stream-prefix": "envoy", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "environment": [ - { - "name": "APPMESH_VIRTUAL_NODE_NAME", - "value": { - "Fn::Join": [ - "", - [ - "mesh/", - { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "/virtualNode/greeter" - ] - ] - } - }, - { - "name": "AWS_REGION", - "value": { - "Ref": "AWS::Region" - } - }, - { - "name": "ENABLE_ENVOY_STATS_TAGS", - "value": "1" - }, - { - "name": "ENABLE_ENVOY_DOG_STATSD", - "value": "1" - } - ], - "healthCheck": { - "command": [ - "CMD-SHELL", - "curl -s http://localhost:9901/server_info | grep state | grep -q LIVE" - ], - "interval": 5, - "retries": 3, - "startPeriod": 10, - "timeout": 2 - } - }, - { - "dependsOn": [ - { - "containerName": "envoy", - "condition": "HEALTHY" - } - ], - "essential": true, - "image": { - "Ref": "SsmParameterValueawsserviceawsforfluentbitlatestC96584B6F00A464EAD1953AFF4B05118Parameter" - }, - "memoryReservation": 50, - "name": "firelens", - "user": "0:1338", - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-group": { - "Ref": "greetertaskdefinitionfirelensLogGroupD5BAAC35" - }, - "awslogs-stream-prefix": "firelens", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "firelensConfiguration": { - "type": "fluentbit" - } - }, - { - "dependsOn": [ - { - "containerName": "envoy", - "condition": "HEALTHY" - } - ], - "essential": true, - "image": "amazon/aws-xray-daemon:latest", - "memoryReservation": 256, - "name": "xray", - "user": "1337", - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-group": { - "Ref": "greetertaskdefinitionxrayLogGroupBC1558B6" - }, - "awslogs-stream-prefix": "xray", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "environment": [ - { - "name": "AWS_REGION", - "value": { - "Ref": "AWS::Region" - } - } - ], - "healthCheck": { - "command": [ - "CMD-SHELL", - "curl -s http://localhost:2000" - ], - "interval": 5, - "retries": 3, - "startPeriod": 10, - "timeout": 2 - } - }, - { - "dependsOn": [ - { - "containerName": "envoy", - "condition": "HEALTHY" - } - ], - "essential": true, - "image": "amazon/cloudwatch-agent:latest", - "memoryReservation": 50, - "name": "cloudwatch-agent", - "user": "0:1338", - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-group": { - "Ref": "greetertaskdefinitioncloudwatchagentLogGroupE7EAF327" - }, - "awslogs-stream-prefix": "cloudwatch-agent", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "environment": [ - { - "name": "CW_CONFIG_CONTENT", - "value": "{\"logs\":{\"metrics_collected\":{\"emf\":{}}},\"metrics\":{\"metrics_collected\":{\"statsd\":{}}}}" - } - ] - } - ], - "cpu": "1024", - "executionRoleArn": { - "Fn::GetAtt": [ - "greetertaskdefinitionExecutionRoleAED0EC79", - "Arn" - ] - }, - "family": "awsecsinteggreetertaskdefinitionB95239FB", - "memory": "2048", - "networkMode": "awsvpc", - "proxyConfiguration": { - "containerName": "envoy", - "proxyConfigurationProperties": [ - { - "name": "AppPorts", - "value": "80" - }, - { - "name": "ProxyEgressPort", - "value": "15001" - }, - { - "name": "ProxyIngressPort", - "value": "15000" - }, - { - "name": "IgnoredUID", - "value": "1337" - }, - { - "name": "IgnoredGID", - "value": "1338" - }, - { - "name": "EgressIgnoredIPs", - "value": "169.254.170.2,169.254.169.254" - } - ], - "type": "APPMESH" - }, - "requiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "taskRoleArn": { - "Fn::GetAtt": [ - "greetertaskdefinitionTaskRole2A098ACC", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.CfnTaskDefinition", - "version": "0.0.0" - } - }, - "app": { - "id": "app", - "path": "aws-ecs-integ/greeter-task-definition/app", - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.ContainerDefinition", - "version": "0.0.0" - } - }, - "envoy": { - "id": "envoy", - "path": "aws-ecs-integ/greeter-task-definition/envoy", - "children": { - "LogGroup": { - "id": "LogGroup", - "path": "aws-ecs-integ/greeter-task-definition/envoy/LogGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeter-task-definition/envoy/LogGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.CfnLogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.LogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.ContainerDefinition", - "version": "0.0.0" - } - }, - "ExecutionRole": { - "id": "ExecutionRole", - "path": "aws-ecs-integ/greeter-task-definition/ExecutionRole", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeter-task-definition/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/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "aws-ecs-integ/greeter-task-definition/ExecutionRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeter-task-definition/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" - }, - ":", - { - "Fn::FindInMap": [ - "greeterenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ":repository/aws-appmesh-envoy" - ] - ] - } - }, - { - "Action": [ - "ecr:BatchCheckLayerAvailability", - "ecr:BatchGetImage", - "ecr:GetAuthorizationToken", - "ecr:GetDownloadUrlForLayer" - ], - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "greetertaskdefinitioncloudwatchagentLogGroupE7EAF327", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "greetertaskdefinitionenvoyLogGroup6E10B93E", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "greetertaskdefinitionfirelensLogGroupD5BAAC35", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "greetertaskdefinitionxrayLogGroupBC1558B6", - "Arn" - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "policyName": "greetertaskdefinitionExecutionRoleDefaultPolicy0D8E9106", - "roles": [ - { - "Ref": "greetertaskdefinitionExecutionRoleAED0EC79" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "firelens": { - "id": "firelens", - "path": "aws-ecs-integ/greeter-task-definition/firelens", - "children": { - "LogGroup": { - "id": "LogGroup", - "path": "aws-ecs-integ/greeter-task-definition/firelens/LogGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeter-task-definition/firelens/LogGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.CfnLogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.LogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.FirelensLogRouter", - "version": "0.0.0" - } - }, - "xray": { - "id": "xray", - "path": "aws-ecs-integ/greeter-task-definition/xray", - "children": { - "LogGroup": { - "id": "LogGroup", - "path": "aws-ecs-integ/greeter-task-definition/xray/LogGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeter-task-definition/xray/LogGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.CfnLogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.LogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.ContainerDefinition", - "version": "0.0.0" - } - }, - "cloudwatch-agent": { - "id": "cloudwatch-agent", - "path": "aws-ecs-integ/greeter-task-definition/cloudwatch-agent", - "children": { - "LogGroup": { - "id": "LogGroup", - "path": "aws-ecs-integ/greeter-task-definition/cloudwatch-agent/LogGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeter-task-definition/cloudwatch-agent/LogGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.CfnLogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.LogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.ContainerDefinition", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.TaskDefinition", - "version": "0.0.0" - } - }, - "greeter-envoy-image-account-mapping": { - "id": "greeter-envoy-image-account-mapping", - "path": "aws-ecs-integ/greeter-envoy-image-account-mapping", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnMapping", - "version": "0.0.0" - } - }, - "greeter-envoy-repo": { - "id": "greeter-envoy-repo", - "path": "aws-ecs-integ/greeter-envoy-repo", - "constructInfo": { - "fqn": "@aws-cdk/aws-ecr.RepositoryBase", - "version": "0.0.0" - } - }, - "greeter-envoy-to-appmesh": { - "id": "greeter-envoy-to-appmesh", - "path": "aws-ecs-integ/greeter-envoy-to-appmesh", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeter-envoy-to-appmesh/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": "appmesh:StreamAggregatedResources", - "Effect": "Allow", - "Resource": { - "Ref": "mymeshEA67EDEF" - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "greeterenvoytoappmesh1A94938B", - "roles": [ - { - "Ref": "greetertaskdefinitionTaskRole2A098ACC" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - }, - "greeter-publish-metrics": { - "id": "greeter-publish-metrics", - "path": "aws-ecs-integ/greeter-publish-metrics", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeter-publish-metrics/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": "cloudwatch:PutMetricData", - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "policyName": "greeterpublishmetrics0CCA359A", - "roles": [ - { - "Ref": "greetertaskdefinitionTaskRole2A098ACC" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - }, - "greeter-service": { - "id": "greeter-service", - "path": "aws-ecs-integ/greeter-service", - "children": { - "Service": { - "id": "Service", - "path": "aws-ecs-integ/greeter-service/Service", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ECS::Service", - "aws:cdk:cloudformation:props": { - "cluster": { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "deploymentConfiguration": { - "maximumPercent": 150, - "minimumHealthyPercent": 100 - }, - "desiredCount": 2, - "enableEcsManagedTags": false, - "healthCheckGracePeriodSeconds": 60, - "launchType": "FARGATE", - "loadBalancers": [ - { - "targetGroupArn": { - "Ref": "greeterloadbalancergreeterlistenergreeterGroupFFBFF0C2" - }, - "containerName": "app", - "containerPort": 80 - } - ], - "networkConfiguration": { - "awsvpcConfiguration": { - "assignPublicIp": "DISABLED", - "subnets": [ - { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - }, - { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - ], - "securityGroups": [ - { - "Fn::GetAtt": [ - "greeterserviceSecurityGroupDB4AC3A9", - "GroupId" - ] - } - ] - } - }, - "serviceRegistries": [ - { - "registryArn": { - "Fn::GetAtt": [ - "greeterserviceCloudmapServiceEE292978", - "Arn" - ] - } - } - ], - "taskDefinition": { - "Ref": "greetertaskdefinitionE956EEA2" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.CfnService", - "version": "0.0.0" - } - }, - "CloudmapService": { - "id": "CloudmapService", - "path": "aws-ecs-integ/greeter-service/CloudmapService", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeter-service/CloudmapService/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ServiceDiscovery::Service", - "aws:cdk:cloudformation:props": { - "dnsConfig": { - "dnsRecords": [ - { - "type": "A", - "ttl": 10 - } - ], - "namespaceId": { - "Fn::GetAtt": [ - "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D", - "Id" - ] - }, - "routingPolicy": "MULTIVALUE" - }, - "healthCheckCustomConfig": { - "failureThreshold": 2 - }, - "name": "greeter", - "namespaceId": { - "Fn::GetAtt": [ - "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D", - "Id" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-servicediscovery.CfnService", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-servicediscovery.Service", - "version": "0.0.0" - } - }, - "SecurityGroup": { - "id": "SecurityGroup", - "path": "aws-ecs-integ/greeter-service/SecurityGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeter-service/SecurityGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", - "aws:cdk:cloudformation:props": { - "groupDescription": "aws-ecs-integ/greeter-service/SecurityGroup", - "securityGroupEgress": [ - { - "cidrIp": "0.0.0.0/0", - "description": "Allow all outbound traffic by default", - "ipProtocol": "-1" - } - ], - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSecurityGroup", - "version": "0.0.0" - } - }, - "from awsecsinteggreeterloadbalancerSecurityGroupF791FA83:80": { - "id": "from awsecsinteggreeterloadbalancerSecurityGroupF791FA83:80", - "path": "aws-ecs-integ/greeter-service/SecurityGroup/from awsecsinteggreeterloadbalancerSecurityGroupF791FA83:80", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroupIngress", - "aws:cdk:cloudformation:props": { - "ipProtocol": "tcp", - "description": "Load balancer to target", - "fromPort": 80, - "groupId": { - "Fn::GetAtt": [ - "greeterserviceSecurityGroupDB4AC3A9", - "GroupId" - ] - }, - "sourceSecurityGroupId": { - "Fn::GetAtt": [ - "greeterloadbalancerSecurityGroupEE1B20F3", - "GroupId" - ] - }, - "toPort": 80 - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSecurityGroupIngress", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.SecurityGroup", - "version": "0.0.0" - } - }, - "ScalingRole": { - "id": "ScalingRole", - "path": "aws-ecs-integ/greeter-service/ScalingRole", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "TaskCount": { - "id": "TaskCount", - "path": "aws-ecs-integ/greeter-service/TaskCount", - "children": { - "Target": { - "id": "Target", - "path": "aws-ecs-integ/greeter-service/TaskCount/Target", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeter-service/TaskCount/Target/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ApplicationAutoScaling::ScalableTarget", - "aws:cdk:cloudformation:props": { - "maxCapacity": 8, - "minCapacity": 2, - "resourceId": { - "Fn::Join": [ - "", - [ - "service/", - { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "/", - { - "Fn::GetAtt": [ - "greeterserviceService8EDD3244", - "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/aws-applicationautoscaling.CfnScalableTarget", - "version": "0.0.0" - } - }, - "greeter-target-cpu-utilization-50": { - "id": "greeter-target-cpu-utilization-50", - "path": "aws-ecs-integ/greeter-service/TaskCount/Target/greeter-target-cpu-utilization-50", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeter-service/TaskCount/Target/greeter-target-cpu-utilization-50/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ApplicationAutoScaling::ScalingPolicy", - "aws:cdk:cloudformation:props": { - "policyName": "awsecsinteggreeterserviceTaskCountTargetgreetertargetcpuutilization50A75D0C0D", - "policyType": "TargetTrackingScaling", - "scalingTargetId": { - "Ref": "greeterserviceTaskCountTargetAB95B3D0" - }, - "targetTrackingScalingPolicyConfiguration": { - "predefinedMetricSpecification": { - "predefinedMetricType": "ECSServiceAverageCPUUtilization" - }, - "scaleInCooldown": 60, - "scaleOutCooldown": 60, - "targetValue": 50 - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-applicationautoscaling.CfnScalingPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-applicationautoscaling.TargetTrackingScalingPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-applicationautoscaling.ScalableTarget", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.ScalableTaskCount", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.FargateService", - "version": "0.0.0" - } - }, - "greeter-virtual-node": { - "id": "greeter-virtual-node", - "path": "aws-ecs-integ/greeter-virtual-node", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeter-virtual-node/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::AppMesh::VirtualNode", - "aws:cdk:cloudformation:props": { - "meshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "spec": { - "backends": [ - { - "virtualService": { - "virtualServiceName": "name.production" - } - }, - { - "virtualService": { - "virtualServiceName": "greeting.production" - } - } - ], - "listeners": [ - { - "portMapping": { - "port": 80, - "protocol": "http" - } - } - ], - "serviceDiscovery": { - "awsCloudMap": { - "namespaceName": "production", - "serviceName": { - "Fn::GetAtt": [ - "greeterserviceCloudmapServiceEE292978", - "Name" - ] - } - } - } - }, - "virtualNodeName": "greeter" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.CfnVirtualNode", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.VirtualNode", - "version": "0.0.0" - } - }, - "greeter-virtual-router": { - "id": "greeter-virtual-router", - "path": "aws-ecs-integ/greeter-virtual-router", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeter-virtual-router/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::AppMesh::VirtualRouter", - "aws:cdk:cloudformation:props": { - "meshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "spec": { - "listeners": [ - { - "portMapping": { - "port": 80, - "protocol": "http" - } - } - ] - }, - "virtualRouterName": "greeter" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.CfnVirtualRouter", - "version": "0.0.0" - } - }, - "greeter-route": { - "id": "greeter-route", - "path": "aws-ecs-integ/greeter-virtual-router/greeter-route", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeter-virtual-router/greeter-route/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::AppMesh::Route", - "aws:cdk:cloudformation:props": { - "meshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "spec": { - "httpRoute": { - "action": { - "weightedTargets": [ - { - "virtualNode": { - "Fn::GetAtt": [ - "greetervirtualnode21EA7CC9", - "VirtualNodeName" - ] - }, - "weight": 1 - } - ] - }, - "match": { - "prefix": "/" - } - } - }, - "virtualRouterName": { - "Fn::GetAtt": [ - "greetervirtualrouter193840BB", - "VirtualRouterName" - ] - }, - "routeName": "greeter-route" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.CfnRoute", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.Route", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.VirtualRouter", - "version": "0.0.0" - } - }, - "greeter-virtual-service": { - "id": "greeter-virtual-service", - "path": "aws-ecs-integ/greeter-virtual-service", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/greeter-virtual-service/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::AppMesh::VirtualService", - "aws:cdk:cloudformation:props": { - "meshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "spec": { - "provider": { - "virtualRouter": { - "virtualRouterName": { - "Fn::GetAtt": [ - "greetervirtualrouter193840BB", - "VirtualRouterName" - ] - } - } - } - }, - "virtualServiceName": "greeter.production" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.CfnVirtualService", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.VirtualService", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Stack", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.App", - "version": "0.0.0" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/appmesh.test.ts b/packages/@aws-cdk-containers/ecs-service-extensions/test/appmesh.test.ts deleted file mode 100644 index 02a572e9e2ced..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/appmesh.test.ts +++ /dev/null @@ -1,562 +0,0 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as appmesh from '@aws-cdk/aws-appmesh'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as cdk from '@aws-cdk/core'; -import { AppMeshExtension, Container, Environment, ServiceDescription, Service } from '../lib'; - -describe('appmesh', () => { - test('should be able to add AWS App Mesh to a service', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const environment = new Environment(stack, 'production'); - - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - const mesh = new appmesh.Mesh(stack, 'my-mesh'); - - serviceDescription.add(new AppMeshExtension({ - mesh, - })); - - new Service(stack, 'my-service', { - environment, - serviceDescription, - }); - - // THEN - // Ensure that task has an App Mesh sidecar - Template.fromStack(stack).hasResourceProperties('AWS::ECS::TaskDefinition', { - ContainerDefinitions: [ - { - Cpu: 256, - DependsOn: [ - { - Condition: 'HEALTHY', - ContainerName: 'envoy', - }, - ], - Essential: true, - Image: 'nathanpeck/name', - Memory: 512, - Name: 'app', - PortMappings: [ - { - ContainerPort: 80, - Protocol: 'tcp', - }, - ], - Ulimits: [ - { - HardLimit: 1024000, - Name: 'nofile', - SoftLimit: 1024000, - }, - ], - }, - { - Environment: [ - { - Name: 'APPMESH_VIRTUAL_NODE_NAME', - Value: { - 'Fn::Join': [ - '', - [ - 'mesh/', - { - 'Fn::GetAtt': [ - 'mymeshEA67EDEF', - 'MeshName', - ], - }, - '/virtualNode/my-service', - ], - ], - }, - }, - { - Name: 'AWS_REGION', - Value: { - Ref: 'AWS::Region', - }, - }, - { - Name: 'ENABLE_ENVOY_STATS_TAGS', - Value: '1', - }, - { - Name: 'ENABLE_ENVOY_DOG_STATSD', - Value: '1', - }, - ], - Essential: true, - HealthCheck: { - Command: [ - 'CMD-SHELL', - 'curl -s http://localhost:9901/server_info | grep state | grep -q LIVE', - ], - Interval: 5, - Retries: 3, - StartPeriod: 10, - Timeout: 2, - }, - Image: { - 'Fn::Join': [ - '', - [ - { - 'Fn::FindInMap': [ - 'myserviceenvoyimageaccountmapping', - { - Ref: 'AWS::Region', - }, - 'ecrRepo', - ], - }, - '.dkr.ecr.', - { - Ref: 'AWS::Region', - }, - '.', - { - Ref: 'AWS::URLSuffix', - }, - '/aws-appmesh-envoy:v1.15.1.0-prod', - ], - ], - }, - LogConfiguration: { - LogDriver: 'awslogs', - Options: { - 'awslogs-group': { - Ref: 'myservicetaskdefinitionenvoyLogGroup0C27EBDB', - }, - 'awslogs-stream-prefix': 'envoy', - 'awslogs-region': { - Ref: 'AWS::Region', - }, - }, - }, - MemoryReservation: 128, - Name: 'envoy', - Ulimits: [ - { - HardLimit: 1024000, - Name: 'nofile', - SoftLimit: 1024000, - }, - ], - User: '1337', - }, - ], - Cpu: '256', - ExecutionRoleArn: { - 'Fn::GetAtt': [ - 'myservicetaskdefinitionExecutionRole0CE74AD0', - 'Arn', - ], - }, - Family: 'myservicetaskdefinition', - Memory: '512', - NetworkMode: 'awsvpc', - ProxyConfiguration: { - ContainerName: 'envoy', - ProxyConfigurationProperties: [ - { - Name: 'AppPorts', - Value: '80', - }, - { - Name: 'ProxyEgressPort', - Value: '15001', - }, - { - Name: 'ProxyIngressPort', - Value: '15000', - }, - { - Name: 'IgnoredUID', - Value: '1337', - }, - { - Name: 'IgnoredGID', - Value: '1338', - }, - { - Name: 'EgressIgnoredIPs', - Value: '169.254.170.2,169.254.169.254', - }, - ], - Type: 'APPMESH', - }, - RequiresCompatibilities: [ - 'EC2', - 'FARGATE', - ], - TaskRoleArn: { - 'Fn::GetAtt': [ - 'myservicetaskdefinitionTaskRole92ACD903', - 'Arn', - ], - }, - }); - - // Ensure that the service has the right settings - Template.fromStack(stack).hasResourceProperties('AWS::ECS::Service', { - Cluster: { - Ref: 'productionenvironmentclusterC6599D2D', - }, - DeploymentConfiguration: { - MaximumPercent: 200, - MinimumHealthyPercent: 100, - }, - DesiredCount: 1, - EnableECSManagedTags: false, - LaunchType: 'FARGATE', - NetworkConfiguration: { - AwsvpcConfiguration: { - AssignPublicIp: 'DISABLED', - SecurityGroups: [ - { - 'Fn::GetAtt': [ - 'myserviceserviceSecurityGroup3A44A969', - 'GroupId', - ], - }, - ], - Subnets: [ - { - Ref: 'productionenvironmentvpcPrivateSubnet1Subnet53F632E6', - }, - { - Ref: 'productionenvironmentvpcPrivateSubnet2Subnet756FB93C', - }, - ], - }, - }, - ServiceRegistries: [ - { - RegistryArn: { - 'Fn::GetAtt': [ - 'myserviceserviceCloudmapService32F63163', - 'Arn', - ], - }, - }, - ], - TaskDefinition: { - Ref: 'myservicetaskdefinitionF3E2D86F', - }, - }); - }); - - test('should have the right maximumPercentage at desired count == 1', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const environment = new Environment(stack, 'production'); - - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - const mesh = new appmesh.Mesh(stack, 'my-mesh'); - - serviceDescription.add(new AppMeshExtension({ - mesh, - })); - - new Service(stack, 'my-service', { - environment, - serviceDescription, - desiredCount: 1, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ECS::Service', { - DeploymentConfiguration: { - MaximumPercent: 200, - MinimumHealthyPercent: 100, - }, - DesiredCount: 1, - }); - }); - - test('should have the right maximumPercentage at desired count == 2', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const environment = new Environment(stack, 'production'); - - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - const mesh = new appmesh.Mesh(stack, 'my-mesh'); - - serviceDescription.add(new AppMeshExtension({ - mesh, - })); - - new Service(stack, 'my-service', { - environment, - serviceDescription, - desiredCount: 2, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ECS::Service', { - DeploymentConfiguration: { - MaximumPercent: 150, - MinimumHealthyPercent: 100, - }, - DesiredCount: 2, - }); - }); - - test('should have the right maximumPercentage at desired count == 3', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const environment = new Environment(stack, 'production'); - - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - const mesh = new appmesh.Mesh(stack, 'my-mesh'); - - serviceDescription.add(new AppMeshExtension({ - mesh, - })); - - new Service(stack, 'my-service', { - environment, - serviceDescription, - desiredCount: 3, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ECS::Service', { - DeploymentConfiguration: { - MaximumPercent: 150, - MinimumHealthyPercent: 100, - }, - DesiredCount: 3, - }); - }); - - test('should have the right maximumPercentage at desired count == 4', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const environment = new Environment(stack, 'production'); - - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - const mesh = new appmesh.Mesh(stack, 'my-mesh'); - - serviceDescription.add(new AppMeshExtension({ - mesh, - })); - - new Service(stack, 'my-service', { - environment, - serviceDescription, - desiredCount: 4, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ECS::Service', { - DeploymentConfiguration: { - MaximumPercent: 125, - MinimumHealthyPercent: 100, - }, - DesiredCount: 4, - }); - }); - - test('should have the right maximumPercentage at desired count > 4', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const environment = new Environment(stack, 'production'); - - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - const mesh = new appmesh.Mesh(stack, 'my-mesh'); - - serviceDescription.add(new AppMeshExtension({ - mesh, - })); - - new Service(stack, 'my-service', { - environment, - serviceDescription, - desiredCount: 8, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ECS::Service', { - DeploymentConfiguration: { - MaximumPercent: 125, - MinimumHealthyPercent: 100, - }, - DesiredCount: 8, - }); - }); - - test('should be able to create multiple App Mesh enabled services and connect', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const mesh = new appmesh.Mesh(stack, 'my-mesh'); - const environment = new Environment(stack, 'production'); - - const nameDescription = new ServiceDescription(); - nameDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - environment: { - PORT: '80', - }, - })); - nameDescription.add(new AppMeshExtension({ mesh })); - - const greetingDescription = new ServiceDescription(); - greetingDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/greeting'), - environment: { - PORT: '80', - }, - })); - greetingDescription.add(new AppMeshExtension({ mesh })); - - const greeterDescription = new ServiceDescription(); - greeterDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/greeter'), - environment: { - PORT: '80', - }, - })); - greeterDescription.add(new AppMeshExtension({ mesh })); - - const greeterService = new Service(stack, 'greeter', { - environment, - serviceDescription: greeterDescription, - }); - const greetingService = new Service(stack, 'greeting', { - environment, - serviceDescription: greetingDescription, - }); - const nameService = new Service(stack, 'name', { - environment, - serviceDescription: nameDescription, - }); - - greeterService.connectTo(nameService); - greeterService.connectTo(greetingService); - - // THEN - Template.fromStack(stack).hasResource('AWS::ECS::TaskDefinition', Match.anyValue()); - }); - - test('should detect when attempting to connect services from two different envs', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const production = new Environment(stack, 'production'); - const development = new Environment(stack, 'development'); - - const productionMesh = new appmesh.Mesh(stack, 'production-mesh'); - const developmentMesh = new appmesh.Mesh(stack, 'development-mesh'); - - /** Production name service */ - const productionNameDescription = new ServiceDescription(); - productionNameDescription.add(new Container({ - cpu: 1024, - memoryMiB: 2048, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - environment: { - PORT: '80', - }, - })); - productionNameDescription.add(new AppMeshExtension({ mesh: productionMesh })); - - const productionNameService = new Service(stack, 'name-production', { - environment: production, - serviceDescription: productionNameDescription, - }); - - /** Development name service */ - const developmentNameDescription = new ServiceDescription(); - developmentNameDescription.add(new Container({ - cpu: 1024, - memoryMiB: 2048, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - environment: { - PORT: '80', - }, - })); - developmentNameDescription.add(new AppMeshExtension({ mesh: developmentMesh })); - - const developmentNameService = new Service(stack, 'name-development', { - environment: development, - serviceDescription: developmentNameDescription, - }); - - // THEN - expect(() => { - developmentNameService.connectTo(productionNameService); - }).toThrow(/Unable to connect service 'name-development' in environment 'development' to service 'name-production' in environment 'production' because services can not be connected across environment boundaries/); - }); -}); \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9/cfn-response.js b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9/cfn-response.js deleted file mode 100644 index 63bdaab149314..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9/cfn-response.js +++ /dev/null @@ -1,83 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Retry = exports.safeHandler = exports.includeStackTraces = exports.submitResponse = exports.MISSING_PHYSICAL_ID_MARKER = exports.CREATE_FAILED_PHYSICAL_ID_MARKER = void 0; -/* eslint-disable max-len */ -/* eslint-disable no-console */ -const url = require("url"); -const outbound_1 = require("./outbound"); -const util_1 = require("./util"); -exports.CREATE_FAILED_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::CREATE_FAILED'; -exports.MISSING_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::MISSING_PHYSICAL_ID'; -async function submitResponse(status, event, options = {}) { - const json = { - Status: status, - Reason: options.reason || status, - StackId: event.StackId, - RequestId: event.RequestId, - PhysicalResourceId: event.PhysicalResourceId || exports.MISSING_PHYSICAL_ID_MARKER, - LogicalResourceId: event.LogicalResourceId, - NoEcho: options.noEcho, - Data: event.Data, - }; - util_1.log('submit response to cloudformation', json); - const responseBody = JSON.stringify(json); - const parsedUrl = url.parse(event.ResponseURL); - await outbound_1.httpRequest({ - hostname: parsedUrl.hostname, - path: parsedUrl.path, - method: 'PUT', - headers: { - 'content-type': '', - 'content-length': responseBody.length, - }, - }, responseBody); -} -exports.submitResponse = submitResponse; -exports.includeStackTraces = true; // for unit tests -function safeHandler(block) { - return async (event) => { - // ignore DELETE event when the physical resource ID is the marker that - // indicates that this DELETE is a subsequent DELETE to a failed CREATE - // operation. - if (event.RequestType === 'Delete' && event.PhysicalResourceId === exports.CREATE_FAILED_PHYSICAL_ID_MARKER) { - util_1.log('ignoring DELETE event caused by a failed CREATE event'); - await submitResponse('SUCCESS', event); - return; - } - try { - await block(event); - } - catch (e) { - // tell waiter state machine to retry - if (e instanceof Retry) { - util_1.log('retry requested by handler'); - throw e; - } - if (!event.PhysicalResourceId) { - // special case: if CREATE fails, which usually implies, we usually don't - // have a physical resource id. in this case, the subsequent DELETE - // operation does not have any meaning, and will likely fail as well. to - // address this, we use a marker so the provider framework can simply - // ignore the subsequent DELETE. - if (event.RequestType === 'Create') { - util_1.log('CREATE failed, responding with a marker physical resource id so that the subsequent DELETE will be ignored'); - event.PhysicalResourceId = exports.CREATE_FAILED_PHYSICAL_ID_MARKER; - } - else { - // otherwise, if PhysicalResourceId is not specified, something is - // terribly wrong because all other events should have an ID. - util_1.log(`ERROR: Malformed event. "PhysicalResourceId" is required: ${JSON.stringify(event)}`); - } - } - // this is an actual error, fail the activity altogether and exist. - await submitResponse('FAILED', event, { - reason: exports.includeStackTraces ? e.stack : e.message, - }); - } - }; -} -exports.safeHandler = safeHandler; -class Retry extends Error { -} -exports.Retry = Retry; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2ZuLXJlc3BvbnNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY2ZuLXJlc3BvbnNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLDRCQUE0QjtBQUM1QiwrQkFBK0I7QUFDL0IsMkJBQTJCO0FBQzNCLHlDQUF5QztBQUN6QyxpQ0FBNkI7QUFFaEIsUUFBQSxnQ0FBZ0MsR0FBRyx3REFBd0QsQ0FBQztBQUM1RixRQUFBLDBCQUEwQixHQUFHLDhEQUE4RCxDQUFDO0FBZ0JsRyxLQUFLLFVBQVUsY0FBYyxDQUFDLE1BQTRCLEVBQUUsS0FBaUMsRUFBRSxVQUF5QyxFQUFHO0lBQ2hKLE1BQU0sSUFBSSxHQUFtRDtRQUMzRCxNQUFNLEVBQUUsTUFBTTtRQUNkLE1BQU0sRUFBRSxPQUFPLENBQUMsTUFBTSxJQUFJLE1BQU07UUFDaEMsT0FBTyxFQUFFLEtBQUssQ0FBQyxPQUFPO1FBQ3RCLFNBQVMsRUFBRSxLQUFLLENBQUMsU0FBUztRQUMxQixrQkFBa0IsRUFBRSxLQUFLLENBQUMsa0JBQWtCLElBQUksa0NBQTBCO1FBQzFFLGlCQUFpQixFQUFFLEtBQUssQ0FBQyxpQkFBaUI7UUFDMUMsTUFBTSxFQUFFLE9BQU8sQ0FBQyxNQUFNO1FBQ3RCLElBQUksRUFBRSxLQUFLLENBQUMsSUFBSTtLQUNqQixDQUFDO0lBRUYsVUFBRyxDQUFDLG1DQUFtQyxFQUFFLElBQUksQ0FBQyxDQUFDO0lBRS9DLE1BQU0sWUFBWSxHQUFHLElBQUksQ0FBQyxTQUFTLENBQUMsSUFBSSxDQUFDLENBQUM7SUFFMUMsTUFBTSxTQUFTLEdBQUcsR0FBRyxDQUFDLEtBQUssQ0FBQyxLQUFLLENBQUMsV0FBVyxDQUFDLENBQUM7SUFDL0MsTUFBTSxzQkFBVyxDQUFDO1FBQ2hCLFFBQVEsRUFBRSxTQUFTLENBQUMsUUFBUTtRQUM1QixJQUFJLEVBQUUsU0FBUyxDQUFDLElBQUk7UUFDcEIsTUFBTSxFQUFFLEtBQUs7UUFDYixPQUFPLEVBQUU7WUFDUCxjQUFjLEVBQUUsRUFBRTtZQUNsQixnQkFBZ0IsRUFBRSxZQUFZLENBQUMsTUFBTTtTQUN0QztLQUNGLEVBQUUsWUFBWSxDQUFDLENBQUM7QUFDbkIsQ0FBQztBQTFCRCx3Q0EwQkM7QUFFVSxRQUFBLGtCQUFrQixHQUFHLElBQUksQ0FBQyxDQUFDLGlCQUFpQjtBQUV2RCxTQUFnQixXQUFXLENBQUMsS0FBb0M7SUFDOUQsT0FBTyxLQUFLLEVBQUUsS0FBVSxFQUFFLEVBQUU7UUFFMUIsdUVBQXVFO1FBQ3ZFLHVFQUF1RTtRQUN2RSxhQUFhO1FBQ2IsSUFBSSxLQUFLLENBQUMsV0FBVyxLQUFLLFFBQVEsSUFBSSxLQUFLLENBQUMsa0JBQWtCLEtBQUssd0NBQWdDLEVBQUU7WUFDbkcsVUFBRyxDQUFDLHVEQUF1RCxDQUFDLENBQUM7WUFDN0QsTUFBTSxjQUFjLENBQUMsU0FBUyxFQUFFLEtBQUssQ0FBQyxDQUFDO1lBQ3ZDLE9BQU87U0FDUjtRQUVELElBQUk7WUFDRixNQUFNLEtBQUssQ0FBQyxLQUFLLENBQUMsQ0FBQztTQUNwQjtRQUFDLE9BQU8sQ0FBQyxFQUFFO1lBQ1YscUNBQXFDO1lBQ3JDLElBQUksQ0FBQyxZQUFZLEtBQUssRUFBRTtnQkFDdEIsVUFBRyxDQUFDLDRCQUE0QixDQUFDLENBQUM7Z0JBQ2xDLE1BQU0sQ0FBQyxDQUFDO2FBQ1Q7WUFFRCxJQUFJLENBQUMsS0FBSyxDQUFDLGtCQUFrQixFQUFFO2dCQUM3Qix5RUFBeUU7Z0JBQ3pFLG1FQUFtRTtnQkFDbkUsd0VBQXdFO2dCQUN4RSxxRUFBcUU7Z0JBQ3JFLGdDQUFnQztnQkFDaEMsSUFBSSxLQUFLLENBQUMsV0FBVyxLQUFLLFFBQVEsRUFBRTtvQkFDbEMsVUFBRyxDQUFDLDRHQUE0RyxDQUFDLENBQUM7b0JBQ2xILEtBQUssQ0FBQyxrQkFBa0IsR0FBRyx3Q0FBZ0MsQ0FBQztpQkFDN0Q7cUJBQU07b0JBQ0wsa0VBQWtFO29CQUNsRSw2REFBNkQ7b0JBQzdELFVBQUcsQ0FBQyw2REFBNkQsSUFBSSxDQUFDLFNBQVMsQ0FBQyxLQUFLLENBQUMsRUFBRSxDQUFDLENBQUM7aUJBQzNGO2FBQ0Y7WUFFRCxtRUFBbUU7WUFDbkUsTUFBTSxjQUFjLENBQUMsUUFBUSxFQUFFLEtBQUssRUFBRTtnQkFDcEMsTUFBTSxFQUFFLDBCQUFrQixDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsT0FBTzthQUNqRCxDQUFDLENBQUM7U0FDSjtJQUNILENBQUMsQ0FBQztBQUNKLENBQUM7QUEzQ0Qsa0NBMkNDO0FBRUQsTUFBYSxLQUFNLFNBQVEsS0FBSztDQUFJO0FBQXBDLHNCQUFvQyIsInNvdXJjZXNDb250ZW50IjpbIi8qIGVzbGludC1kaXNhYmxlIG1heC1sZW4gKi9cbi8qIGVzbGludC1kaXNhYmxlIG5vLWNvbnNvbGUgKi9cbmltcG9ydCAqIGFzIHVybCBmcm9tICd1cmwnO1xuaW1wb3J0IHsgaHR0cFJlcXVlc3QgfSBmcm9tICcuL291dGJvdW5kJztcbmltcG9ydCB7IGxvZyB9IGZyb20gJy4vdXRpbCc7XG5cbmV4cG9ydCBjb25zdCBDUkVBVEVfRkFJTEVEX1BIWVNJQ0FMX0lEX01BUktFUiA9ICdBV1NDREs6OkN1c3RvbVJlc291cmNlUHJvdmlkZXJGcmFtZXdvcms6OkNSRUFURV9GQUlMRUQnO1xuZXhwb3J0IGNvbnN0IE1JU1NJTkdfUEhZU0lDQUxfSURfTUFSS0VSID0gJ0FXU0NESzo6Q3VzdG9tUmVzb3VyY2VQcm92aWRlckZyYW1ld29yazo6TUlTU0lOR19QSFlTSUNBTF9JRCc7XG5cbmV4cG9ydCBpbnRlcmZhY2UgQ2xvdWRGb3JtYXRpb25SZXNwb25zZU9wdGlvbnMge1xuICByZWFkb25seSByZWFzb24/OiBzdHJpbmc7XG4gIHJlYWRvbmx5IG5vRWNobz86IGJvb2xlYW47XG59XG5cbmV4cG9ydCBpbnRlcmZhY2UgQ2xvdWRGb3JtYXRpb25FdmVudENvbnRleHQge1xuICBTdGFja0lkOiBzdHJpbmc7XG4gIFJlcXVlc3RJZDogc3RyaW5nO1xuICBQaHlzaWNhbFJlc291cmNlSWQ/OiBzdHJpbmc7XG4gIExvZ2ljYWxSZXNvdXJjZUlkOiBzdHJpbmc7XG4gIFJlc3BvbnNlVVJMOiBzdHJpbmc7XG4gIERhdGE/OiBhbnlcbn1cblxuZXhwb3J0IGFzeW5jIGZ1bmN0aW9uIHN1Ym1pdFJlc3BvbnNlKHN0YXR1czogJ1NVQ0NFU1MnIHwgJ0ZBSUxFRCcsIGV2ZW50OiBDbG91ZEZvcm1hdGlvbkV2ZW50Q29udGV4dCwgb3B0aW9uczogQ2xvdWRGb3JtYXRpb25SZXNwb25zZU9wdGlvbnMgPSB7IH0pIHtcbiAgY29uc3QganNvbjogQVdTTGFtYmRhLkNsb3VkRm9ybWF0aW9uQ3VzdG9tUmVzb3VyY2VSZXNwb25zZSA9IHtcbiAgICBTdGF0dXM6IHN0YXR1cyxcbiAgICBSZWFzb246IG9wdGlvbnMucmVhc29uIHx8IHN0YXR1cyxcbiAgICBTdGFja0lkOiBldmVudC5TdGFja0lkLFxuICAgIFJlcXVlc3RJZDogZXZlbnQuUmVxdWVzdElkLFxuICAgIFBoeXNpY2FsUmVzb3VyY2VJZDogZXZlbnQuUGh5c2ljYWxSZXNvdXJjZUlkIHx8IE1JU1NJTkdfUEhZU0lDQUxfSURfTUFSS0VSLFxuICAgIExvZ2ljYWxSZXNvdXJjZUlkOiBldmVudC5Mb2dpY2FsUmVzb3VyY2VJZCxcbiAgICBOb0VjaG86IG9wdGlvbnMubm9FY2hvLFxuICAgIERhdGE6IGV2ZW50LkRhdGEsXG4gIH07XG5cbiAgbG9nKCdzdWJtaXQgcmVzcG9uc2UgdG8gY2xvdWRmb3JtYXRpb24nLCBqc29uKTtcblxuICBjb25zdCByZXNwb25zZUJvZHkgPSBKU09OLnN0cmluZ2lmeShqc29uKTtcblxuICBjb25zdCBwYXJzZWRVcmwgPSB1cmwucGFyc2UoZXZlbnQuUmVzcG9uc2VVUkwpO1xuICBhd2FpdCBodHRwUmVxdWVzdCh7XG4gICAgaG9zdG5hbWU6IHBhcnNlZFVybC5ob3N0bmFtZSxcbiAgICBwYXRoOiBwYXJzZWRVcmwucGF0aCxcbiAgICBtZXRob2Q6ICdQVVQnLFxuICAgIGhlYWRlcnM6IHtcbiAgICAgICdjb250ZW50LXR5cGUnOiAnJyxcbiAgICAgICdjb250ZW50LWxlbmd0aCc6IHJlc3BvbnNlQm9keS5sZW5ndGgsXG4gICAgfSxcbiAgfSwgcmVzcG9uc2VCb2R5KTtcbn1cblxuZXhwb3J0IGxldCBpbmNsdWRlU3RhY2tUcmFjZXMgPSB0cnVlOyAvLyBmb3IgdW5pdCB0ZXN0c1xuXG5leHBvcnQgZnVuY3Rpb24gc2FmZUhhbmRsZXIoYmxvY2s6IChldmVudDogYW55KSA9PiBQcm9taXNlPHZvaWQ+KSB7XG4gIHJldHVybiBhc3luYyAoZXZlbnQ6IGFueSkgPT4ge1xuXG4gICAgLy8gaWdub3JlIERFTEVURSBldmVudCB3aGVuIHRoZSBwaHlzaWNhbCByZXNvdXJjZSBJRCBpcyB0aGUgbWFya2VyIHRoYXRcbiAgICAvLyBpbmRpY2F0ZXMgdGhhdCB0aGlzIERFTEVURSBpcyBhIHN1YnNlcXVlbnQgREVMRVRFIHRvIGEgZmFpbGVkIENSRUFURVxuICAgIC8vIG9wZXJhdGlvbi5cbiAgICBpZiAoZXZlbnQuUmVxdWVzdFR5cGUgPT09ICdEZWxldGUnICYmIGV2ZW50LlBoeXNpY2FsUmVzb3VyY2VJZCA9PT0gQ1JFQVRFX0ZBSUxFRF9QSFlTSUNBTF9JRF9NQVJLRVIpIHtcbiAgICAgIGxvZygnaWdub3JpbmcgREVMRVRFIGV2ZW50IGNhdXNlZCBieSBhIGZhaWxlZCBDUkVBVEUgZXZlbnQnKTtcbiAgICAgIGF3YWl0IHN1Ym1pdFJlc3BvbnNlKCdTVUNDRVNTJywgZXZlbnQpO1xuICAgICAgcmV0dXJuO1xuICAgIH1cblxuICAgIHRyeSB7XG4gICAgICBhd2FpdCBibG9jayhldmVudCk7XG4gICAgfSBjYXRjaCAoZSkge1xuICAgICAgLy8gdGVsbCB3YWl0ZXIgc3RhdGUgbWFjaGluZSB0byByZXRyeVxuICAgICAgaWYgKGUgaW5zdGFuY2VvZiBSZXRyeSkge1xuICAgICAgICBsb2coJ3JldHJ5IHJlcXVlc3RlZCBieSBoYW5kbGVyJyk7XG4gICAgICAgIHRocm93IGU7XG4gICAgICB9XG5cbiAgICAgIGlmICghZXZlbnQuUGh5c2ljYWxSZXNvdXJjZUlkKSB7XG4gICAgICAgIC8vIHNwZWNpYWwgY2FzZTogaWYgQ1JFQVRFIGZhaWxzLCB3aGljaCB1c3VhbGx5IGltcGxpZXMsIHdlIHVzdWFsbHkgZG9uJ3RcbiAgICAgICAgLy8gaGF2ZSBhIHBoeXNpY2FsIHJlc291cmNlIGlkLiBpbiB0aGlzIGNhc2UsIHRoZSBzdWJzZXF1ZW50IERFTEVURVxuICAgICAgICAvLyBvcGVyYXRpb24gZG9lcyBub3QgaGF2ZSBhbnkgbWVhbmluZywgYW5kIHdpbGwgbGlrZWx5IGZhaWwgYXMgd2VsbC4gdG9cbiAgICAgICAgLy8gYWRkcmVzcyB0aGlzLCB3ZSB1c2UgYSBtYXJrZXIgc28gdGhlIHByb3ZpZGVyIGZyYW1ld29yayBjYW4gc2ltcGx5XG4gICAgICAgIC8vIGlnbm9yZSB0aGUgc3Vic2VxdWVudCBERUxFVEUuXG4gICAgICAgIGlmIChldmVudC5SZXF1ZXN0VHlwZSA9PT0gJ0NyZWF0ZScpIHtcbiAgICAgICAgICBsb2coJ0NSRUFURSBmYWlsZWQsIHJlc3BvbmRpbmcgd2l0aCBhIG1hcmtlciBwaHlzaWNhbCByZXNvdXJjZSBpZCBzbyB0aGF0IHRoZSBzdWJzZXF1ZW50IERFTEVURSB3aWxsIGJlIGlnbm9yZWQnKTtcbiAgICAgICAgICBldmVudC5QaHlzaWNhbFJlc291cmNlSWQgPSBDUkVBVEVfRkFJTEVEX1BIWVNJQ0FMX0lEX01BUktFUjtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAvLyBvdGhlcndpc2UsIGlmIFBoeXNpY2FsUmVzb3VyY2VJZCBpcyBub3Qgc3BlY2lmaWVkLCBzb21ldGhpbmcgaXNcbiAgICAgICAgICAvLyB0ZXJyaWJseSB3cm9uZyBiZWNhdXNlIGFsbCBvdGhlciBldmVudHMgc2hvdWxkIGhhdmUgYW4gSUQuXG4gICAgICAgICAgbG9nKGBFUlJPUjogTWFsZm9ybWVkIGV2ZW50LiBcIlBoeXNpY2FsUmVzb3VyY2VJZFwiIGlzIHJlcXVpcmVkOiAke0pTT04uc3RyaW5naWZ5KGV2ZW50KX1gKTtcbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICAvLyB0aGlzIGlzIGFuIGFjdHVhbCBlcnJvciwgZmFpbCB0aGUgYWN0aXZpdHkgYWx0b2dldGhlciBhbmQgZXhpc3QuXG4gICAgICBhd2FpdCBzdWJtaXRSZXNwb25zZSgnRkFJTEVEJywgZXZlbnQsIHtcbiAgICAgICAgcmVhc29uOiBpbmNsdWRlU3RhY2tUcmFjZXMgPyBlLnN0YWNrIDogZS5tZXNzYWdlLFxuICAgICAgfSk7XG4gICAgfVxuICB9O1xufVxuXG5leHBvcnQgY2xhc3MgUmV0cnkgZXh0ZW5kcyBFcnJvciB7IH1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9/consts.js b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9/consts.js deleted file mode 100644 index 31faa077ae313..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9/consts.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FRAMEWORK_ON_TIMEOUT_HANDLER_NAME = exports.FRAMEWORK_IS_COMPLETE_HANDLER_NAME = exports.FRAMEWORK_ON_EVENT_HANDLER_NAME = exports.WAITER_STATE_MACHINE_ARN_ENV = exports.USER_IS_COMPLETE_FUNCTION_ARN_ENV = exports.USER_ON_EVENT_FUNCTION_ARN_ENV = void 0; -exports.USER_ON_EVENT_FUNCTION_ARN_ENV = 'USER_ON_EVENT_FUNCTION_ARN'; -exports.USER_IS_COMPLETE_FUNCTION_ARN_ENV = 'USER_IS_COMPLETE_FUNCTION_ARN'; -exports.WAITER_STATE_MACHINE_ARN_ENV = 'WAITER_STATE_MACHINE_ARN'; -exports.FRAMEWORK_ON_EVENT_HANDLER_NAME = 'onEvent'; -exports.FRAMEWORK_IS_COMPLETE_HANDLER_NAME = 'isComplete'; -exports.FRAMEWORK_ON_TIMEOUT_HANDLER_NAME = 'onTimeout'; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY29uc3RzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFhLFFBQUEsOEJBQThCLEdBQUcsNEJBQTRCLENBQUM7QUFDOUQsUUFBQSxpQ0FBaUMsR0FBRywrQkFBK0IsQ0FBQztBQUNwRSxRQUFBLDRCQUE0QixHQUFHLDBCQUEwQixDQUFDO0FBRTFELFFBQUEsK0JBQStCLEdBQUcsU0FBUyxDQUFDO0FBQzVDLFFBQUEsa0NBQWtDLEdBQUcsWUFBWSxDQUFDO0FBQ2xELFFBQUEsaUNBQWlDLEdBQUcsV0FBVyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGNvbnN0IFVTRVJfT05fRVZFTlRfRlVOQ1RJT05fQVJOX0VOViA9ICdVU0VSX09OX0VWRU5UX0ZVTkNUSU9OX0FSTic7XG5leHBvcnQgY29uc3QgVVNFUl9JU19DT01QTEVURV9GVU5DVElPTl9BUk5fRU5WID0gJ1VTRVJfSVNfQ09NUExFVEVfRlVOQ1RJT05fQVJOJztcbmV4cG9ydCBjb25zdCBXQUlURVJfU1RBVEVfTUFDSElORV9BUk5fRU5WID0gJ1dBSVRFUl9TVEFURV9NQUNISU5FX0FSTic7XG5cbmV4cG9ydCBjb25zdCBGUkFNRVdPUktfT05fRVZFTlRfSEFORExFUl9OQU1FID0gJ29uRXZlbnQnO1xuZXhwb3J0IGNvbnN0IEZSQU1FV09SS19JU19DT01QTEVURV9IQU5ETEVSX05BTUUgPSAnaXNDb21wbGV0ZSc7XG5leHBvcnQgY29uc3QgRlJBTUVXT1JLX09OX1RJTUVPVVRfSEFORExFUl9OQU1FID0gJ29uVGltZW91dCc7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9/framework.js b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9/framework.js deleted file mode 100644 index 3f09fbdde6480..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9/framework.js +++ /dev/null @@ -1,164 +0,0 @@ -"use strict"; -const cfnResponse = require("./cfn-response"); -const consts = require("./consts"); -const outbound_1 = require("./outbound"); -const util_1 = require("./util"); -/** - * The main runtime entrypoint of the async custom resource lambda function. - * - * Any lifecycle event changes to the custom resources will invoke this handler, which will, in turn, - * interact with the user-defined `onEvent` and `isComplete` handlers. - * - * This function will always succeed. If an error occurs - * - * @param cfnRequest The cloudformation custom resource event. - */ -async function onEvent(cfnRequest) { - util_1.log('onEventHandler', cfnRequest); - cfnRequest.ResourceProperties = cfnRequest.ResourceProperties || {}; - const onEventResult = await invokeUserFunction(consts.USER_ON_EVENT_FUNCTION_ARN_ENV, cfnRequest); - util_1.log('onEvent returned:', onEventResult); - // merge the request and the result from onEvent to form the complete resource event - // this also performs validation. - const resourceEvent = createResponseEvent(cfnRequest, onEventResult); - util_1.log('event:', onEventResult); - // determine if this is an async provider based on whether we have an isComplete handler defined. - // if it is not defined, then we are basically ready to return a positive response. - if (!process.env[consts.USER_IS_COMPLETE_FUNCTION_ARN_ENV]) { - return cfnResponse.submitResponse('SUCCESS', resourceEvent, { noEcho: resourceEvent.NoEcho }); - } - // ok, we are not complete, so kick off the waiter workflow - const waiter = { - stateMachineArn: util_1.getEnv(consts.WAITER_STATE_MACHINE_ARN_ENV), - name: resourceEvent.RequestId, - input: JSON.stringify(resourceEvent), - }; - util_1.log('starting waiter', waiter); - // kick off waiter state machine - await outbound_1.startExecution(waiter); -} -// invoked a few times until `complete` is true or until it times out. -async function isComplete(event) { - util_1.log('isComplete', event); - const isCompleteResult = await invokeUserFunction(consts.USER_IS_COMPLETE_FUNCTION_ARN_ENV, event); - util_1.log('user isComplete returned:', isCompleteResult); - // if we are not complete, return false, and don't send a response back. - if (!isCompleteResult.IsComplete) { - if (isCompleteResult.Data && Object.keys(isCompleteResult.Data).length > 0) { - throw new Error('"Data" is not allowed if "IsComplete" is "False"'); - } - throw new cfnResponse.Retry(JSON.stringify(event)); - } - const response = { - ...event, - ...isCompleteResult, - Data: { - ...event.Data, - ...isCompleteResult.Data, - }, - }; - await cfnResponse.submitResponse('SUCCESS', response, { noEcho: event.NoEcho }); -} -// invoked when completion retries are exhaused. -async function onTimeout(timeoutEvent) { - util_1.log('timeoutHandler', timeoutEvent); - const isCompleteRequest = JSON.parse(JSON.parse(timeoutEvent.Cause).errorMessage); - await cfnResponse.submitResponse('FAILED', isCompleteRequest, { - reason: 'Operation timed out', - }); -} -async function invokeUserFunction(functionArnEnv, payload) { - const functionArn = util_1.getEnv(functionArnEnv); - util_1.log(`executing user function ${functionArn} with payload`, payload); - // transient errors such as timeouts, throttling errors (429), and other - // errors that aren't caused by a bad request (500 series) are retried - // automatically by the JavaScript SDK. - const resp = await outbound_1.invokeFunction({ - FunctionName: functionArn, - Payload: JSON.stringify(payload), - }); - util_1.log('user function response:', resp, typeof (resp)); - const jsonPayload = parseJsonPayload(resp.Payload); - if (resp.FunctionError) { - util_1.log('user function threw an error:', resp.FunctionError); - const errorMessage = jsonPayload.errorMessage || 'error'; - // parse function name from arn - // arn:${Partition}:lambda:${Region}:${Account}:function:${FunctionName} - const arn = functionArn.split(':'); - const functionName = arn[arn.length - 1]; - // append a reference to the log group. - const message = [ - errorMessage, - '', - `Logs: /aws/lambda/${functionName}`, - '', - ].join('\n'); - const e = new Error(message); - // the output that goes to CFN is what's in `stack`, not the error message. - // if we have a remote trace, construct a nice message with log group information - if (jsonPayload.trace) { - // skip first trace line because it's the message - e.stack = [message, ...jsonPayload.trace.slice(1)].join('\n'); - } - throw e; - } - return jsonPayload; -} -function parseJsonPayload(payload) { - if (!payload) { - return {}; - } - const text = payload.toString(); - try { - return JSON.parse(text); - } - catch (e) { - throw new Error(`return values from user-handlers must be JSON objects. got: "${text}"`); - } -} -function createResponseEvent(cfnRequest, onEventResult) { - // - // validate that onEventResult always includes a PhysicalResourceId - onEventResult = onEventResult || {}; - // if physical ID is not returned, we have some defaults for you based - // on the request type. - const physicalResourceId = onEventResult.PhysicalResourceId || defaultPhysicalResourceId(cfnRequest); - // if we are in DELETE and physical ID was changed, it's an error. - if (cfnRequest.RequestType === 'Delete' && physicalResourceId !== cfnRequest.PhysicalResourceId) { - throw new Error(`DELETE: cannot change the physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${onEventResult.PhysicalResourceId}" during deletion`); - } - // if we are in UPDATE and physical ID was changed, it's a replacement (just log) - if (cfnRequest.RequestType === 'Update' && physicalResourceId !== cfnRequest.PhysicalResourceId) { - util_1.log(`UPDATE: changing physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${onEventResult.PhysicalResourceId}"`); - } - // merge request event and result event (result prevails). - return { - ...cfnRequest, - ...onEventResult, - PhysicalResourceId: physicalResourceId, - }; -} -/** - * Calculates the default physical resource ID based in case user handler did - * not return a PhysicalResourceId. - * - * For "CREATE", it uses the RequestId. - * For "UPDATE" and "DELETE" and returns the current PhysicalResourceId (the one provided in `event`). - */ -function defaultPhysicalResourceId(req) { - switch (req.RequestType) { - case 'Create': - return req.RequestId; - case 'Update': - case 'Delete': - return req.PhysicalResourceId; - default: - throw new Error(`Invalid "RequestType" in request "${JSON.stringify(req)}"`); - } -} -module.exports = { - [consts.FRAMEWORK_ON_EVENT_HANDLER_NAME]: cfnResponse.safeHandler(onEvent), - [consts.FRAMEWORK_IS_COMPLETE_HANDLER_NAME]: cfnResponse.safeHandler(isComplete), - [consts.FRAMEWORK_ON_TIMEOUT_HANDLER_NAME]: onTimeout, -}; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZnJhbWV3b3JrLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZnJhbWV3b3JrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFHQSw4Q0FBOEM7QUFDOUMsbUNBQW1DO0FBQ25DLHlDQUE0RDtBQUM1RCxpQ0FBcUM7QUFTckM7Ozs7Ozs7OztHQVNHO0FBQ0gsS0FBSyxVQUFVLE9BQU8sQ0FBQyxVQUF1RDtJQUM1RSxVQUFHLENBQUMsZ0JBQWdCLEVBQUUsVUFBVSxDQUFDLENBQUM7SUFFbEMsVUFBVSxDQUFDLGtCQUFrQixHQUFHLFVBQVUsQ0FBQyxrQkFBa0IsSUFBSSxFQUFHLENBQUM7SUFFckUsTUFBTSxhQUFhLEdBQUcsTUFBTSxrQkFBa0IsQ0FBQyxNQUFNLENBQUMsOEJBQThCLEVBQUUsVUFBVSxDQUFvQixDQUFDO0lBQ3JILFVBQUcsQ0FBQyxtQkFBbUIsRUFBRSxhQUFhLENBQUMsQ0FBQztJQUV4QyxvRkFBb0Y7SUFDcEYsaUNBQWlDO0lBQ2pDLE1BQU0sYUFBYSxHQUFHLG1CQUFtQixDQUFDLFVBQVUsRUFBRSxhQUFhLENBQUMsQ0FBQztJQUNyRSxVQUFHLENBQUMsUUFBUSxFQUFFLGFBQWEsQ0FBQyxDQUFDO0lBRTdCLGlHQUFpRztJQUNqRyxtRkFBbUY7SUFDbkYsSUFBSSxDQUFDLE9BQU8sQ0FBQyxHQUFHLENBQUMsTUFBTSxDQUFDLGlDQUFpQyxDQUFDLEVBQUU7UUFDMUQsT0FBTyxXQUFXLENBQUMsY0FBYyxDQUFDLFNBQVMsRUFBRSxhQUFhLEVBQUUsRUFBRSxNQUFNLEVBQUUsYUFBYSxDQUFDLE1BQU0sRUFBRSxDQUFDLENBQUM7S0FDL0Y7SUFFRCwyREFBMkQ7SUFDM0QsTUFBTSxNQUFNLEdBQUc7UUFDYixlQUFlLEVBQUUsYUFBTSxDQUFDLE1BQU0sQ0FBQyw0QkFBNEIsQ0FBQztRQUM1RCxJQUFJLEVBQUUsYUFBYSxDQUFDLFNBQVM7UUFDN0IsS0FBSyxFQUFFLElBQUksQ0FBQyxTQUFTLENBQUMsYUFBYSxDQUFDO0tBQ3JDLENBQUM7SUFFRixVQUFHLENBQUMsaUJBQWlCLEVBQUUsTUFBTSxDQUFDLENBQUM7SUFFL0IsZ0NBQWdDO0lBQ2hDLE1BQU0seUJBQWMsQ0FBQyxNQUFNLENBQUMsQ0FBQztBQUMvQixDQUFDO0FBRUQsc0VBQXNFO0FBQ3RFLEtBQUssVUFBVSxVQUFVLENBQUMsS0FBa0Q7SUFDMUUsVUFBRyxDQUFDLFlBQVksRUFBRSxLQUFLLENBQUMsQ0FBQztJQUV6QixNQUFNLGdCQUFnQixHQUFHLE1BQU0sa0JBQWtCLENBQUMsTUFBTSxDQUFDLGlDQUFpQyxFQUFFLEtBQUssQ0FBdUIsQ0FBQztJQUN6SCxVQUFHLENBQUMsMkJBQTJCLEVBQUUsZ0JBQWdCLENBQUMsQ0FBQztJQUVuRCx3RUFBd0U7SUFDeEUsSUFBSSxDQUFDLGdCQUFnQixDQUFDLFVBQVUsRUFBRTtRQUNoQyxJQUFJLGdCQUFnQixDQUFDLElBQUksSUFBSSxNQUFNLENBQUMsSUFBSSxDQUFDLGdCQUFnQixDQUFDLElBQUksQ0FBQyxDQUFDLE1BQU0sR0FBRyxDQUFDLEVBQUU7WUFDMUUsTUFBTSxJQUFJLEtBQUssQ0FBQyxrREFBa0QsQ0FBQyxDQUFDO1NBQ3JFO1FBRUQsTUFBTSxJQUFJLFdBQVcsQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLFNBQVMsQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDO0tBQ3BEO0lBRUQsTUFBTSxRQUFRLEdBQUc7UUFDZixHQUFHLEtBQUs7UUFDUixHQUFHLGdCQUFnQjtRQUNuQixJQUFJLEVBQUU7WUFDSixHQUFHLEtBQUssQ0FBQyxJQUFJO1lBQ2IsR0FBRyxnQkFBZ0IsQ0FBQyxJQUFJO1NBQ3pCO0tBQ0YsQ0FBQztJQUVGLE1BQU0sV0FBVyxDQUFDLGNBQWMsQ0FBQyxTQUFTLEVBQUUsUUFBUSxFQUFFLEVBQUUsTUFBTSxFQUFFLEtBQUssQ0FBQyxNQUFNLEVBQUUsQ0FBQyxDQUFDO0FBQ2xGLENBQUM7QUFFRCxnREFBZ0Q7QUFDaEQsS0FBSyxVQUFVLFNBQVMsQ0FBQyxZQUFpQjtJQUN4QyxVQUFHLENBQUMsZ0JBQWdCLEVBQUUsWUFBWSxDQUFDLENBQUM7SUFFcEMsTUFBTSxpQkFBaUIsR0FBRyxJQUFJLENBQUMsS0FBSyxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsWUFBWSxDQUFDLEtBQUssQ0FBQyxDQUFDLFlBQVksQ0FBZ0QsQ0FBQztJQUNqSSxNQUFNLFdBQVcsQ0FBQyxjQUFjLENBQUMsUUFBUSxFQUFFLGlCQUFpQixFQUFFO1FBQzVELE1BQU0sRUFBRSxxQkFBcUI7S0FDOUIsQ0FBQyxDQUFDO0FBQ0wsQ0FBQztBQUVELEtBQUssVUFBVSxrQkFBa0IsQ0FBQyxjQUFzQixFQUFFLE9BQVk7SUFDcEUsTUFBTSxXQUFXLEdBQUcsYUFBTSxDQUFDLGNBQWMsQ0FBQyxDQUFDO0lBQzNDLFVBQUcsQ0FBQywyQkFBMkIsV0FBVyxlQUFlLEVBQUUsT0FBTyxDQUFDLENBQUM7SUFFcEUsd0VBQXdFO0lBQ3hFLHNFQUFzRTtJQUN0RSx1Q0FBdUM7SUFDdkMsTUFBTSxJQUFJLEdBQUcsTUFBTSx5QkFBYyxDQUFDO1FBQ2hDLFlBQVksRUFBRSxXQUFXO1FBQ3pCLE9BQU8sRUFBRSxJQUFJLENBQUMsU0FBUyxDQUFDLE9BQU8sQ0FBQztLQUNqQyxDQUFDLENBQUM7SUFFSCxVQUFHLENBQUMseUJBQXlCLEVBQUUsSUFBSSxFQUFFLE9BQU0sQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDO0lBRW5ELE1BQU0sV0FBVyxHQUFHLGdCQUFnQixDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsQ0FBQztJQUNuRCxJQUFJLElBQUksQ0FBQyxhQUFhLEVBQUU7UUFDdEIsVUFBRyxDQUFDLCtCQUErQixFQUFFLElBQUksQ0FBQyxhQUFhLENBQUMsQ0FBQztRQUV6RCxNQUFNLFlBQVksR0FBRyxXQUFXLENBQUMsWUFBWSxJQUFJLE9BQU8sQ0FBQztRQUV6RCwrQkFBK0I7UUFDL0Isd0VBQXdFO1FBQ3hFLE1BQU0sR0FBRyxHQUFHLFdBQVcsQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLENBQUM7UUFDbkMsTUFBTSxZQUFZLEdBQUcsR0FBRyxDQUFDLEdBQUcsQ0FBQyxNQUFNLEdBQUcsQ0FBQyxDQUFDLENBQUM7UUFFekMsdUNBQXVDO1FBQ3ZDLE1BQU0sT0FBTyxHQUFHO1lBQ2QsWUFBWTtZQUNaLEVBQUU7WUFDRixxQkFBcUIsWUFBWSxFQUFFO1lBQ25DLEVBQUU7U0FDSCxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQztRQUViLE1BQU0sQ0FBQyxHQUFHLElBQUksS0FBSyxDQUFDLE9BQU8sQ0FBQyxDQUFDO1FBRTdCLDJFQUEyRTtRQUMzRSxpRkFBaUY7UUFDakYsSUFBSSxXQUFXLENBQUMsS0FBSyxFQUFFO1lBQ3JCLGlEQUFpRDtZQUNqRCxDQUFDLENBQUMsS0FBSyxHQUFHLENBQUMsT0FBTyxFQUFFLEdBQUcsV0FBVyxDQUFDLEtBQUssQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLENBQUM7U0FDL0Q7UUFFRCxNQUFNLENBQUMsQ0FBQztLQUNUO0lBRUQsT0FBTyxXQUFXLENBQUM7QUFDckIsQ0FBQztBQUVELFNBQVMsZ0JBQWdCLENBQUMsT0FBWTtJQUNwQyxJQUFJLENBQUMsT0FBTyxFQUFFO1FBQUUsT0FBTyxFQUFHLENBQUM7S0FBRTtJQUM3QixNQUFNLElBQUksR0FBRyxPQUFPLENBQUMsUUFBUSxFQUFFLENBQUM7SUFDaEMsSUFBSTtRQUNGLE9BQU8sSUFBSSxDQUFDLEtBQUssQ0FBQyxJQUFJLENBQUMsQ0FBQztLQUN6QjtJQUFDLE9BQU8sQ0FBQyxFQUFFO1FBQ1YsTUFBTSxJQUFJLEtBQUssQ0FBQyxnRUFBZ0UsSUFBSSxHQUFHLENBQUMsQ0FBQztLQUMxRjtBQUNILENBQUM7QUFFRCxTQUFTLG1CQUFtQixDQUFDLFVBQXVELEVBQUUsYUFBOEI7SUFDbEgsRUFBRTtJQUNGLG1FQUFtRTtJQUVuRSxhQUFhLEdBQUcsYUFBYSxJQUFJLEVBQUcsQ0FBQztJQUVyQyxzRUFBc0U7SUFDdEUsdUJBQXVCO0lBQ3ZCLE1BQU0sa0JBQWtCLEdBQUcsYUFBYSxDQUFDLGtCQUFrQixJQUFJLHlCQUF5QixDQUFDLFVBQVUsQ0FBQyxDQUFDO0lBRXJHLGtFQUFrRTtJQUNsRSxJQUFJLFVBQVUsQ0FBQyxXQUFXLEtBQUssUUFBUSxJQUFJLGtCQUFrQixLQUFLLFVBQVUsQ0FBQyxrQkFBa0IsRUFBRTtRQUMvRixNQUFNLElBQUksS0FBSyxDQUFDLHdEQUF3RCxVQUFVLENBQUMsa0JBQWtCLFNBQVMsYUFBYSxDQUFDLGtCQUFrQixtQkFBbUIsQ0FBQyxDQUFDO0tBQ3BLO0lBRUQsaUZBQWlGO0lBQ2pGLElBQUksVUFBVSxDQUFDLFdBQVcsS0FBSyxRQUFRLElBQUksa0JBQWtCLEtBQUssVUFBVSxDQUFDLGtCQUFrQixFQUFFO1FBQy9GLFVBQUcsQ0FBQywrQ0FBK0MsVUFBVSxDQUFDLGtCQUFrQixTQUFTLGFBQWEsQ0FBQyxrQkFBa0IsR0FBRyxDQUFDLENBQUM7S0FDL0g7SUFFRCwwREFBMEQ7SUFDMUQsT0FBTztRQUNMLEdBQUcsVUFBVTtRQUNiLEdBQUcsYUFBYTtRQUNoQixrQkFBa0IsRUFBRSxrQkFBa0I7S0FDdkMsQ0FBQztBQUNKLENBQUM7QUFFRDs7Ozs7O0dBTUc7QUFDSCxTQUFTLHlCQUF5QixDQUFDLEdBQWdEO0lBQ2pGLFFBQVEsR0FBRyxDQUFDLFdBQVcsRUFBRTtRQUN2QixLQUFLLFFBQVE7WUFDWCxPQUFPLEdBQUcsQ0FBQyxTQUFTLENBQUM7UUFFdkIsS0FBSyxRQUFRLENBQUM7UUFDZCxLQUFLLFFBQVE7WUFDWCxPQUFPLEdBQUcsQ0FBQyxrQkFBa0IsQ0FBQztRQUVoQztZQUNFLE1BQU0sSUFBSSxLQUFLLENBQUMscUNBQXFDLElBQUksQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLEdBQUcsQ0FBQyxDQUFDO0tBQ2hGO0FBQ0gsQ0FBQztBQS9MRCxpQkFBUztJQUNQLENBQUMsTUFBTSxDQUFDLCtCQUErQixDQUFDLEVBQUUsV0FBVyxDQUFDLFdBQVcsQ0FBQyxPQUFPLENBQUM7SUFDMUUsQ0FBQyxNQUFNLENBQUMsa0NBQWtDLENBQUMsRUFBRSxXQUFXLENBQUMsV0FBVyxDQUFDLFVBQVUsQ0FBQztJQUNoRixDQUFDLE1BQU0sQ0FBQyxpQ0FBaUMsQ0FBQyxFQUFFLFNBQVM7Q0FDdEQsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qIGVzbGludC1kaXNhYmxlIG1heC1sZW4gKi9cbi8qIGVzbGludC1kaXNhYmxlIG5vLWNvbnNvbGUgKi9cbmltcG9ydCB7IElzQ29tcGxldGVSZXNwb25zZSwgT25FdmVudFJlc3BvbnNlIH0gZnJvbSAnLi4vdHlwZXMnO1xuaW1wb3J0ICogYXMgY2ZuUmVzcG9uc2UgZnJvbSAnLi9jZm4tcmVzcG9uc2UnO1xuaW1wb3J0ICogYXMgY29uc3RzIGZyb20gJy4vY29uc3RzJztcbmltcG9ydCB7IGludm9rZUZ1bmN0aW9uLCBzdGFydEV4ZWN1dGlvbiB9IGZyb20gJy4vb3V0Ym91bmQnO1xuaW1wb3J0IHsgZ2V0RW52LCBsb2cgfSBmcm9tICcuL3V0aWwnO1xuXG4vLyB1c2UgY29uc3RzIGZvciBoYW5kbGVyIG5hbWVzIHRvIGNvbXBpbGVyLWVuZm9yY2UgdGhlIGNvdXBsaW5nIHdpdGggY29uc3RydWN0aW9uIGNvZGUuXG5leHBvcnQgPSB7XG4gIFtjb25zdHMuRlJBTUVXT1JLX09OX0VWRU5UX0hBTkRMRVJfTkFNRV06IGNmblJlc3BvbnNlLnNhZmVIYW5kbGVyKG9uRXZlbnQpLFxuICBbY29uc3RzLkZSQU1FV09SS19JU19DT01QTEVURV9IQU5ETEVSX05BTUVdOiBjZm5SZXNwb25zZS5zYWZlSGFuZGxlcihpc0NvbXBsZXRlKSxcbiAgW2NvbnN0cy5GUkFNRVdPUktfT05fVElNRU9VVF9IQU5ETEVSX05BTUVdOiBvblRpbWVvdXQsXG59O1xuXG4vKipcbiAqIFRoZSBtYWluIHJ1bnRpbWUgZW50cnlwb2ludCBvZiB0aGUgYXN5bmMgY3VzdG9tIHJlc291cmNlIGxhbWJkYSBmdW5jdGlvbi5cbiAqXG4gKiBBbnkgbGlmZWN5Y2xlIGV2ZW50IGNoYW5nZXMgdG8gdGhlIGN1c3RvbSByZXNvdXJjZXMgd2lsbCBpbnZva2UgdGhpcyBoYW5kbGVyLCB3aGljaCB3aWxsLCBpbiB0dXJuLFxuICogaW50ZXJhY3Qgd2l0aCB0aGUgdXNlci1kZWZpbmVkIGBvbkV2ZW50YCBhbmQgYGlzQ29tcGxldGVgIGhhbmRsZXJzLlxuICpcbiAqIFRoaXMgZnVuY3Rpb24gd2lsbCBhbHdheXMgc3VjY2VlZC4gSWYgYW4gZXJyb3Igb2NjdXJzXG4gKlxuICogQHBhcmFtIGNmblJlcXVlc3QgVGhlIGNsb3VkZm9ybWF0aW9uIGN1c3RvbSByZXNvdXJjZSBldmVudC5cbiAqL1xuYXN5bmMgZnVuY3Rpb24gb25FdmVudChjZm5SZXF1ZXN0OiBBV1NMYW1iZGEuQ2xvdWRGb3JtYXRpb25DdXN0b21SZXNvdXJjZUV2ZW50KSB7XG4gIGxvZygnb25FdmVudEhhbmRsZXInLCBjZm5SZXF1ZXN0KTtcblxuICBjZm5SZXF1ZXN0LlJlc291cmNlUHJvcGVydGllcyA9IGNmblJlcXVlc3QuUmVzb3VyY2VQcm9wZXJ0aWVzIHx8IHsgfTtcblxuICBjb25zdCBvbkV2ZW50UmVzdWx0ID0gYXdhaXQgaW52b2tlVXNlckZ1bmN0aW9uKGNvbnN0cy5VU0VSX09OX0VWRU5UX0ZVTkNUSU9OX0FSTl9FTlYsIGNmblJlcXVlc3QpIGFzIE9uRXZlbnRSZXNwb25zZTtcbiAgbG9nKCdvbkV2ZW50IHJldHVybmVkOicsIG9uRXZlbnRSZXN1bHQpO1xuXG4gIC8vIG1lcmdlIHRoZSByZXF1ZXN0IGFuZCB0aGUgcmVzdWx0IGZyb20gb25FdmVudCB0byBmb3JtIHRoZSBjb21wbGV0ZSByZXNvdXJjZSBldmVudFxuICAvLyB0aGlzIGFsc28gcGVyZm9ybXMgdmFsaWRhdGlvbi5cbiAgY29uc3QgcmVzb3VyY2VFdmVudCA9IGNyZWF0ZVJlc3BvbnNlRXZlbnQoY2ZuUmVxdWVzdCwgb25FdmVudFJlc3VsdCk7XG4gIGxvZygnZXZlbnQ6Jywgb25FdmVudFJlc3VsdCk7XG5cbiAgLy8gZGV0ZXJtaW5lIGlmIHRoaXMgaXMgYW4gYXN5bmMgcHJvdmlkZXIgYmFzZWQgb24gd2hldGhlciB3ZSBoYXZlIGFuIGlzQ29tcGxldGUgaGFuZGxlciBkZWZpbmVkLlxuICAvLyBpZiBpdCBpcyBub3QgZGVmaW5lZCwgdGhlbiB3ZSBhcmUgYmFzaWNhbGx5IHJlYWR5IHRvIHJldHVybiBhIHBvc2l0aXZlIHJlc3BvbnNlLlxuICBpZiAoIXByb2Nlc3MuZW52W2NvbnN0cy5VU0VSX0lTX0NPTVBMRVRFX0ZVTkNUSU9OX0FSTl9FTlZdKSB7XG4gICAgcmV0dXJuIGNmblJlc3BvbnNlLnN1Ym1pdFJlc3BvbnNlKCdTVUNDRVNTJywgcmVzb3VyY2VFdmVudCwgeyBub0VjaG86IHJlc291cmNlRXZlbnQuTm9FY2hvIH0pO1xuICB9XG5cbiAgLy8gb2ssIHdlIGFyZSBub3QgY29tcGxldGUsIHNvIGtpY2sgb2ZmIHRoZSB3YWl0ZXIgd29ya2Zsb3dcbiAgY29uc3Qgd2FpdGVyID0ge1xuICAgIHN0YXRlTWFjaGluZUFybjogZ2V0RW52KGNvbnN0cy5XQUlURVJfU1RBVEVfTUFDSElORV9BUk5fRU5WKSxcbiAgICBuYW1lOiByZXNvdXJjZUV2ZW50LlJlcXVlc3RJZCxcbiAgICBpbnB1dDogSlNPTi5zdHJpbmdpZnkocmVzb3VyY2VFdmVudCksXG4gIH07XG5cbiAgbG9nKCdzdGFydGluZyB3YWl0ZXInLCB3YWl0ZXIpO1xuXG4gIC8vIGtpY2sgb2ZmIHdhaXRlciBzdGF0ZSBtYWNoaW5lXG4gIGF3YWl0IHN0YXJ0RXhlY3V0aW9uKHdhaXRlcik7XG59XG5cbi8vIGludm9rZWQgYSBmZXcgdGltZXMgdW50aWwgYGNvbXBsZXRlYCBpcyB0cnVlIG9yIHVudGlsIGl0IHRpbWVzIG91dC5cbmFzeW5jIGZ1bmN0aW9uIGlzQ29tcGxldGUoZXZlbnQ6IEFXU0NES0FzeW5jQ3VzdG9tUmVzb3VyY2UuSXNDb21wbGV0ZVJlcXVlc3QpIHtcbiAgbG9nKCdpc0NvbXBsZXRlJywgZXZlbnQpO1xuXG4gIGNvbnN0IGlzQ29tcGxldGVSZXN1bHQgPSBhd2FpdCBpbnZva2VVc2VyRnVuY3Rpb24oY29uc3RzLlVTRVJfSVNfQ09NUExFVEVfRlVOQ1RJT05fQVJOX0VOViwgZXZlbnQpIGFzIElzQ29tcGxldGVSZXNwb25zZTtcbiAgbG9nKCd1c2VyIGlzQ29tcGxldGUgcmV0dXJuZWQ6JywgaXNDb21wbGV0ZVJlc3VsdCk7XG5cbiAgLy8gaWYgd2UgYXJlIG5vdCBjb21wbGV0ZSwgcmV0dXJuIGZhbHNlLCBhbmQgZG9uJ3Qgc2VuZCBhIHJlc3BvbnNlIGJhY2suXG4gIGlmICghaXNDb21wbGV0ZVJlc3VsdC5Jc0NvbXBsZXRlKSB7XG4gICAgaWYgKGlzQ29tcGxldGVSZXN1bHQuRGF0YSAmJiBPYmplY3Qua2V5cyhpc0NvbXBsZXRlUmVzdWx0LkRhdGEpLmxlbmd0aCA+IDApIHtcbiAgICAgIHRocm93IG5ldyBFcnJvcignXCJEYXRhXCIgaXMgbm90IGFsbG93ZWQgaWYgXCJJc0NvbXBsZXRlXCIgaXMgXCJGYWxzZVwiJyk7XG4gICAgfVxuXG4gICAgdGhyb3cgbmV3IGNmblJlc3BvbnNlLlJldHJ5KEpTT04uc3RyaW5naWZ5KGV2ZW50KSk7XG4gIH1cblxuICBjb25zdCByZXNwb25zZSA9IHtcbiAgICAuLi5ldmVudCxcbiAgICAuLi5pc0NvbXBsZXRlUmVzdWx0LFxuICAgIERhdGE6IHtcbiAgICAgIC4uLmV2ZW50LkRhdGEsXG4gICAgICAuLi5pc0NvbXBsZXRlUmVzdWx0LkRhdGEsXG4gICAgfSxcbiAgfTtcblxuICBhd2FpdCBjZm5SZXNwb25zZS5zdWJtaXRSZXNwb25zZSgnU1VDQ0VTUycsIHJlc3BvbnNlLCB7IG5vRWNobzogZXZlbnQuTm9FY2hvIH0pO1xufVxuXG4vLyBpbnZva2VkIHdoZW4gY29tcGxldGlvbiByZXRyaWVzIGFyZSBleGhhdXNlZC5cbmFzeW5jIGZ1bmN0aW9uIG9uVGltZW91dCh0aW1lb3V0RXZlbnQ6IGFueSkge1xuICBsb2coJ3RpbWVvdXRIYW5kbGVyJywgdGltZW91dEV2ZW50KTtcblxuICBjb25zdCBpc0NvbXBsZXRlUmVxdWVzdCA9IEpTT04ucGFyc2UoSlNPTi5wYXJzZSh0aW1lb3V0RXZlbnQuQ2F1c2UpLmVycm9yTWVzc2FnZSkgYXMgQVdTQ0RLQXN5bmNDdXN0b21SZXNvdXJjZS5Jc0NvbXBsZXRlUmVxdWVzdDtcbiAgYXdhaXQgY2ZuUmVzcG9uc2Uuc3VibWl0UmVzcG9uc2UoJ0ZBSUxFRCcsIGlzQ29tcGxldGVSZXF1ZXN0LCB7XG4gICAgcmVhc29uOiAnT3BlcmF0aW9uIHRpbWVkIG91dCcsXG4gIH0pO1xufVxuXG5hc3luYyBmdW5jdGlvbiBpbnZva2VVc2VyRnVuY3Rpb24oZnVuY3Rpb25Bcm5FbnY6IHN0cmluZywgcGF5bG9hZDogYW55KSB7XG4gIGNvbnN0IGZ1bmN0aW9uQXJuID0gZ2V0RW52KGZ1bmN0aW9uQXJuRW52KTtcbiAgbG9nKGBleGVjdXRpbmcgdXNlciBmdW5jdGlvbiAke2Z1bmN0aW9uQXJufSB3aXRoIHBheWxvYWRgLCBwYXlsb2FkKTtcblxuICAvLyB0cmFuc2llbnQgZXJyb3JzIHN1Y2ggYXMgdGltZW91dHMsIHRocm90dGxpbmcgZXJyb3JzICg0MjkpLCBhbmQgb3RoZXJcbiAgLy8gZXJyb3JzIHRoYXQgYXJlbid0IGNhdXNlZCBieSBhIGJhZCByZXF1ZXN0ICg1MDAgc2VyaWVzKSBhcmUgcmV0cmllZFxuICAvLyBhdXRvbWF0aWNhbGx5IGJ5IHRoZSBKYXZhU2NyaXB0IFNESy5cbiAgY29uc3QgcmVzcCA9IGF3YWl0IGludm9rZUZ1bmN0aW9uKHtcbiAgICBGdW5jdGlvbk5hbWU6IGZ1bmN0aW9uQXJuLFxuICAgIFBheWxvYWQ6IEpTT04uc3RyaW5naWZ5KHBheWxvYWQpLFxuICB9KTtcblxuICBsb2coJ3VzZXIgZnVuY3Rpb24gcmVzcG9uc2U6JywgcmVzcCwgdHlwZW9mKHJlc3ApKTtcblxuICBjb25zdCBqc29uUGF5bG9hZCA9IHBhcnNlSnNvblBheWxvYWQocmVzcC5QYXlsb2FkKTtcbiAgaWYgKHJlc3AuRnVuY3Rpb25FcnJvcikge1xuICAgIGxvZygndXNlciBmdW5jdGlvbiB0aHJldyBhbiBlcnJvcjonLCByZXNwLkZ1bmN0aW9uRXJyb3IpO1xuXG4gICAgY29uc3QgZXJyb3JNZXNzYWdlID0ganNvblBheWxvYWQuZXJyb3JNZXNzYWdlIHx8ICdlcnJvcic7XG5cbiAgICAvLyBwYXJzZSBmdW5jdGlvbiBuYW1lIGZyb20gYXJuXG4gICAgLy8gYXJuOiR7UGFydGl0aW9ufTpsYW1iZGE6JHtSZWdpb259OiR7QWNjb3VudH06ZnVuY3Rpb246JHtGdW5jdGlvbk5hbWV9XG4gICAgY29uc3QgYXJuID0gZnVuY3Rpb25Bcm4uc3BsaXQoJzonKTtcbiAgICBjb25zdCBmdW5jdGlvbk5hbWUgPSBhcm5bYXJuLmxlbmd0aCAtIDFdO1xuXG4gICAgLy8gYXBwZW5kIGEgcmVmZXJlbmNlIHRvIHRoZSBsb2cgZ3JvdXAuXG4gICAgY29uc3QgbWVzc2FnZSA9IFtcbiAgICAgIGVycm9yTWVzc2FnZSxcbiAgICAgICcnLFxuICAgICAgYExvZ3M6IC9hd3MvbGFtYmRhLyR7ZnVuY3Rpb25OYW1lfWAsIC8vIGNsb3Vkd2F0Y2ggbG9nIGdyb3VwXG4gICAgICAnJyxcbiAgICBdLmpvaW4oJ1xcbicpO1xuXG4gICAgY29uc3QgZSA9IG5ldyBFcnJvcihtZXNzYWdlKTtcblxuICAgIC8vIHRoZSBvdXRwdXQgdGhhdCBnb2VzIHRvIENGTiBpcyB3aGF0J3MgaW4gYHN0YWNrYCwgbm90IHRoZSBlcnJvciBtZXNzYWdlLlxuICAgIC8vIGlmIHdlIGhhdmUgYSByZW1vdGUgdHJhY2UsIGNvbnN0cnVjdCBhIG5pY2UgbWVzc2FnZSB3aXRoIGxvZyBncm91cCBpbmZvcm1hdGlvblxuICAgIGlmIChqc29uUGF5bG9hZC50cmFjZSkge1xuICAgICAgLy8gc2tpcCBmaXJzdCB0cmFjZSBsaW5lIGJlY2F1c2UgaXQncyB0aGUgbWVzc2FnZVxuICAgICAgZS5zdGFjayA9IFttZXNzYWdlLCAuLi5qc29uUGF5bG9hZC50cmFjZS5zbGljZSgxKV0uam9pbignXFxuJyk7XG4gICAgfVxuXG4gICAgdGhyb3cgZTtcbiAgfVxuXG4gIHJldHVybiBqc29uUGF5bG9hZDtcbn1cblxuZnVuY3Rpb24gcGFyc2VKc29uUGF5bG9hZChwYXlsb2FkOiBhbnkpOiBhbnkge1xuICBpZiAoIXBheWxvYWQpIHsgcmV0dXJuIHsgfTsgfVxuICBjb25zdCB0ZXh0ID0gcGF5bG9hZC50b1N0cmluZygpO1xuICB0cnkge1xuICAgIHJldHVybiBKU09OLnBhcnNlKHRleHQpO1xuICB9IGNhdGNoIChlKSB7XG4gICAgdGhyb3cgbmV3IEVycm9yKGByZXR1cm4gdmFsdWVzIGZyb20gdXNlci1oYW5kbGVycyBtdXN0IGJlIEpTT04gb2JqZWN0cy4gZ290OiBcIiR7dGV4dH1cImApO1xuICB9XG59XG5cbmZ1bmN0aW9uIGNyZWF0ZVJlc3BvbnNlRXZlbnQoY2ZuUmVxdWVzdDogQVdTTGFtYmRhLkNsb3VkRm9ybWF0aW9uQ3VzdG9tUmVzb3VyY2VFdmVudCwgb25FdmVudFJlc3VsdDogT25FdmVudFJlc3BvbnNlKTogQVdTQ0RLQXN5bmNDdXN0b21SZXNvdXJjZS5Jc0NvbXBsZXRlUmVxdWVzdCB7XG4gIC8vXG4gIC8vIHZhbGlkYXRlIHRoYXQgb25FdmVudFJlc3VsdCBhbHdheXMgaW5jbHVkZXMgYSBQaHlzaWNhbFJlc291cmNlSWRcblxuICBvbkV2ZW50UmVzdWx0ID0gb25FdmVudFJlc3VsdCB8fCB7IH07XG5cbiAgLy8gaWYgcGh5c2ljYWwgSUQgaXMgbm90IHJldHVybmVkLCB3ZSBoYXZlIHNvbWUgZGVmYXVsdHMgZm9yIHlvdSBiYXNlZFxuICAvLyBvbiB0aGUgcmVxdWVzdCB0eXBlLlxuICBjb25zdCBwaHlzaWNhbFJlc291cmNlSWQgPSBvbkV2ZW50UmVzdWx0LlBoeXNpY2FsUmVzb3VyY2VJZCB8fCBkZWZhdWx0UGh5c2ljYWxSZXNvdXJjZUlkKGNmblJlcXVlc3QpO1xuXG4gIC8vIGlmIHdlIGFyZSBpbiBERUxFVEUgYW5kIHBoeXNpY2FsIElEIHdhcyBjaGFuZ2VkLCBpdCdzIGFuIGVycm9yLlxuICBpZiAoY2ZuUmVxdWVzdC5SZXF1ZXN0VHlwZSA9PT0gJ0RlbGV0ZScgJiYgcGh5c2ljYWxSZXNvdXJjZUlkICE9PSBjZm5SZXF1ZXN0LlBoeXNpY2FsUmVzb3VyY2VJZCkge1xuICAgIHRocm93IG5ldyBFcnJvcihgREVMRVRFOiBjYW5ub3QgY2hhbmdlIHRoZSBwaHlzaWNhbCByZXNvdXJjZSBJRCBmcm9tIFwiJHtjZm5SZXF1ZXN0LlBoeXNpY2FsUmVzb3VyY2VJZH1cIiB0byBcIiR7b25FdmVudFJlc3VsdC5QaHlzaWNhbFJlc291cmNlSWR9XCIgZHVyaW5nIGRlbGV0aW9uYCk7XG4gIH1cblxuICAvLyBpZiB3ZSBhcmUgaW4gVVBEQVRFIGFuZCBwaHlzaWNhbCBJRCB3YXMgY2hhbmdlZCwgaXQncyBhIHJlcGxhY2VtZW50IChqdXN0IGxvZylcbiAgaWYgKGNmblJlcXVlc3QuUmVxdWVzdFR5cGUgPT09ICdVcGRhdGUnICYmIHBoeXNpY2FsUmVzb3VyY2VJZCAhPT0gY2ZuUmVxdWVzdC5QaHlzaWNhbFJlc291cmNlSWQpIHtcbiAgICBsb2coYFVQREFURTogY2hhbmdpbmcgcGh5c2ljYWwgcmVzb3VyY2UgSUQgZnJvbSBcIiR7Y2ZuUmVxdWVzdC5QaHlzaWNhbFJlc291cmNlSWR9XCIgdG8gXCIke29uRXZlbnRSZXN1bHQuUGh5c2ljYWxSZXNvdXJjZUlkfVwiYCk7XG4gIH1cblxuICAvLyBtZXJnZSByZXF1ZXN0IGV2ZW50IGFuZCByZXN1bHQgZXZlbnQgKHJlc3VsdCBwcmV2YWlscykuXG4gIHJldHVybiB7XG4gICAgLi4uY2ZuUmVxdWVzdCxcbiAgICAuLi5vbkV2ZW50UmVzdWx0LFxuICAgIFBoeXNpY2FsUmVzb3VyY2VJZDogcGh5c2ljYWxSZXNvdXJjZUlkLFxuICB9O1xufVxuXG4vKipcbiAqIENhbGN1bGF0ZXMgdGhlIGRlZmF1bHQgcGh5c2ljYWwgcmVzb3VyY2UgSUQgYmFzZWQgaW4gY2FzZSB1c2VyIGhhbmRsZXIgZGlkXG4gKiBub3QgcmV0dXJuIGEgUGh5c2ljYWxSZXNvdXJjZUlkLlxuICpcbiAqIEZvciBcIkNSRUFURVwiLCBpdCB1c2VzIHRoZSBSZXF1ZXN0SWQuXG4gKiBGb3IgXCJVUERBVEVcIiBhbmQgXCJERUxFVEVcIiBhbmQgcmV0dXJucyB0aGUgY3VycmVudCBQaHlzaWNhbFJlc291cmNlSWQgKHRoZSBvbmUgcHJvdmlkZWQgaW4gYGV2ZW50YCkuXG4gKi9cbmZ1bmN0aW9uIGRlZmF1bHRQaHlzaWNhbFJlc291cmNlSWQocmVxOiBBV1NMYW1iZGEuQ2xvdWRGb3JtYXRpb25DdXN0b21SZXNvdXJjZUV2ZW50KTogc3RyaW5nIHtcbiAgc3dpdGNoIChyZXEuUmVxdWVzdFR5cGUpIHtcbiAgICBjYXNlICdDcmVhdGUnOlxuICAgICAgcmV0dXJuIHJlcS5SZXF1ZXN0SWQ7XG5cbiAgICBjYXNlICdVcGRhdGUnOlxuICAgIGNhc2UgJ0RlbGV0ZSc6XG4gICAgICByZXR1cm4gcmVxLlBoeXNpY2FsUmVzb3VyY2VJZDtcblxuICAgIGRlZmF1bHQ6XG4gICAgICB0aHJvdyBuZXcgRXJyb3IoYEludmFsaWQgXCJSZXF1ZXN0VHlwZVwiIGluIHJlcXVlc3QgXCIke0pTT04uc3RyaW5naWZ5KHJlcSl9XCJgKTtcbiAgfVxufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9/outbound.js b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9/outbound.js deleted file mode 100644 index 70203dcc42f3f..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9/outbound.js +++ /dev/null @@ -1,45 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.httpRequest = exports.invokeFunction = exports.startExecution = void 0; -/* istanbul ignore file */ -const https = require("https"); -// eslint-disable-next-line import/no-extraneous-dependencies -const AWS = require("aws-sdk"); -const FRAMEWORK_HANDLER_TIMEOUT = 900000; // 15 minutes -// In order to honor the overall maximum timeout set for the target process, -// the default 2 minutes from AWS SDK has to be overriden: -// https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html#httpOptions-property -const awsSdkConfig = { - httpOptions: { timeout: FRAMEWORK_HANDLER_TIMEOUT }, -}; -async function defaultHttpRequest(options, responseBody) { - return new Promise((resolve, reject) => { - try { - const request = https.request(options, resolve); - request.on('error', reject); - request.write(responseBody); - request.end(); - } - catch (e) { - reject(e); - } - }); -} -let sfn; -let lambda; -async function defaultStartExecution(req) { - if (!sfn) { - sfn = new AWS.StepFunctions(awsSdkConfig); - } - return sfn.startExecution(req).promise(); -} -async function defaultInvokeFunction(req) { - if (!lambda) { - lambda = new AWS.Lambda(awsSdkConfig); - } - return lambda.invoke(req).promise(); -} -exports.startExecution = defaultStartExecution; -exports.invokeFunction = defaultInvokeFunction; -exports.httpRequest = defaultHttpRequest; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3V0Ym91bmQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJvdXRib3VuZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwwQkFBMEI7QUFDMUIsK0JBQStCO0FBQy9CLDZEQUE2RDtBQUM3RCwrQkFBK0I7QUFJL0IsTUFBTSx5QkFBeUIsR0FBRyxNQUFNLENBQUMsQ0FBQyxhQUFhO0FBRXZELDRFQUE0RTtBQUM1RSwwREFBMEQ7QUFDMUQsMkZBQTJGO0FBQzNGLE1BQU0sWUFBWSxHQUF5QjtJQUN6QyxXQUFXLEVBQUUsRUFBRSxPQUFPLEVBQUUseUJBQXlCLEVBQUU7Q0FDcEQsQ0FBQztBQUVGLEtBQUssVUFBVSxrQkFBa0IsQ0FBQyxPQUE2QixFQUFFLFlBQW9CO0lBQ25GLE9BQU8sSUFBSSxPQUFPLENBQUMsQ0FBQyxPQUFPLEVBQUUsTUFBTSxFQUFFLEVBQUU7UUFDckMsSUFBSTtZQUNGLE1BQU0sT0FBTyxHQUFHLEtBQUssQ0FBQyxPQUFPLENBQUMsT0FBTyxFQUFFLE9BQU8sQ0FBQyxDQUFDO1lBQ2hELE9BQU8sQ0FBQyxFQUFFLENBQUMsT0FBTyxFQUFFLE1BQU0sQ0FBQyxDQUFDO1lBQzVCLE9BQU8sQ0FBQyxLQUFLLENBQUMsWUFBWSxDQUFDLENBQUM7WUFDNUIsT0FBTyxDQUFDLEdBQUcsRUFBRSxDQUFDO1NBQ2Y7UUFBQyxPQUFPLENBQUMsRUFBRTtZQUNWLE1BQU0sQ0FBQyxDQUFDLENBQUMsQ0FBQztTQUNYO0lBQ0gsQ0FBQyxDQUFDLENBQUM7QUFDTCxDQUFDO0FBRUQsSUFBSSxHQUFzQixDQUFDO0FBQzNCLElBQUksTUFBa0IsQ0FBQztBQUV2QixLQUFLLFVBQVUscUJBQXFCLENBQUMsR0FBMEM7SUFDN0UsSUFBSSxDQUFDLEdBQUcsRUFBRTtRQUNSLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxhQUFhLENBQUMsWUFBWSxDQUFDLENBQUM7S0FDM0M7SUFFRCxPQUFPLEdBQUcsQ0FBQyxjQUFjLENBQUMsR0FBRyxDQUFDLENBQUMsT0FBTyxFQUFFLENBQUM7QUFDM0MsQ0FBQztBQUVELEtBQUssVUFBVSxxQkFBcUIsQ0FBQyxHQUFpQztJQUNwRSxJQUFJLENBQUMsTUFBTSxFQUFFO1FBQ1gsTUFBTSxHQUFHLElBQUksR0FBRyxDQUFDLE1BQU0sQ0FBQyxZQUFZLENBQUMsQ0FBQztLQUN2QztJQUVELE9BQU8sTUFBTSxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsQ0FBQyxPQUFPLEVBQUUsQ0FBQztBQUN0QyxDQUFDO0FBRVUsUUFBQSxjQUFjLEdBQUcscUJBQXFCLENBQUM7QUFDdkMsUUFBQSxjQUFjLEdBQUcscUJBQXFCLENBQUM7QUFDdkMsUUFBQSxXQUFXLEdBQUcsa0JBQWtCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKiBpc3RhbmJ1bCBpZ25vcmUgZmlsZSAqL1xuaW1wb3J0ICogYXMgaHR0cHMgZnJvbSAnaHR0cHMnO1xuLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIGltcG9ydC9uby1leHRyYW5lb3VzLWRlcGVuZGVuY2llc1xuaW1wb3J0ICogYXMgQVdTIGZyb20gJ2F3cy1zZGsnO1xuLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIGltcG9ydC9uby1leHRyYW5lb3VzLWRlcGVuZGVuY2llc1xuaW1wb3J0IHR5cGUgeyBDb25maWd1cmF0aW9uT3B0aW9ucyB9IGZyb20gJ2F3cy1zZGsvbGliL2NvbmZpZy1iYXNlJztcblxuY29uc3QgRlJBTUVXT1JLX0hBTkRMRVJfVElNRU9VVCA9IDkwMDAwMDsgLy8gMTUgbWludXRlc1xuXG4vLyBJbiBvcmRlciB0byBob25vciB0aGUgb3ZlcmFsbCBtYXhpbXVtIHRpbWVvdXQgc2V0IGZvciB0aGUgdGFyZ2V0IHByb2Nlc3MsXG4vLyB0aGUgZGVmYXVsdCAyIG1pbnV0ZXMgZnJvbSBBV1MgU0RLIGhhcyB0byBiZSBvdmVycmlkZW46XG4vLyBodHRwczovL2RvY3MuYXdzLmFtYXpvbi5jb20vQVdTSmF2YVNjcmlwdFNESy9sYXRlc3QvQVdTL0NvbmZpZy5odG1sI2h0dHBPcHRpb25zLXByb3BlcnR5XG5jb25zdCBhd3NTZGtDb25maWc6IENvbmZpZ3VyYXRpb25PcHRpb25zID0ge1xuICBodHRwT3B0aW9uczogeyB0aW1lb3V0OiBGUkFNRVdPUktfSEFORExFUl9USU1FT1VUIH0sXG59O1xuXG5hc3luYyBmdW5jdGlvbiBkZWZhdWx0SHR0cFJlcXVlc3Qob3B0aW9uczogaHR0cHMuUmVxdWVzdE9wdGlvbnMsIHJlc3BvbnNlQm9keTogc3RyaW5nKSB7XG4gIHJldHVybiBuZXcgUHJvbWlzZSgocmVzb2x2ZSwgcmVqZWN0KSA9PiB7XG4gICAgdHJ5IHtcbiAgICAgIGNvbnN0IHJlcXVlc3QgPSBodHRwcy5yZXF1ZXN0KG9wdGlvbnMsIHJlc29sdmUpO1xuICAgICAgcmVxdWVzdC5vbignZXJyb3InLCByZWplY3QpO1xuICAgICAgcmVxdWVzdC53cml0ZShyZXNwb25zZUJvZHkpO1xuICAgICAgcmVxdWVzdC5lbmQoKTtcbiAgICB9IGNhdGNoIChlKSB7XG4gICAgICByZWplY3QoZSk7XG4gICAgfVxuICB9KTtcbn1cblxubGV0IHNmbjogQVdTLlN0ZXBGdW5jdGlvbnM7XG5sZXQgbGFtYmRhOiBBV1MuTGFtYmRhO1xuXG5hc3luYyBmdW5jdGlvbiBkZWZhdWx0U3RhcnRFeGVjdXRpb24ocmVxOiBBV1MuU3RlcEZ1bmN0aW9ucy5TdGFydEV4ZWN1dGlvbklucHV0KTogUHJvbWlzZTxBV1MuU3RlcEZ1bmN0aW9ucy5TdGFydEV4ZWN1dGlvbk91dHB1dD4ge1xuICBpZiAoIXNmbikge1xuICAgIHNmbiA9IG5ldyBBV1MuU3RlcEZ1bmN0aW9ucyhhd3NTZGtDb25maWcpO1xuICB9XG5cbiAgcmV0dXJuIHNmbi5zdGFydEV4ZWN1dGlvbihyZXEpLnByb21pc2UoKTtcbn1cblxuYXN5bmMgZnVuY3Rpb24gZGVmYXVsdEludm9rZUZ1bmN0aW9uKHJlcTogQVdTLkxhbWJkYS5JbnZvY2F0aW9uUmVxdWVzdCk6IFByb21pc2U8QVdTLkxhbWJkYS5JbnZvY2F0aW9uUmVzcG9uc2U+IHtcbiAgaWYgKCFsYW1iZGEpIHtcbiAgICBsYW1iZGEgPSBuZXcgQVdTLkxhbWJkYShhd3NTZGtDb25maWcpO1xuICB9XG5cbiAgcmV0dXJuIGxhbWJkYS5pbnZva2UocmVxKS5wcm9taXNlKCk7XG59XG5cbmV4cG9ydCBsZXQgc3RhcnRFeGVjdXRpb24gPSBkZWZhdWx0U3RhcnRFeGVjdXRpb247XG5leHBvcnQgbGV0IGludm9rZUZ1bmN0aW9uID0gZGVmYXVsdEludm9rZUZ1bmN0aW9uO1xuZXhwb3J0IGxldCBodHRwUmVxdWVzdCA9IGRlZmF1bHRIdHRwUmVxdWVzdDtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9/util.js b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9/util.js deleted file mode 100644 index ee4c6e9c9ddeb..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9/util.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -/* eslint-disable no-console */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.log = exports.getEnv = void 0; -function getEnv(name) { - const value = process.env[name]; - if (!value) { - throw new Error(`The environment variable "${name}" is not defined`); - } - return value; -} -exports.getEnv = getEnv; -function log(title, ...args) { - console.log('[provider-framework]', title, ...args.map(x => typeof (x) === 'object' ? JSON.stringify(x, undefined, 2) : x)); -} -exports.log = log; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInV0aWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLCtCQUErQjs7O0FBRS9CLFNBQWdCLE1BQU0sQ0FBQyxJQUFZO0lBQ2pDLE1BQU0sS0FBSyxHQUFHLE9BQU8sQ0FBQyxHQUFHLENBQUMsSUFBSSxDQUFDLENBQUM7SUFDaEMsSUFBSSxDQUFDLEtBQUssRUFBRTtRQUNWLE1BQU0sSUFBSSxLQUFLLENBQUMsNkJBQTZCLElBQUksa0JBQWtCLENBQUMsQ0FBQztLQUN0RTtJQUNELE9BQU8sS0FBSyxDQUFDO0FBQ2YsQ0FBQztBQU5ELHdCQU1DO0FBRUQsU0FBZ0IsR0FBRyxDQUFDLEtBQVUsRUFBRSxHQUFHLElBQVc7SUFDNUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxzQkFBc0IsRUFBRSxLQUFLLEVBQUUsR0FBRyxJQUFJLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUMsT0FBTSxDQUFDLENBQUMsQ0FBQyxLQUFLLFFBQVEsQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLFNBQVMsQ0FBQyxDQUFDLEVBQUUsU0FBUyxFQUFFLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO0FBQzdILENBQUM7QUFGRCxrQkFFQyIsInNvdXJjZXNDb250ZW50IjpbIi8qIGVzbGludC1kaXNhYmxlIG5vLWNvbnNvbGUgKi9cblxuZXhwb3J0IGZ1bmN0aW9uIGdldEVudihuYW1lOiBzdHJpbmcpOiBzdHJpbmcge1xuICBjb25zdCB2YWx1ZSA9IHByb2Nlc3MuZW52W25hbWVdO1xuICBpZiAoIXZhbHVlKSB7XG4gICAgdGhyb3cgbmV3IEVycm9yKGBUaGUgZW52aXJvbm1lbnQgdmFyaWFibGUgXCIke25hbWV9XCIgaXMgbm90IGRlZmluZWRgKTtcbiAgfVxuICByZXR1cm4gdmFsdWU7XG59XG5cbmV4cG9ydCBmdW5jdGlvbiBsb2codGl0bGU6IGFueSwgLi4uYXJnczogYW55W10pIHtcbiAgY29uc29sZS5sb2coJ1twcm92aWRlci1mcmFtZXdvcmtdJywgdGl0bGUsIC4uLmFyZ3MubWFwKHggPT4gdHlwZW9mKHgpID09PSAnb2JqZWN0JyA/IEpTT04uc3RyaW5naWZ5KHgsIHVuZGVmaW5lZCwgMikgOiB4KSk7XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/.style.yapf b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/.style.yapf deleted file mode 100644 index 72e1005523a92..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/.style.yapf +++ /dev/null @@ -1,6 +0,0 @@ -# Format using: yapf -ri . -# Since you're here, unit test using: python -m unittest discover -[style] -based_on_style = pep8 -column_limit = 120 -SPLIT_BEFORE_NAMED_ASSIGNS = False diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/Pipfile b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/Pipfile deleted file mode 100644 index 27927581bc218..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/Pipfile +++ /dev/null @@ -1,14 +0,0 @@ -[[source]] -url = "https://pypi.python.org/simple" -verify_ssl = true -name = "pypi" - -[packages] - -[dev-packages] -yapf = "*" -boto3 = "*" -coverage = "*" - -[requires] -python_version = "3.8" diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/Pipfile.lock b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/Pipfile.lock deleted file mode 100644 index 37b1c47e3d5e7..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/Pipfile.lock +++ /dev/null @@ -1,138 +0,0 @@ -{ - "_meta": { - "hash": { - "sha256": "62f31cd5a0266aa03d564dff455c3c2fd49b3e086ede177a42d574a15789fbda" - }, - "pipfile-spec": 6, - "requires": { - "python_version": "3.8" - }, - "sources": [ - { - "name": "pypi", - "url": "https://pypi.python.org/simple", - "verify_ssl": true - } - ] - }, - "default": {}, - "develop": { - "boto3": { - "hashes": [ - "sha256:76b3ee0d1dd860c9218bc864cd29f1ee986f6e1e75e8669725dd3c411039379e", - "sha256:c39cb6ed376ba1d4689ac8f6759a2b2d8a0b0424dbec0cd3af1558079bcf06e8" - ], - "index": "pypi", - "version": "==1.20.23" - }, - "botocore": { - "hashes": [ - "sha256:640b62110aa6d1c25553eceafb5bcd89aedeb84b191598d1f6492ad24374d285", - "sha256:7459766c4594f3b8877e8013f93f0dc6c6486acbeb7d9c9ae488396529cc2e84" - ], - "markers": "python_version >= '3.6'", - "version": "==1.23.23" - }, - "coverage": { - "hashes": [ - "sha256:01774a2c2c729619760320270e42cd9e797427ecfddd32c2a7b639cdc481f3c0", - "sha256:03b20e52b7d31be571c9c06b74746746d4eb82fc260e594dc662ed48145e9efd", - "sha256:0a7726f74ff63f41e95ed3a89fef002916c828bb5fcae83b505b49d81a066884", - "sha256:1219d760ccfafc03c0822ae2e06e3b1248a8e6d1a70928966bafc6838d3c9e48", - "sha256:13362889b2d46e8d9f97c421539c97c963e34031ab0cb89e8ca83a10cc71ac76", - "sha256:174cf9b4bef0db2e8244f82059a5a72bd47e1d40e71c68ab055425172b16b7d0", - "sha256:17e6c11038d4ed6e8af1407d9e89a2904d573be29d51515f14262d7f10ef0a64", - "sha256:215f8afcc02a24c2d9a10d3790b21054b58d71f4b3c6f055d4bb1b15cecce685", - "sha256:22e60a3ca5acba37d1d4a2ee66e051f5b0e1b9ac950b5b0cf4aa5366eda41d47", - "sha256:2641f803ee9f95b1f387f3e8f3bf28d83d9b69a39e9911e5bfee832bea75240d", - "sha256:276651978c94a8c5672ea60a2656e95a3cce2a3f31e9fb2d5ebd4c215d095840", - "sha256:3f7c17209eef285c86f819ff04a6d4cbee9b33ef05cbcaae4c0b4e8e06b3ec8f", - "sha256:3feac4084291642165c3a0d9eaebedf19ffa505016c4d3db15bfe235718d4971", - "sha256:49dbff64961bc9bdd2289a2bda6a3a5a331964ba5497f694e2cbd540d656dc1c", - "sha256:4e547122ca2d244f7c090fe3f4b5a5861255ff66b7ab6d98f44a0222aaf8671a", - "sha256:5829192582c0ec8ca4a2532407bc14c2f338d9878a10442f5d03804a95fac9de", - "sha256:5d6b09c972ce9200264c35a1d53d43ca55ef61836d9ec60f0d44273a31aa9f17", - "sha256:600617008aa82032ddeace2535626d1bc212dfff32b43989539deda63b3f36e4", - "sha256:619346d57c7126ae49ac95b11b0dc8e36c1dd49d148477461bb66c8cf13bb521", - "sha256:63c424e6f5b4ab1cf1e23a43b12f542b0ec2e54f99ec9f11b75382152981df57", - "sha256:6dbc1536e105adda7a6312c778f15aaabe583b0e9a0b0a324990334fd458c94b", - "sha256:6e1394d24d5938e561fbeaa0cd3d356207579c28bd1792f25a068743f2d5b282", - "sha256:86f2e78b1eff847609b1ca8050c9e1fa3bd44ce755b2ec30e70f2d3ba3844644", - "sha256:8bdfe9ff3a4ea37d17f172ac0dff1e1c383aec17a636b9b35906babc9f0f5475", - "sha256:8e2c35a4c1f269704e90888e56f794e2d9c0262fb0c1b1c8c4ee44d9b9e77b5d", - "sha256:92b8c845527eae547a2a6617d336adc56394050c3ed8a6918683646328fbb6da", - "sha256:9365ed5cce5d0cf2c10afc6add145c5037d3148585b8ae0e77cc1efdd6aa2953", - "sha256:9a29311bd6429be317c1f3fe4bc06c4c5ee45e2fa61b2a19d4d1d6111cb94af2", - "sha256:9a2b5b52be0a8626fcbffd7e689781bf8c2ac01613e77feda93d96184949a98e", - "sha256:a4bdeb0a52d1d04123b41d90a4390b096f3ef38eee35e11f0b22c2d031222c6c", - "sha256:a9c8c4283e17690ff1a7427123ffb428ad6a52ed720d550e299e8291e33184dc", - "sha256:b637c57fdb8be84e91fac60d9325a66a5981f8086c954ea2772efe28425eaf64", - "sha256:bf154ba7ee2fd613eb541c2bc03d3d9ac667080a737449d1a3fb342740eb1a74", - "sha256:c254b03032d5a06de049ce8bca8338a5185f07fb76600afff3c161e053d88617", - "sha256:c332d8f8d448ded473b97fefe4a0983265af21917d8b0cdcb8bb06b2afe632c3", - "sha256:c7912d1526299cb04c88288e148c6c87c0df600eca76efd99d84396cfe00ef1d", - "sha256:cfd9386c1d6f13b37e05a91a8583e802f8059bebfccde61a418c5808dea6bbfa", - "sha256:d5d2033d5db1d58ae2d62f095e1aefb6988af65b4b12cb8987af409587cc0739", - "sha256:dca38a21e4423f3edb821292e97cec7ad38086f84313462098568baedf4331f8", - "sha256:e2cad8093172b7d1595b4ad66f24270808658e11acf43a8f95b41276162eb5b8", - "sha256:e3db840a4dee542e37e09f30859f1612da90e1c5239a6a2498c473183a50e781", - "sha256:edcada2e24ed68f019175c2b2af2a8b481d3d084798b8c20d15d34f5c733fa58", - "sha256:f467bbb837691ab5a8ca359199d3429a11a01e6dfb3d9dcc676dc035ca93c0a9", - "sha256:f506af4f27def639ba45789fa6fde45f9a217da0be05f8910458e4557eed020c", - "sha256:f614fc9956d76d8a88a88bb41ddc12709caa755666f580af3a688899721efecd", - "sha256:f9afb5b746781fc2abce26193d1c817b7eb0e11459510fba65d2bd77fe161d9e", - "sha256:fb8b8ee99b3fffe4fd86f4c81b35a6bf7e4462cba019997af2fe679365db0c49" - ], - "index": "pypi", - "version": "==6.2" - }, - "jmespath": { - "hashes": [ - "sha256:b85d0567b8666149a93172712e68920734333c0ce7e89b78b3e987f71e5ed4f9", - "sha256:cdf6525904cc597730141d61b36f2e4b8ecc257c420fa2f4549bac2c2d0cb72f" - ], - "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==0.10.0" - }, - "python-dateutil": { - "hashes": [ - "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86", - "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==2.8.2" - }, - "s3transfer": { - "hashes": [ - "sha256:50ed823e1dc5868ad40c8dc92072f757aa0e653a192845c94a3b676f4a62da4c", - "sha256:9c1dc369814391a6bda20ebbf4b70a0f34630592c9aa520856bf384916af2803" - ], - "markers": "python_version >= '3.6'", - "version": "==0.5.0" - }, - "six": { - "hashes": [ - "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926", - "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==1.16.0" - }, - "urllib3": { - "hashes": [ - "sha256:4987c65554f7a2dbf30c18fd48778ef124af6fab771a377103da0585e2336ece", - "sha256:c4fdf4019605b6e5423637e01bc9fe4daef873709a7973e195ceba0a62bbc844" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'", - "version": "==1.26.7" - }, - "yapf": { - "hashes": [ - "sha256:408fb9a2b254c302f49db83c59f9aa0b4b0fd0ec25be3a5c51181327922ff63d", - "sha256:e3a234ba8455fe201eaa649cdac872d590089a18b661e39bbac7020978dd9c2e" - ], - "index": "pypi", - "version": "==0.31.0" - } - } -} diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/index.py b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/index.py deleted file mode 100644 index 790102022efed..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/index.py +++ /dev/null @@ -1,34 +0,0 @@ -import logging -import os - -import boto3 - -from lib.cleanup_resource_handler import CleanupResourceHandler -from lib.queue_handler import QueueHandler - -logging.getLogger().setLevel(logging.INFO) - - -def queue_handler(event, context): - """ - Handler for the event queue lambda trigger - """ - - ec2_client = boto3.client('ec2') - dynamodb_resource = boto3.resource('dynamodb') - route53_client = boto3.client('route53') - - handler = QueueHandler(ec2_client=ec2_client, dynamodb_resource=dynamodb_resource, route53_client=route53_client, - environ=os.environ) - - return handler.handle(event, context) - - -def cleanup_resource_handler(event, context): - """ - Event handler for the custom resource. - """ - - route53_client = boto3.client('route53') - handler = CleanupResourceHandler(route53_client=route53_client) - handler.handle_event(event, context) diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/lib/__init__.py b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/lib/__init__.py deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/lib/cleanup_resource_handler.py b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/lib/cleanup_resource_handler.py deleted file mode 100644 index 1ffde51b261c0..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/lib/cleanup_resource_handler.py +++ /dev/null @@ -1,51 +0,0 @@ -import time -from dataclasses import dataclass -import logging -from typing import Any - -from lib.route53 import Route53RecordSetAccessor, Route53RecordSetLocator - - -@dataclass -class CleanupResourceProperties: - HostedZoneId: str - RecordName: str - ServiceToken: str - - -class CleanupResourceHandler: - route53_client: Any - monitor_interval: int - - def __init__(self, route53_client, monitor_interval=5): - self.record_set_accessor = Route53RecordSetAccessor(route53_client=route53_client) - self.monitor_interval = monitor_interval - - def handle_event(self, event, context): - request_type = event['RequestType'] - resource_properties = event['ResourceProperties'] - logging.info(f'Handling a {request_type} event with properties {resource_properties}') - - # Decode resource properties right away so that mis-configured - # properties will always fail quickly. - resource_properties = CleanupResourceProperties(**resource_properties) - - if request_type == 'Delete': - return self.on_delete(resource_properties) - - def on_delete(self, resource_properties: CleanupResourceProperties): - locator = Route53RecordSetLocator(hosted_zone_id=resource_properties.HostedZoneId, - record_name=resource_properties.RecordName) - - deleted = self.record_set_accessor.delete(locator=locator) - - if deleted: - logging.info(f'Monitoring for the record deletion') - for interval_number in range(1, 10): - if not self.record_set_accessor.exists(locator): - logging.info(f'The record has been deleted') - return - else: - logging.info(f'The record still exists') - if self.monitor_interval > 0: - time.sleep(self.monitor_interval) diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/lib/events.py b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/lib/events.py deleted file mode 100644 index aa34343a00170..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/lib/events.py +++ /dev/null @@ -1,15 +0,0 @@ -from lib.records import TaskInfo, EniInfo - - -def extract_event_task_info(task_description) -> TaskInfo: - arn = task_description['taskArn'] - - # Parse the eni info out of the the attachments - enis = [ - EniInfo(eni_id=detail['value']) for network_interface in task_description['attachments'] - if network_interface['type'] == 'eni' for detail in network_interface['details'] - if detail['name'] == 'networkInterfaceId' - ] - - # Create an object out of the extracted information - return TaskInfo(task_arn=arn, enis=enis) \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/lib/queue_handler.py b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/lib/queue_handler.py deleted file mode 100644 index db56b4c898264..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/lib/queue_handler.py +++ /dev/null @@ -1,117 +0,0 @@ -import json -import logging -from typing import Any - -from lib.events import extract_event_task_info -from lib.records import DdbRecordKey, DdbRecord -from lib.records_table import RecordsTableAccessor, RecordUpdate -from lib.route53 import Route53RecordSetLocator, Route53RecordSetAccessor -from lib.running_task_collector import RunningTaskCollector - - -class QueueHandler: - def __init__(self, ec2_client, route53_client, dynamodb_resource, environ): - self.ec2_client = ec2_client - self.route53_client = route53_client - - hosted_zone_id = environ['HOSTED_ZONE_ID'] - record_name = environ['RECORD_NAME'] - records_table = environ['RECORDS_TABLE'] - - cluster_arn = environ['CLUSTER_ARN'] - self.service_name = environ['SERVICE_NAME'] - - self.records_table_key = DdbRecordKey(cluster_arn=cluster_arn, service_name=self.service_name) - self.records_table_accessor = RecordsTableAccessor(table_client=dynamodb_resource.Table(records_table)) - - self.record_set_locator = Route53RecordSetLocator(hosted_zone_id=hosted_zone_id, record_name=record_name) - self.record_set_accessor = Route53RecordSetAccessor(route53_client=self.route53_client) - - def handle(self, event, context): - logging.info(f'event = {json.dumps(event)}') - - # Get a reference record from the records table to check for incoming - # event inconsistencies. - reference_record = self.records_table_accessor.get_record(self.records_table_key) - - # Collect running and stopped tasks from the status change events - running_tasks, stopped_tasks = self.collect_event_task_info(event, reference_record) - - # Build up a set of updates for the record - update = RecordUpdate(running_tasks=running_tasks, stopped_tasks=stopped_tasks) - - # Record the current record set locator - update.current_record_set(self.record_set_locator) - - # Clean any extra record sets in case the recordset has moved. - for record_set_locator in reference_record.record_sets: - if not record_set_locator.matches(self.record_set_locator): - update.extra_record_set(record_set_locator) - self.try_to_delete_record(record_set_locator) - - # Introduce some delay - # records_table.optimistic_simulation_delay = 5 - - # Update the record - ddb_record = self.records_table_accessor.put_update(key=self.records_table_key, update=update) - - # Update DNS - self.record_set_accessor.update(locator=self.record_set_locator, ipv4s=ddb_record.ipv4s) - - def collect_event_task_info(self, event, reference_record: DdbRecord): - running_task_collector = RunningTaskCollector(ec2_client=self.ec2_client, reference_record=reference_record) - stopped_tasks = [] - for message in decode_records(event): - if 'details' not in message: - logging.info(f'Received a non-task state message {message}') - continue - - task_description = message['details'] - - group = task_description['group'] - if group != f'service:{self.service_name}': - logging.info(f'Skipping irrelevant task description from group {group}') - continue - - task_info = extract_event_task_info(task_description) - logging.info(f'extracted task_info = {task_info}') - - last_status = task_description['lastStatus'] - if last_status == 'RUNNING': - logging.info(f'Collecting {task_info.task_arn} as running') - running_task_collector.collect(task_info) - - elif last_status == 'STOPPED': - logging.info(f'Collecting {task_info.task_arn} as stopped') - stopped_tasks.append(task_info) - - else: - logging.warning(f'{task_info.task_arn} had an unexpected status: {last_status}') - - # Query the ENIs store-back public IPs. - running_task_collector.fill_eni_info_from_eni_query() - - running_tasks = running_task_collector.tasks - - return running_tasks, stopped_tasks - - def try_to_delete_record(self, record_set_locator: Route53RecordSetLocator): - """ - Try to delete the given record set. This may not be possible if the - record is in a hosted zone we don't have access to. This may happen - when the user changes dns zones at the service extension level. - """ - - try: - self.record_set_accessor.delete(record_set_locator) - - except: - # We give up pretty easily if the record set accessor can't delete - # the extraneous record for any reason that the accessor can't - # handle. - logging.warning(f'Could not delete the extraneous record set {record_set_locator}') - - -def decode_records(sqs_event): - logging.info(f'sqs_event = {json.dumps(sqs_event)}') - return [json.loads(sqs_record['body']) for sqs_record in sqs_event['Records']] diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/lib/records.py b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/lib/records.py deleted file mode 100644 index a6a1f2a374ab0..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/lib/records.py +++ /dev/null @@ -1,185 +0,0 @@ -from dataclasses import dataclass, field -from datetime import datetime -from typing import Optional, List, Dict, Set - -from boto3.dynamodb.conditions import Key - -from lib.route53 import Route53RecordSetLocator - - -@dataclass -class EniInfo: - eni_id: str - public_ipv4: Optional[str] = None - - -@dataclass -class TaskInfo: - task_arn: str - enis: List[EniInfo] - stopped_datetime: Optional[datetime] = None - - # Tombstone information for the dynamodb record. - - def set_stopped_marker(self): - """ - Mark this task as stopped. - """ - self.stopped_datetime = datetime.utcnow() - - def is_stopped(self): - """ - Check if this task is stopped. - """ - return True if self.stopped_datetime is not None else False - - -@dataclass -class DdbRecordKey: - cluster_arn: str - service_name: str - - def to_composite(self): - return f'{self.cluster_arn}#{self.service_name}' - - @staticmethod - def from_composite(composite: str): - cluster_arn, service_name = composite.split('#') - return DdbRecordKey(cluster_arn=cluster_arn, service_name=service_name) - - -@dataclass -class DdbRecord: - key: DdbRecordKey - ipv4s: Set[str] = field(default_factory=set) - task_info: Dict[str, TaskInfo] = field(default_factory=dict) - record_sets: Set[Route53RecordSetLocator] = field(default_factory=set) - version: int = 0 - - def task_is_stopped(self, task_info: TaskInfo): - """ - Check if a task has already stopped. - """ - - return task_info.task_arn in self.task_info and self.task_info[task_info.task_arn].is_stopped() - - -class DdbRecordEncoding: - PK_NAME = 'cluster_service' - ATTR_VERSION = 'version' - ATTR_IPV4S = 'ipv4s' - ATTR_TASK_INFO = 'task_info' - ATTR_TASK_ARN = 'task_arn' - ATTR_TASK_ENIS = 'enis' - ATTR_TASK_STOPPED_DATETIME = 'stopped_datetime' - ATTR_ENI_ID = 'eni_id' - ATTR_ENI_PUBLIC_IPV4 = 'public_ipv4' - ATTR_RECORD_SETS = 'record_sets' - ATTR_RECORD_SET_ZONE = 'hosted_zone_id' - ATTR_RECORD_SET_NAME = 'record_name' - - def get_identity(self, key: DdbRecordKey): - return {self.PK_NAME: key.to_composite()} - - def get_identity_expression(self, key: DdbRecordKey): - return Key(self.PK_NAME).eq(key.to_composite()) - - def encode(self, record: DdbRecord) -> dict: - data = dict() - data[self.PK_NAME] = record.key.to_composite() - data[self.ATTR_VERSION] = record.version - - if len(record.ipv4s) > 0: - # Sorting only matters here for repeatability in tests, as set ordering - # isn't easily predictable. - data[self.ATTR_IPV4S] = [v for v in sorted(record.ipv4s)] - - if len(record.record_sets) > 0: - data[self.ATTR_RECORD_SETS] = [self.encode_record_set(v) for v in sorted(record.record_sets)] - - if len(record.task_info) > 0: - data[self.ATTR_TASK_INFO] = { - task_info.task_arn: self.encode_task_info(task_info) - for task_info in record.task_info.values() - } - - return data - - def encode_record_set(self, record_set: Route53RecordSetLocator): - return { - self.ATTR_RECORD_SET_ZONE: record_set.hosted_zone_id, - self.ATTR_RECORD_SET_NAME: record_set.record_name, - } - - def encode_task_info(self, task_info: TaskInfo) -> dict: - data = dict() - data[self.ATTR_TASK_ARN] = task_info.task_arn - - if task_info.stopped_datetime is not None: - data[self.ATTR_TASK_STOPPED_DATETIME] = task_info.stopped_datetime.isoformat() - - if len(task_info.enis) > 0: - data[self.ATTR_TASK_ENIS] = [self.encode_eni_info(eni_info) for eni_info in task_info.enis] - - return data - - def encode_eni_info(self, eni_info: EniInfo) -> dict: - data = dict() - data[self.ATTR_ENI_ID] = eni_info.eni_id - if eni_info.public_ipv4 is not None: - data[self.ATTR_ENI_PUBLIC_IPV4] = eni_info.public_ipv4 - - return data - - def decode(self, data: dict) -> DdbRecord: - key = DdbRecordKey.from_composite(data[self.PK_NAME]) - version = int(data[self.ATTR_VERSION]) - - ipv4s = set() - if self.ATTR_IPV4S in data: - ipv4s = {ip for ip in data[self.ATTR_IPV4S]} - - record_sets = set() - if self.ATTR_RECORD_SETS in data: - for record_set_data in data[self.ATTR_RECORD_SETS]: - record_set = self.decode_record_set(record_set_data) - record_sets.add(record_set) - - task_info = dict() - if self.ATTR_TASK_INFO in data: - task_info = { - k: self.decode_task_info(task_info_data) - for (k, task_info_data) in data[self.ATTR_TASK_INFO].items() - } - - record = DdbRecord(key=key, version=version, ipv4s=ipv4s, task_info=task_info, record_sets=record_sets) - - return record - - def decode_record_set(self, data) -> Route53RecordSetLocator: - hosted_zone_id = data[self.ATTR_RECORD_SET_ZONE] - record_name = data[self.ATTR_RECORD_SET_NAME] - - return Route53RecordSetLocator(hosted_zone_id=hosted_zone_id, record_name=record_name) - - def decode_task_info(self, data) -> TaskInfo: - task_arn = data[self.ATTR_TASK_ARN] - - stopped_datetime = None - if self.ATTR_TASK_STOPPED_DATETIME in data: - stopped_datetime = datetime.fromisoformat(data[self.ATTR_TASK_STOPPED_DATETIME]) - - enis = [] - if self.ATTR_TASK_ENIS in data: - enis = [self.decode_eni_info(eni_info_data) for eni_info_data in data[self.ATTR_TASK_ENIS]] - - return TaskInfo(task_arn=task_arn, stopped_datetime=stopped_datetime, enis=enis) - - def decode_eni_info(self, data) -> EniInfo: - eni_id = data[self.ATTR_ENI_ID] - - public_ipv4 = None - if self.ATTR_ENI_PUBLIC_IPV4 in data: - public_ipv4 = data[self.ATTR_ENI_PUBLIC_IPV4] - - return EniInfo(eni_id=eni_id, public_ipv4=public_ipv4) diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/lib/records_table.py b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/lib/records_table.py deleted file mode 100644 index 390ef0066dde5..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/lib/records_table.py +++ /dev/null @@ -1,215 +0,0 @@ -import logging -import time -from dataclasses import dataclass, field -from datetime import datetime, timedelta -from typing import * - -from boto3.dynamodb.conditions import Attr -from botocore.exceptions import ClientError - -from lib.records import DdbRecord, DdbRecordKey, DdbRecordEncoding, TaskInfo -from lib.route53 import Route53RecordSetLocator - - -@dataclass -class RecordUpdate: - running_tasks: List[TaskInfo] = field(default_factory=list) - stopped_tasks: List[TaskInfo] = field(default_factory=list) - record_sets_added: List[Route53RecordSetLocator] = field(default_factory=list) - record_sets_removed: List[Route53RecordSetLocator] = field(default_factory=list) - - def current_record_set(self, record_set: Route53RecordSetLocator): - self.record_sets_added.append(record_set) - - def extra_record_set(self, record_set: Route53RecordSetLocator): - self.record_sets_removed.append(record_set) - - -class RecordsTableAccessor: - """ - Abstracts management of the task records to putting running and stopped tasks. - """ - - table_client: Any - ddb_record_encoding: DdbRecordEncoding - - # Max number of attempts at optimistic put_tasks - max_attempts = 50 - - # Amount of lag to add (if any) to simulate concurrent locking conflicts in - # lambda - optimistic_simulation_delay = 0 - - def __init__(self, table_client): - """ - Initializes a RecordsTable. Provide a boto3.resource - """ - self.table_client = table_client - self.ddb_record_encoding = DdbRecordEncoding() - - def delete(self, key: DdbRecordKey): - """ - Delete a record by record key. - """ - - logging.info(f'Deleting {key}') - self.table_client.delete_item(Key=self.ddb_record_encoding.get_identity(key)) - - def put_update(self, key: DdbRecordKey, update: RecordUpdate) -> DdbRecord: - """ - Retries putting tasks into the table record with optimistic locking. - """ - - for attempt in range(0, self.max_attempts): - try: - logging.info(f'Attempting to put the task optimistically (attempt {attempt+1})') - return self.put_update_optimistically(key=key, update=update) - except ClientError as e: - if e.response['Error']['Code'] == 'ConditionalCheckFailedException': - logging.info(f'Check condition was rejected') - continue - else: - raise - - # Ran out of retries!! - raise Exception('Exceeded maximum retries while optimistically putting changes') - - def get_record(self, key: DdbRecordKey) -> DdbRecord: - """ - Gets the record by key or provides a blank record. - """ - - # Search for the pertinent record - response = self.table_client.query(KeyConditionExpression=self.ddb_record_encoding.get_identity_expression(key)) - - if len(response['Items']) > 0: - # Decode a pre-existing record - logging.info(f'Found a pre-existing record') - return self.ddb_record_encoding.decode(response['Items'][0]) - else: - logging.info(f'Creating a new record') - # Create a new record - return DdbRecord(key=key) - - def put_update_optimistically(self, key: DdbRecordKey, update: RecordUpdate) -> DdbRecord: - """ - Optimistically record running and stopped tasks for this record. - """ - - ddb_record = self.get_record(key=key) - - # Add some lag (if any) to simulate concurrent locking conflicts in lambda - if self.optimistic_simulation_delay > 0: - time.sleep(self.optimistic_simulation_delay) - - # Update the record with the running and stopped task info - update_ddb_record(ddb_record=ddb_record, update=update) - - # Optimistic locking condition - optimistic_lock_condition = Attr(self.ddb_record_encoding.ATTR_VERSION).not_exists() \ - | Attr(self.ddb_record_encoding.ATTR_VERSION).eq(ddb_record.version) - - # Prepare the record for updating - ddb_record.version += 1 - item = self.ddb_record_encoding.encode(ddb_record) - - # Put it up - self.table_client.put_item(Item=item, ConditionExpression=optimistic_lock_condition) - - return ddb_record - - -def update_ddb_record(ddb_record: DdbRecord, update: RecordUpdate) -> DdbRecord: - """ - Updates a DynamoDB record with the list of running and stopped tasks. - """ - - # Add the record sets we want to add - for record_set in update.record_sets_added: - ddb_record.record_sets.add(record_set) - - # Remove the ones we want to remove - for record_set in update.record_sets_removed: - if record_set in ddb_record.record_sets: - ddb_record.record_sets.remove(record_set) - - # Add running task info to the record - for running_task in update.running_tasks: - # Don't add a task as running when it previously stopped (out-of-order receive) - if running_task.task_arn in ddb_record.task_info and ddb_record.task_info[running_task.task_arn].is_stopped(): - logging.info( - f'Received {running_task.task_arn} transition to RUNNING, but it was already stopped. Ignored.') - continue - - # Record info about the running task - ddb_record.task_info[running_task.task_arn] = running_task - - # Add all public ips to the public ip set - for eni in running_task.enis: - if eni.public_ipv4 is not None: - ddb_record.ipv4s.add(eni.public_ipv4) - - logging.info(f'Recorded {running_task.task_arn} as RUNNING.') - - # Remove stopped task ips from the record and set "stopped" markers on the - # stored task info. - for stopped_task in update.stopped_tasks: - # When the stopped task was previously represented in the task info list, - # then we fetch the old representation for its potential ip address info. - if stopped_task.task_arn in ddb_record.task_info: - task_arn = stopped_task.task_arn - stored_task = ddb_record.task_info[task_arn] - - # When the task is not yet marked as stopped, we need to mark it as such - # and remove its eni ips from the ip list. - if not stored_task.is_stopped(): - stored_task.set_stopped_marker() - - for eni in stored_task.enis: - if eni.public_ipv4 is not None and eni.public_ipv4 in ddb_record.ipv4s: - ddb_record.ipv4s.remove(eni.public_ipv4) - - logging.info(f'Recorded {task_arn} as STOPPED.') - - else: - # Stored task already marked as stopped, so the received task is a - # duplicate. Ignore it. - logging.info(f'Received {task_arn} which was already STOPPED. Ignoring.') - pass - - else: - # Stopped task isn't in the task list, so we've received an out-of-order - # STOPPED transition. We don't know this task, but we know that if we - # receive a running task in the future, that we don't want to accept it. - stopped_task.set_stopped_marker() - ddb_record.task_info[stopped_task.task_arn] = stopped_task - logging.info(f'Recorded {stopped_task.task_arn} as STOPPED even though we have never seen it.') - - # Expunge expired tasks. Use a copy of the dict items to avoid errors from the - # dictionary changing while iterating. - for (key, task) in list(ddb_record.task_info.items()): - if task_info_has_expired(task): - logging.info(f'Expunging {task.task_arn} as expired.') - del ddb_record.task_info[key] - - return ddb_record - - -# The the length of time that a task marked as stopped may continue to exist -# in the task info list before it is expunged. -STOPPED_MARKER_EXPIRATION = timedelta(minutes=30) - - -def task_info_has_expired(task_info: TaskInfo): - """ - Determine if this task info can be deleted from the DDB record. If the task - has stopped and the stopped marker expiration has elapsed, then we can - delete, otherwise the task info must be kept to filter out-of-order duplicate - RUNNING state transition events. - """ - - if not task_info.is_stopped(): - return False - - stopped_marker_age = datetime.utcnow() - task_info.stopped_datetime - return True if stopped_marker_age > STOPPED_MARKER_EXPIRATION else False diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/lib/route53.py b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/lib/route53.py deleted file mode 100644 index df3b23c76a1fe..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/lib/route53.py +++ /dev/null @@ -1,167 +0,0 @@ -from dataclasses import dataclass -import time -from typing import * -import logging - -from botocore.exceptions import ClientError - - -@dataclass -class Route53RecordSetLocator: - hosted_zone_id: str - record_name: str - - def __str__(self): - """String serialization for hashing and comparison""" - return f'{self.hosted_zone_id}#{self.record_name}' - - def __hash__(self): - """Unique hash for this object is based on its string serialization""" - return int.from_bytes(self.__str__().encode(), 'little') - - def __lt__(self, other): - """set() uses this""" - return self.__str__() < other.__str__() - - def get_dot_suffixed_name(self): - return self.record_name + '.' - - def matches_record_set(self, record_set): - return record_set['Name'] == self.get_dot_suffixed_name() - - def matches(self, record_set_locator): - return self.record_name == record_set_locator.record_name and self.hosted_zone_id == record_set_locator.hosted_zone_id - - -class Route53RecordSetAccessor: - route53_client: Any - ttl = 60 - - def __init__(self, route53_client: Any): - self.route53_client = route53_client - - def update(self, locator: Route53RecordSetLocator, ipv4s: Set[str] = None): - ipv4s = set() if ipv4s is None else ipv4s - - record_set, is_new = retry_with_backoff(lambda: self.get_record_set(locator)) - if is_new: - logging.info(f'Found a pre-existing record set: {record_set}') - else: - logging.info('Creating a new record set') - - if len(ipv4s) > 0: - record_set['ResourceRecords'] = map_ips_to_resource_records(ipv4s) - retry_with_backoff(lambda: self.request_upsert(locator, record_set)) - elif not is_new: - retry_with_backoff(lambda: self.request_delete(locator, record_set)) - else: - logging.info('Refusing to do anything with a new but empty recordset') - - def get_record_set(self, locator: Route53RecordSetLocator) -> Tuple[dict, bool]: - record_type = 'A' - result = self.route53_client.list_resource_record_sets(HostedZoneId=locator.hosted_zone_id, - StartRecordName=locator.record_name, - StartRecordType=record_type, MaxItems="1") - - logging.info(f'Query result: {result}') - existing_record_set = find_locator_record_set(locator, record_type, result['ResourceRecordSets']) - if existing_record_set: - return existing_record_set, False - else: - return { - 'Name': locator.get_dot_suffixed_name(), - 'Type': record_type, - 'ResourceRecords': [], - 'TTL': self.ttl - }, True - - def request_upsert(self, locator: Route53RecordSetLocator, record_set): - logging.info(f'Upserting record set {record_set}') - self.route53_client.change_resource_record_sets( - HostedZoneId=locator.hosted_zone_id, ChangeBatch={ - 'Comment': 'Automatic', - 'Changes': [{ - 'Action': 'UPSERT', - 'ResourceRecordSet': record_set - }] - }) - - def delete(self, locator: Route53RecordSetLocator): - """ - Delete the record. Returns true if it found and deleted the record. - Returns false if it didn't need to delete anything. - """ - - logging.info(f'Querying for {locator}') - record_set, is_new = retry_with_backoff(lambda: self.get_record_set(locator)) - - if not is_new: - logging.info(f'Found a record set') - retry_with_backoff(lambda: self.request_delete(locator, record_set)) - logging.info(f'Deleted record set {record_set}') - return True - - else: - logging.info(f'Did not find a record set, so no deletion needed') - return False - - def exists(self, locator: Route53RecordSetLocator): - """ - Returns true if the record exists. False otherwise. - """ - - _, is_new = retry_with_backoff(lambda: self.get_record_set(locator)) - - return not is_new - - def request_delete(self, locator: Route53RecordSetLocator, record_set): - logging.info(f'Deleting record set: {record_set}') - self.route53_client.change_resource_record_sets( - HostedZoneId=locator.hosted_zone_id, ChangeBatch={ - 'Comment': 'Automatic', - 'Changes': [{ - 'Action': 'DELETE', - 'ResourceRecordSet': record_set, - }] - }) - - -def exponential_backoff(attempt: int): - return 2**attempt - - -def retry_with_backoff(call: Callable, attempts=5, backoff=exponential_backoff): - for attempt in range(0, attempts): - try: - return call() - - except ClientError as e: - if e.response['Error']['Code'] == 'Throttling': - backoff_seconds = backoff(attempt) - logging.info(f'Attempt {attempt+1} throttled. Backing off for {backoff_seconds}.') - time.sleep(backoff_seconds) - continue - - if e.response['Error']['Code'] == 'PriorRequestNotComplete': - backoff_seconds = backoff(attempt) - logging.info( - f'Attempt {attempt+1} discovered the prior request is not yet complete. Backing off for {backoff_seconds}.' - ) - time.sleep(backoff_seconds) - continue - - raise - - -def map_ips_to_resource_records(ips: Set[str]): - # Take up to the first 400 ips after sorting as the max recordset record quota is 400 - ips_sorted_limited = sorted(ips)[0:400] - return [{'Value': ip} for ip in ips_sorted_limited] - - -def find_locator_record_set(locator: Route53RecordSetLocator, record_type: str, record_sets: list): - for record_set in record_sets: - if locator.matches_record_set(record_set) and record_set['Type'] == record_type: - return record_set - - return None diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/lib/running_task_collector.py b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/lib/running_task_collector.py deleted file mode 100644 index a7034d81e5e53..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/lib/running_task_collector.py +++ /dev/null @@ -1,57 +0,0 @@ -import logging -from typing import * - -from lib.records import DdbRecord, EniInfo, TaskInfo - - -class RunningTaskCollector: - """ - Collects information about running tasks. After collecting all task info, - when `fill_eni_info_from_eni_query()` is called, the collector queries - for the ip addresses of the tasks and fills in the appropriate records. - """ - - ec2_client: Any - tasks: List[TaskInfo] - enis_by_id: Dict[str, EniInfo] - - def __init__(self, ec2_client, reference_record: DdbRecord): - self.ec2_client = ec2_client - self.tasks = list() - self.enis_by_id = dict() - self.reference_record = reference_record - - def collect(self, task_info): - # Check to see if the task we've received is already stopped. If so, - # we refuse to collect it on the basis that we'll just get an eni - # doesn't exist error anyway. - if self.reference_record.task_is_stopped(task_info): - logging.info(f'Refusing to collect {task_info.task_arn} as it has already been deleted') - return - - # Append the task info to the master list - self.tasks.append(task_info) - - # Collect enis indexed by their ids - for eni in task_info.enis: - self.enis_by_id[eni.eni_id] = eni - - def fill_eni_info_from_eni_query(self): - for eni_description in self.describe_enis(): - eni_id = eni_description['NetworkInterfaceId'] - - if 'Association' in eni_description: - public_ipv4 = eni_description['Association']['PublicIp'] - if public_ipv4 and eni_id in self.enis_by_id: - self.enis_by_id[eni_id].public_ipv4 = public_ipv4 - - def describe_enis(self): - paginator = self.ec2_client.get_paginator('describe_network_interfaces') - - eni_ids = list(self.enis_by_id.keys()) - for page in paginator.paginate(NetworkInterfaceIds=eni_ids): - for eni in page['NetworkInterfaces']: - yield eni - - def get_ips(self): - return [eni.public_ipv4 for eni in self.enis_by_id.values()] diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/run_test.py b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/run_test.py deleted file mode 100644 index 7efd5dc08534d..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/run_test.py +++ /dev/null @@ -1,5 +0,0 @@ -import unittest - -if __name__ == "__main__": - test_suite = unittest.defaultTestLoader.discover('.') - unittest.TextTestRunner().run(test_suite) diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/__init__.py b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/__init__.py deleted file mode 100644 index 539bac0f9e2aa..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# Keep this file so that python -m unittest discover can find these tests. diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/fixtures/ddb-record.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/fixtures/ddb-record.json deleted file mode 100644 index f62cf391abf39..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/fixtures/ddb-record.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "cluster_service": "CLUSTER_ARN#SERVICE", - "ipv4s": [ - "1.1.2.1", - "1.1.2.2" - ], - "task_info": { - "TASK1_ARN": { - "enis": [ - { - "eni_id": "TASK1_ENI1_ID", - "public_ipv4": "1.1.1.1" - } - ], - "stopped_datetime": "2020-10-04T23:47:36.322158", - "task_arn": "TASK1_ARN" - }, - "TASK2_ARN": { - "enis": [ - { - "eni_id": "TASK2_ENI1_ID", - "public_ipv4": "1.1.2.1" - }, - { - "eni_id": "TASK2_ENI2_ID", - "public_ipv4": "1.1.2.2" - } - ], - "task_arn": "TASK2_ARN" - } - }, - "record_sets": [ - { - "hosted_zone_id": "ABCD", - "record_name": "test-record.myexample.com" - }, - { - "hosted_zone_id": "ABCD", - "record_name": "test-record2.myexample.com" - } - ], - "version": 12 -} diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/fixtures/eni_description.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/fixtures/eni_description.json deleted file mode 100644 index 9e790e455fb99..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/fixtures/eni_description.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "Association": { - "IpOwnerId": "amazon", - "PublicDnsName": "example.com", - "PublicIp": "1.2.3.4" - }, - "Attachment": { - "AttachTime": "2020-10-03T23:42:51+00:00", - "AttachmentId": "eni-attach-0704671692ecf366b", - "DeleteOnTermination": false, - "DeviceIndex": 1, - "InstanceOwnerId": "000000000", - "Status": "attached" - }, - "AvailabilityZone": "test-region-1a", - "Description": "arn:aws:ecs:test-region-1:0000000000:attachment/20d24cce-3d50-493d-b890-32d4f11859f4", - "Groups": [ - { - "GroupName": "aws-ecs-integ-nameserviceSecurityGroup33F4662C-16PM465FOR8L1", - "GroupId": "sg-0b83d6ad2edd8e940" - } - ], - "InterfaceType": "interface", - "Ipv6Addresses": [], - "MacAddress": "02:a4:cb:74:0f:a8", - "NetworkInterfaceId": "eni-abcd", - "OwnerId": "0000000000", - "PrivateDnsName": "ip-10-0-0-19.test-region-1.compute.internal", - "PrivateIpAddress": "10.0.0.19", - "PrivateIpAddresses": [ - { - "Association": { - "IpOwnerId": "amazon", - "PublicDnsName": "example.com", - "PublicIp": "1.2.3.4" - }, - "Primary": true, - "PrivateDnsName": "ip-10-0-0-19.test-region-1.compute.internal", - "PrivateIpAddress": "10.0.0.19" - } - ], - "RequesterId": "0000000000", - "RequesterManaged": true, - "SourceDestCheck": true, - "Status": "in-use", - "SubnetId": "subnet-036b0d1413bb6bd2c", - "TagSet": [], - "VpcId": "vpc-0e63014e689c4b14f" -} diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/fixtures/task_description.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/fixtures/task_description.json deleted file mode 100644 index 7bf19d91893a2..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/fixtures/task_description.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "attachments": [ - { - "id": "", - "type": "eni", - "status": "DELETED", - "details": [ - { - "name": "subnetId", - "value": "subnet-" - }, - { - "name": "networkInterfaceId", - "value": "eni-abcd" - }, - { - "name": "macAddress", - "value": "" - }, - { - "name": "privateIPv4Address", - "value": "10.0.0.52" - } - ] - } - ], - "availabilityZone": "test-region-1a", - "clusterArn": "arn:aws:ecs:test-region-1::cluster/aws-ecs-integ-productionenvironmentclusterC6599D2D-U7W8a2P2HPhC", - "containers": [ - { - "containerArn": "arn:aws:ecs:test-region-1::container/ff3b49f4-5eea-46cd-99c6-069584b3fb8e", - "exitCode": 1, - "lastStatus": "STOPPED", - "name": "app", - "image": "nathanpeck/name", - "runtimeId": "", - "taskArn": "arn:aws:ecs:test-region-1::task/12345678-1234-1234-1234-1234567890AB", - "networkInterfaces": [ - { - "attachmentId": "323eb03f-dedf-44b6-aa5f-d9d7f7b37714", - "privateIpv4Address": "10.0.0.52" - } - ], - "cpu": "256", - "memory": "512" - } - ], - "createdAt": "2020-10-03T22:31:35.117Z", - "launchType": "FARGATE", - "cpu": "256", - "memory": "512", - "desiredStatus": "STOPPED", - "group": "service:aws-ecs-integ-nameserviceService8015C8D6-I4TwUFv4xk2o", - "lastStatus": "STOPPED", - "overrides": { - "containerOverrides": [ - { - "name": "app" - } - ] - }, - "connectivity": "CONNECTED", - "connectivityAt": "2020-10-03T22:31:43.32Z", - "pullStartedAt": "2020-10-03T22:31:46.764Z", - "startedAt": "2020-10-03T22:31:54.764Z", - "startedBy": "ecs-svc/7073659324082574009", - "stoppingAt": "2020-10-03T22:43:06.753Z", - "stoppedAt": "2020-10-03T22:43:31.542Z", - "pullStoppedAt": "2020-10-03T22:31:53.764Z", - "executionStoppedAt": "2020-10-03T22:43:08Z", - "stoppedReason": "Scaling activity initiated by (deployment ecs-svc/7073659324082574009)", - "updatedAt": "2020-10-03T22:43:31.542Z", - "taskArn": "arn:aws:ecs:test-region-1::task/12345678-1234-1234-1234-1234567890AB", - "taskDefinitionArn": "arn:aws:ecs:test-region-1::task-definition/awsecsintegnametaskdefinition0EA6A1A0:3", - "version": 7, - "platformVersion": "1.3.0" -} diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/test_cleanup_resource_handler.py b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/test_cleanup_resource_handler.py deleted file mode 100644 index c5ec1d0cf61ec..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/test_cleanup_resource_handler.py +++ /dev/null @@ -1,46 +0,0 @@ -import unittest -import unittest.mock as mock - -from lib.cleanup_resource_handler import CleanupResourceHandler -from lib.route53 import Route53RecordSetLocator - - -class TestCleanupResourceHandler(unittest.TestCase): - def test_handler_rejects_invalid_properties(self): - handler = CleanupResourceHandler(route53_client=mock.Mock()) - with self.assertRaises(Exception): - handler.handle_event({'RequestType': 'Delete', 'ResourceProperties': {'Invalid': 'Invalid'}}, {}) - - def test_handling_delete(self): - handler = CleanupResourceHandler(route53_client=mock.Mock(), monitor_interval=0) - record_set_accessor = mock.Mock() - record_set_accessor.delete = mock.Mock(return_value=True) # True = Deleted - - exists_count = 0 - - def exists_side_effect(*args): - nonlocal exists_count - exists_count += 1 - return True if exists_count < 3 else False - - record_set_accessor.exists = mock.Mock(side_effect=exists_side_effect) - - handler.record_set_accessor = record_set_accessor - - event = { - 'RequestType': 'Delete', - 'ResourceProperties': { - 'ServiceToken': 'Something', - 'HostedZoneId': 'ZONE', - 'RecordName': 'something.mydomain.com' - } - } - - # WHEN - handler.handle_event(event, {}) - - # THEN - expected_locator = Route53RecordSetLocator(hosted_zone_id='ZONE', record_name='something.mydomain.com') - record_set_accessor.delete.assert_called_with(locator=expected_locator) - record_set_accessor.exists.assert_called() - self.assertEqual(record_set_accessor.exists.call_count, 3) diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/test_events.py b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/test_events.py deleted file mode 100644 index a616bd7999309..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/test_events.py +++ /dev/null @@ -1,21 +0,0 @@ -import json -import os -import unittest - -from lib.events import extract_event_task_info - -THIS_DIR = os.path.abspath(os.path.dirname(__file__)) -with open(os.path.join(THIS_DIR, 'fixtures', 'task_description.json')) as f: - TASK_DESCRIPTION = json.loads(f.read()) - - -class TestEvents(unittest.TestCase): - def test_extract_event_task_info(self): - task_info = extract_event_task_info(TASK_DESCRIPTION) - - self.assertEqual(task_info.task_arn, 'arn:aws:ecs:test-region-1::task/12345678-1234-1234-1234-1234567890AB') - self.assertTrue(not task_info.is_stopped()) - - self.assertEqual(len(task_info.enis), 1) - self.assertEqual(task_info.enis[0].eni_id, 'eni-abcd') - self.assertEqual(task_info.enis[0].public_ipv4, None) diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/test_queue_handler.py b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/test_queue_handler.py deleted file mode 100644 index 91477451cf72e..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/test_queue_handler.py +++ /dev/null @@ -1,29 +0,0 @@ -import unittest -import unittest.mock as mock - -from lib.queue_handler import QueueHandler - - -class TestQueueHandler(unittest.TestCase): - def test_queue_handler_sets_up(self): - environ = { - 'HOSTED_ZONE_ID': 'HOSTED_ZONE_ID', - 'RECORD_NAME': 'RECORD_NAME', - 'RECORDS_TABLE': 'RECORDS_TABLE', - 'CLUSTER_ARN': 'CLUSTER_ARN', - 'SERVICE_NAME': 'SERVICE_NAME', - } - - ec2_client = mock.Mock() - route53_client = mock.Mock() - dynamodb_resource = mock.Mock() - - # WHEN - - handler = QueueHandler(ec2_client=ec2_client, route53_client=route53_client, - dynamodb_resource=dynamodb_resource, environ=environ) - - # THEN - dynamodb_resource.Table.called_width('RECORDS_TABLE') - - pass diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/test_records.py b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/test_records.py deleted file mode 100644 index cb2e1e45f6ed4..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/test_records.py +++ /dev/null @@ -1,46 +0,0 @@ -import json -import os -import unittest -from datetime import datetime - -from lib.records import DdbRecordEncoding, TaskInfo, EniInfo - -THIS_DIR = os.path.abspath(os.path.dirname(__file__)) -with open(os.path.join(THIS_DIR, 'fixtures', 'ddb-record.json')) as f: - DDB_RECORD_ENCODED = json.loads(f.read()) - - -class TestRecords(unittest.TestCase): - def test_task_info_stopped_marker(self): - task_info = TaskInfo(task_arn='a', enis=[]) - task_info.set_stopped_marker() - self.assertTrue(task_info.is_stopped()) - - def test_ddb_record_encoding(self): - # GIVEN - ddb_record_encoding = DdbRecordEncoding() - - # WHEN - ddb_record = ddb_record_encoding.decode(DDB_RECORD_ENCODED) - ddb_record_reencoded = ddb_record_encoding.encode(ddb_record) - - # THEN - self.assertEqual(ddb_record.key.cluster_arn, 'CLUSTER_ARN') - self.assertEqual(ddb_record.key.service_name, 'SERVICE') - self.assertEqual(sorted(ddb_record.ipv4s), ['1.1.2.1', '1.1.2.2']) - self.assertEqual( - ddb_record.task_info['TASK1_ARN'], - TaskInfo(task_arn='TASK1_ARN', stopped_datetime=datetime(2020, 10, 4, 23, 47, 36, 322158), enis=[ - EniInfo(eni_id='TASK1_ENI1_ID', public_ipv4='1.1.1.1'), - ])) - self.assertEqual( - ddb_record.task_info['TASK2_ARN'], - TaskInfo( - task_arn='TASK2_ARN', enis=[ - EniInfo(eni_id='TASK2_ENI1_ID', public_ipv4='1.1.2.1'), - EniInfo(eni_id='TASK2_ENI2_ID', public_ipv4='1.1.2.2'), - ])) - self.assertEqual(len(ddb_record.record_sets), 2) - - self.maxDiff = 9999999 - self.assertEqual(ddb_record_reencoded, DDB_RECORD_ENCODED) diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/test_records_table.py b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/test_records_table.py deleted file mode 100644 index 3429c152a6a35..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/test_records_table.py +++ /dev/null @@ -1,188 +0,0 @@ -import json -import os -import unittest -import unittest.mock as mock - -from boto3.dynamodb.conditions import ConditionExpressionBuilder -from botocore.exceptions import ClientError - -from lib.records import DdbRecordKey, TaskInfo, EniInfo, DdbRecord -from lib.records_table import RecordsTableAccessor, update_ddb_record, RecordUpdate -from lib.route53 import Route53RecordSetLocator - -THIS_DIR = os.path.abspath(os.path.dirname(__file__)) -with open(os.path.join(THIS_DIR, 'fixtures', 'ddb-record.json')) as f: - DDB_RECORD_ENCODED = json.loads(f.read()) - - -class TestRecordsTable(unittest.TestCase): - def test_put_tasks_creates_with_optimistic_lock(self): - # GIVEN - table_client = mock.Mock() - table_client.query = mock.Mock(return_value={'Items': []}) - - key = DdbRecordKey(cluster_arn='a', service_name='b') - records_table = RecordsTableAccessor(table_client=table_client) - - running = [TaskInfo(task_arn='TASK1_ARN', enis=[ - EniInfo(eni_id='TASK1_ENI1_ID', public_ipv4='1.1.1.1'), - ])] - - # WHEN - records_table.put_update_optimistically(key=key, update=RecordUpdate(running_tasks=running)) - - # THEN - table_client.put_item.assert_called() - item = table_client.put_item.call_args.kwargs['Item'] - self.assertEqual(item['version'], 1) - - condition_expression = table_client.put_item.call_args.kwargs['ConditionExpression'] - expr, atts, vals = ConditionExpressionBuilder().build_expression(condition_expression) - self.assertEqual(expr, '(attribute_not_exists(#n0) OR #n1 = :v0)') - self.assertEqual(atts, {'#n0': 'version', '#n1': 'version'}) - self.assertEqual(vals, {':v0': 0}) - - def test_put_tasks_updates_with_optimistic_lock(self): - # GIVEN - table_client = mock.Mock() - table_client.query = mock.Mock(return_value={'Items': [dict(DDB_RECORD_ENCODED)]}) - - key = DdbRecordKey(cluster_arn='FOO', service_name='test.myexample.com') - records_table = RecordsTableAccessor(table_client=table_client) - - running = [TaskInfo(task_arn='TASK1_ARN', enis=[ - EniInfo(eni_id='TASK1_ENI1_ID', public_ipv4='1.1.1.1'), - ])] - - # WHEN - records_table.put_update_optimistically(key=key, update=RecordUpdate(running_tasks=running)) - - # THEN - condition_expression = table_client.put_item.call_args.kwargs['ConditionExpression'] - expr, atts, vals = ConditionExpressionBuilder().build_expression(condition_expression) - self.assertEqual(vals, {':v0': 12}) - - def test_put_tasks_retries_optimistically(self): - # GIVEN - table_client = mock.Mock() - table_client.query = mock.Mock(return_value={'Items': []}) - table_client.put_item = mock.Mock( - side_effect=ClientError({'Error': { - 'Code': 'ConditionalCheckFailedException' - }}, 'PutItem')) - - records_table = RecordsTableAccessor(table_client=table_client) - key = DdbRecordKey(cluster_arn='a', service_name='b') - - # WHEN - with self.assertRaisesRegex(Exception, r'Exceeded maximum retries'): - records_table.put_update(key=key, update=RecordUpdate()) - - # THEN - self.assertEqual(table_client.query.call_count, records_table.max_attempts) - self.assertEqual(table_client.put_item.call_count, records_table.max_attempts) - - def test_put_tasks_raises_other_errors(self): - # GIVEN - table_client = mock.Mock() - table_client.query = mock.Mock(return_value={'Items': []}) - table_client.put_item = mock.Mock(side_effect=ClientError({'Error': {'Code': 'SomethingElse'}}, 'PutItem')) - - records_table = RecordsTableAccessor(table_client=table_client) - key = DdbRecordKey(cluster_arn='a', service_name='b') - - # WHEN - with self.assertRaisesRegex(Exception, r'SomethingElse'): - records_table.put_update(key=key, update=RecordUpdate()) - - # THEN - self.assertEqual(table_client.query.call_count, 1) - self.assertEqual(table_client.put_item.call_count, 1) - - def test_delete(self): - # GIVEN - table_client = mock.Mock() - key = DdbRecordKey(cluster_arn='a', service_name='b') - records_table = RecordsTableAccessor(table_client=table_client) - - # WHEN - records_table.delete(key) - - # THEN - table_client.delete_item.called_with(Key='a#b') - - def test_update_ddb_record(self): - # GIVEN - ddb_record = DdbRecord(key=DdbRecordKey(cluster_arn='a', service_name='b')) - - # TASK1->RUNNING, TASK2->RUNNING - ord1_running = [ - TaskInfo(task_arn='TASK1_ARN', enis=[ - EniInfo(eni_id='TASK1_ENI1_ID', public_ipv4='1.1.1.1'), - ]), - TaskInfo(task_arn='TASK2_ARN', enis=[ - EniInfo(eni_id='TASK2_ENI1_ID', public_ipv4='1.1.2.1'), - ]), - ] - # TASK3->STOPPED (out of order) - ord1_stopped = [ - TaskInfo(task_arn='TASK3_ARN', enis=[ - EniInfo(eni_id='TASK3_ENI1_ID'), - ]), - ] - - # TASK1->STOPPED, TASK3->STOPPED (duplicate) - ord2_stopped = [ - # Expected TASK1 transition to STOPPED - TaskInfo(task_arn='TASK1_ARN', enis=[ - EniInfo(eni_id='TASK1_ENI1_ID'), - ]), - # Duplicate TASK3 transition to STOPPED - TaskInfo(task_arn='TASK3_ARN', enis=[ - EniInfo(eni_id='TASK3_ENI1_ID'), - ]), - ] - - # TASK1->RUNNING (out of order), TASK3->RUNNING (out of order) - ord3_running = [ - TaskInfo(task_arn='TASK1_ARN', enis=[ - EniInfo(eni_id='TASK1_ENI1_ID', public_ipv4='1.1.1.1'), - ]), - TaskInfo(task_arn='TASK3_ARN', enis=[ - EniInfo(eni_id='TASK3_ENI1_ID', public_ipv4='1.1.3.1'), - ]), - ] - - # WHEN - update_ddb_record(ddb_record, RecordUpdate(running_tasks=ord1_running, stopped_tasks=ord1_stopped)) - update_ddb_record(ddb_record, RecordUpdate(stopped_tasks=ord2_stopped)) - update_ddb_record(ddb_record, RecordUpdate(running_tasks=ord3_running)) - - # THEN - self.assertEqual(len(ddb_record.task_info), 3, msg='expected 3 task infos') - self.assertTrue(ddb_record.task_info['TASK1_ARN'].is_stopped()) - self.assertTrue(not ddb_record.task_info['TASK2_ARN'].is_stopped()) - self.assertTrue(ddb_record.task_info['TASK3_ARN'].is_stopped()) - - self.assertFalse('1.1.1.1' in ddb_record.ipv4s, - msg='ord3_running should have been ignored because the task previously stopped') - self.assertEqual(sorted(ddb_record.ipv4s), ['1.1.2.1']) - - def test_update_record_sets(self): - # GIVEN - ddb_record = DdbRecord(key=DdbRecordKey(cluster_arn='a', service_name='b')) - ord1 = [ - Route53RecordSetLocator('a', 'b'), - Route53RecordSetLocator('a', 'c'), - ] - ord2 = [ - Route53RecordSetLocator('a', 'b'), - ] - - # WHEN - update_ddb_record(ddb_record, RecordUpdate(record_sets_added=ord1)) - update_ddb_record(ddb_record, RecordUpdate(record_sets_removed=ord2)) - - # THEN - self.assertEqual(len(ddb_record.record_sets), 1) - self.assertTrue(Route53RecordSetLocator('a', 'c') in ddb_record.record_sets) \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/test_route53.py b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/test_route53.py deleted file mode 100644 index a77093dcf484d..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/test_route53.py +++ /dev/null @@ -1,281 +0,0 @@ -import unittest -import unittest.mock as mock - -from botocore.exceptions import ClientError - -from lib.route53 import Route53RecordSetLocator, Route53RecordSetAccessor, exponential_backoff, retry_with_backoff, \ - map_ips_to_resource_records, find_locator_record_set - - -class TestRoute53(unittest.TestCase): - def get_route53_client_mock(self): - route53_client = mock.Mock() - record_set_value = None - - route53_client.list_resource_record_sets = mock.Mock( - side_effect=lambda **kwargs: - {'ResourceRecordSets': [record_set_value] if record_set_value is not None else []}) - - def change_resource_record_sets(HostedZoneId, ChangeBatch): - nonlocal record_set_value - change = ChangeBatch['Changes'][0] - change_action = change['Action'] - - if change_action == 'UPSERT': - record_set_value = change['ResourceRecordSet'] - elif change_action == 'DELETE': - record_set_value = None - - route53_client.change_resource_record_sets = mock.Mock(side_effect=change_resource_record_sets) - - return route53_client - - def test_creating_records(self): - # GIVEN - route53_client = self.get_route53_client_mock() - locator = Route53RecordSetLocator(hosted_zone_id='foo', record_name='foo.myexample.com') - merger = Route53RecordSetAccessor(route53_client) - - # WHEN - merger.update(locator, ipv4s={'1.1.1.1'}) - - # THEN - route53_client.change_resource_record_sets.assert_called_with( - HostedZoneId='foo', ChangeBatch={ - 'Comment': - 'Automatic', - 'Changes': [{ - 'Action': 'UPSERT', - 'ResourceRecordSet': { - 'Name': 'foo.myexample.com.', - 'Type': 'A', - 'ResourceRecords': [ - { - 'Value': '1.1.1.1' - }, - ], - 'TTL': 60 - } - }] - }) - - def test_creating_empty_records(self): - # GIVEN - route53_client = self.get_route53_client_mock() - locator = Route53RecordSetLocator(hosted_zone_id='foo', record_name='foo.myexample.com') - merger = Route53RecordSetAccessor(route53_client) - - # WHEN - merger.update(locator, ipv4s=set()) - - # THEN - route53_client.change_resource_record_sets.assert_not_called() - - def test_deleting_records(self): - # GIVEN - route53_client = self.get_route53_client_mock() - locator = Route53RecordSetLocator(hosted_zone_id='foo', record_name='foo.myexample.com') - record_set = Route53RecordSetAccessor(route53_client) - - # Set up the mock with a record. - record_set.update(locator, ipv4s={'1.1.1.1'}) - - # WHEN - record_set.update(locator, ipv4s=set()) - - # THEN - route53_client.change_resource_record_sets.assert_called_with( - HostedZoneId='foo', ChangeBatch={ - 'Comment': - 'Automatic', - 'Changes': [{ - 'Action': 'DELETE', - 'ResourceRecordSet': { - 'Name': 'foo.myexample.com.', - 'Type': 'A', - 'ResourceRecords': [ - { - 'Value': '1.1.1.1' - }, - ], - 'TTL': 60 - } - }] - }) - - def test_deleting_records_with_frontend(self): - # GIVEN - route53_client = self.get_route53_client_mock() - locator = Route53RecordSetLocator(hosted_zone_id='foo', record_name='foo.myexample.com') - record_set = Route53RecordSetAccessor(route53_client) - - # Set up the mock with a record. - record_set.update(locator, ipv4s={'1.1.1.1'}) - - # WHEN - record_set.delete(locator) - - # THEN - self.assertEqual(route53_client.list_resource_record_sets.call_count, 2) - route53_client.change_resource_record_sets.assert_called_with( - HostedZoneId='foo', ChangeBatch={ - 'Comment': - 'Automatic', - 'Changes': [{ - 'Action': 'DELETE', - 'ResourceRecordSet': { - 'Name': 'foo.myexample.com.', - 'Type': 'A', - 'ResourceRecords': [ - { - 'Value': '1.1.1.1' - }, - ], - 'TTL': 60 - } - }] - }) - - def test_deleting_no_records_with_frontend(self): - # GIVEN - route53_client = self.get_route53_client_mock() - locator = Route53RecordSetLocator(hosted_zone_id='foo', record_name='foo.myexample.com') - record_set = Route53RecordSetAccessor(route53_client) - - # WHEN - record_set.delete(locator) - - # THEN - self.assertEqual(route53_client.list_resource_record_sets.call_count, 1) - route53_client.change_resource_record_sets.assert_not_called() - - def test_checks_not_exists(self): - # GIVEN - route53_client = self.get_route53_client_mock() - locator = Route53RecordSetLocator(hosted_zone_id='foo', record_name='foo.myexample.com') - record_set = Route53RecordSetAccessor(route53_client) - - # WHEN - exists = record_set.exists(locator) - - # THEN - self.assertTrue(not exists) - - def test_checks_exists(self): - # GIVEN - route53_client = self.get_route53_client_mock() - locator = Route53RecordSetLocator(hosted_zone_id='foo', record_name='foo.myexample.com') - record_set = Route53RecordSetAccessor(route53_client) - - # WHEN - record_set.update(locator, ipv4s={'1.1.1.1'}) - exists = record_set.exists(locator) - - # THEN - self.assertTrue(exists) - - def test_exponential_backoff(self): - self.assertEqual(exponential_backoff(0), 1) - self.assertEqual(exponential_backoff(1), 2) - self.assertEqual(exponential_backoff(2), 4) - - def test_retry_with_backoff_throttling(self): - # GIVEN - call = mock.Mock(side_effect=ClientError(error_response={'Error': { - 'Code': 'Throttling' - }}, operation_name='any')) - - # WHEN - retry_with_backoff(call, attempts=5, backoff=lambda x: 0) - - # THEN - self.assertEqual(call.call_count, 5) - - def test_retry_with_backoff_prior_request_not_complete(self): - # GIVEN - call = mock.Mock(side_effect=ClientError(error_response={'Error': { - 'Code': 'PriorRequestNotComplete' - }}, operation_name='any')) - - # WHEN - retry_with_backoff(call, attempts=5, backoff=lambda x: 0) - - # THEN - self.assertEqual(call.call_count, 5) - - def test_retry_with_backoff_other_client_errors(self): - # GIVEN - call = mock.Mock(side_effect=ClientError(error_response={'Error': { - 'Code': 'SomethingElse' - }}, operation_name='any')) - - # WHEN/THEN - with self.assertRaisesRegex(ClientError, r'SomethingElse'): - retry_with_backoff(call, attempts=5, backoff=lambda x: 0) - self.assertEqual(call.call_count, 1) - - def test_retry_with_backoff_other_errors(self): - # GIVEN - call = mock.Mock(side_effect=Exception('very good reason')) - - # WHEN/THEN - with self.assertRaisesRegex(Exception, r'very good reason'): - retry_with_backoff(call, attempts=5, backoff=lambda x: 0) - self.assertEqual(call.call_count, 1) - - def test_map_ips_to_resource_records(self): - # GIVEN - ips = {'1.1.1.1', '1.1.1.2'} - - # WHEN - output = map_ips_to_resource_records(ips) - - # THEN - self.assertEqual(output, [{'Value': '1.1.1.1'}, {'Value': '1.1.1.2'}]) - - def test_map_ips_to_resource_records_truncates_to_400(self): - # GIVEN - ips = {f'1.1.{a}.{b}' for a in range(1, 255) for b in range(1, 255)} - - # WHEN - output = map_ips_to_resource_records(ips) - - # THEN - self.assertEqual(len(output), 400) - - def test_find_locator_record_set_ignores_irrelevant_records(self): - # GIVEN - locator = Route53RecordSetLocator(hosted_zone_id='foo', record_name='test-record.myexample.com') - record_sets = [{ - 'Name': 'u-record.myexample.com.', - 'Type': 'A', - 'TTL': 60, - 'ResourceRecords': [{ - 'Value': '1.1.1.1' - }] - }] - - # WHEN - result = find_locator_record_set(locator, 'A', record_sets) - - # THEN - self.assertIsNone(result) - - def test_find_locator_record_set_finds_it(self): - # GIVEN - locator = Route53RecordSetLocator(hosted_zone_id='foo', record_name='test-record.myexample.com') - matching_record = { - 'Name': 'test-record.myexample.com.', - 'Type': 'A', - 'TTL': 60, - 'ResourceRecords': [{ - 'Value': '1.1.1.1' - }] - } - record_sets = [matching_record] - - # WHEN - result = find_locator_record_set(locator, 'A', record_sets) - - # THEN - self.assertEqual(result, matching_record) diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/test_tasks.py b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/test_tasks.py deleted file mode 100644 index b4b491750bcce..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/test/test_tasks.py +++ /dev/null @@ -1,55 +0,0 @@ -import json -import os -import unittest -import unittest.mock as mock -from datetime import datetime - -from lib.events import extract_event_task_info -from lib.records import TaskInfo, DdbRecord, DdbRecordKey -from lib.running_task_collector import RunningTaskCollector - -THIS_DIR = os.path.abspath(os.path.dirname(__file__)) -with open(os.path.join(THIS_DIR, 'fixtures', 'task_description.json')) as f: - TASK_DESCRIPTION = json.loads(f.read()) -with open(os.path.join(THIS_DIR, 'fixtures', 'eni_description.json')) as f: - ENI_DESCRIPTION = json.loads(f.read()) - - -class TestRunningTasksCollector(unittest.TestCase): - def test_task_collector(self): - # GIVEN - ec2_client = mock.Mock() - paginator = mock.Mock() - paginator.paginate = mock.Mock(return_value=[{'NetworkInterfaces': [ENI_DESCRIPTION]}]) - ec2_client.get_paginator = mock.Mock(return_value=paginator) - - reference_record = DdbRecord(key=DdbRecordKey(cluster_arn="A", service_name="B")) - collector = RunningTaskCollector(ec2_client=ec2_client, reference_record=reference_record) - - # WHEN - task_info = extract_event_task_info(TASK_DESCRIPTION) - collector.collect(task_info) - collector.fill_eni_info_from_eni_query() - - # THEN - paginator.paginate.assert_called_with(NetworkInterfaceIds=['eni-abcd']) - self.assertTrue('1.2.3.4' in collector.get_ips()) - - def test_task_collector_doesnt_collect_stopped_tasks(self): - # GIVEN - ec2_client = mock.Mock() - paginator = mock.Mock() - paginator.paginate = mock.Mock(return_value=[{'NetworkInterfaces': [ENI_DESCRIPTION]}]) - ec2_client.get_paginator = mock.Mock(return_value=paginator) - - task_arn = TASK_DESCRIPTION['taskArn'] - task_info = {task_arn: TaskInfo(task_arn=task_arn, enis=[], stopped_datetime=datetime.utcnow())} - reference_record = DdbRecord(key=DdbRecordKey(cluster_arn="A", service_name="B"), task_info=task_info) - collector = RunningTaskCollector(ec2_client=ec2_client, reference_record=reference_record) - - # WHEN - task_info = extract_event_task_info(TASK_DESCRIPTION) - collector.collect(task_info) - - # THEN - self.assertEqual(len(collector.tasks), 0) diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90/index.js b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90/index.js deleted file mode 100644 index ddf62f6363bf4..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/asset.9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90/index.js +++ /dev/null @@ -1,250 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.handler = exports.forceSdkInstallation = exports.flatten = exports.PHYSICAL_RESOURCE_ID_REFERENCE = void 0; -/* eslint-disable no-console */ -const child_process_1 = require("child_process"); -const fs = require("fs"); -const path_1 = require("path"); -/** - * Serialized form of the physical resource id for use in the operation parameters - */ -exports.PHYSICAL_RESOURCE_ID_REFERENCE = 'PHYSICAL:RESOURCEID:'; -/** - * Flattens a nested object - * - * @param object the object to be flattened - * @returns a flat object with path as keys - */ -function flatten(object) { - return Object.assign({}, ...function _flatten(child, path = []) { - return [].concat(...Object.keys(child) - .map(key => { - const childKey = Buffer.isBuffer(child[key]) ? child[key].toString('utf8') : child[key]; - return typeof childKey === 'object' && childKey !== null - ? _flatten(childKey, path.concat([key])) - : ({ [path.concat([key]).join('.')]: childKey }); - })); - }(object)); -} -exports.flatten = flatten; -/** - * Decodes encoded special values (physicalResourceId) - */ -function decodeSpecialValues(object, physicalResourceId) { - return JSON.parse(JSON.stringify(object), (_k, v) => { - switch (v) { - case exports.PHYSICAL_RESOURCE_ID_REFERENCE: - return physicalResourceId; - default: - return v; - } - }); -} -/** - * Filters the keys of an object. - */ -function filterKeys(object, pred) { - return Object.entries(object) - .reduce((acc, [k, v]) => pred(k) - ? { ...acc, [k]: v } - : acc, {}); -} -let latestSdkInstalled = false; -function forceSdkInstallation() { - latestSdkInstalled = false; -} -exports.forceSdkInstallation = forceSdkInstallation; -/** - * Installs latest AWS SDK v2 - */ -function installLatestSdk() { - console.log('Installing latest AWS SDK v2'); - // Both HOME and --prefix are needed here because /tmp is the only writable location - child_process_1.execSync('HOME=/tmp npm install aws-sdk@2 --production --no-package-lock --no-save --prefix /tmp'); - latestSdkInstalled = true; -} -// no currently patched services -const patchedServices = []; -/** - * Patches the AWS SDK by loading service models in the same manner as the actual SDK - */ -function patchSdk(awsSdk) { - const apiLoader = awsSdk.apiLoader; - patchedServices.forEach(({ serviceName, apiVersions }) => { - const lowerServiceName = serviceName.toLowerCase(); - if (!awsSdk.Service.hasService(lowerServiceName)) { - apiLoader.services[lowerServiceName] = {}; - awsSdk[serviceName] = awsSdk.Service.defineService(lowerServiceName, apiVersions); - } - else { - awsSdk.Service.addVersions(awsSdk[serviceName], apiVersions); - } - apiVersions.forEach(apiVersion => { - Object.defineProperty(apiLoader.services[lowerServiceName], apiVersion, { - get: function get() { - const modelFilePrefix = `aws-sdk-patch/${lowerServiceName}-${apiVersion}`; - const model = JSON.parse(fs.readFileSync(path_1.join(__dirname, `${modelFilePrefix}.service.json`), 'utf-8')); - model.paginators = JSON.parse(fs.readFileSync(path_1.join(__dirname, `${modelFilePrefix}.paginators.json`), 'utf-8')).pagination; - return model; - }, - enumerable: true, - configurable: true, - }); - }); - }); - return awsSdk; -} -/* eslint-disable @typescript-eslint/no-require-imports, import/no-extraneous-dependencies */ -async function handler(event, context) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _l, _m, _o, _p; - try { - let AWS; - if (!latestSdkInstalled && event.ResourceProperties.InstallLatestAwsSdk === 'true') { - try { - installLatestSdk(); - AWS = require('/tmp/node_modules/aws-sdk'); - } - catch (e) { - console.log(`Failed to install latest AWS SDK v2: ${e}`); - AWS = require('aws-sdk'); // Fallback to pre-installed version - } - } - else if (latestSdkInstalled) { - AWS = require('/tmp/node_modules/aws-sdk'); - } - else { - AWS = require('aws-sdk'); - } - try { - AWS = patchSdk(AWS); - } - catch (e) { - console.log(`Failed to patch AWS SDK: ${e}. Proceeding with the installed copy.`); - } - console.log(JSON.stringify(event)); - console.log('AWS SDK VERSION: ' + AWS.VERSION); - event.ResourceProperties.Create = decodeCall(event.ResourceProperties.Create); - event.ResourceProperties.Update = decodeCall(event.ResourceProperties.Update); - event.ResourceProperties.Delete = decodeCall(event.ResourceProperties.Delete); - // Default physical resource id - let physicalResourceId; - switch (event.RequestType) { - case 'Create': - physicalResourceId = (_j = (_f = (_c = (_b = (_a = event.ResourceProperties.Create) === null || _a === void 0 ? void 0 : _a.physicalResourceId) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : (_e = (_d = event.ResourceProperties.Update) === null || _d === void 0 ? void 0 : _d.physicalResourceId) === null || _e === void 0 ? void 0 : _e.id) !== null && _f !== void 0 ? _f : (_h = (_g = event.ResourceProperties.Delete) === null || _g === void 0 ? void 0 : _g.physicalResourceId) === null || _h === void 0 ? void 0 : _h.id) !== null && _j !== void 0 ? _j : event.LogicalResourceId; - break; - case 'Update': - case 'Delete': - physicalResourceId = (_o = (_m = (_l = event.ResourceProperties[event.RequestType]) === null || _l === void 0 ? void 0 : _l.physicalResourceId) === null || _m === void 0 ? void 0 : _m.id) !== null && _o !== void 0 ? _o : event.PhysicalResourceId; - break; - } - let flatData = {}; - let data = {}; - const call = event.ResourceProperties[event.RequestType]; - if (call) { - let credentials; - if (call.assumedRoleArn) { - const timestamp = (new Date()).getTime(); - const params = { - RoleArn: call.assumedRoleArn, - RoleSessionName: `${timestamp}-${physicalResourceId}`.substring(0, 64), - }; - credentials = new AWS.ChainableTemporaryCredentials({ - params: params, - }); - } - if (!Object.prototype.hasOwnProperty.call(AWS, call.service)) { - throw Error(`Service ${call.service} does not exist in AWS SDK version ${AWS.VERSION}.`); - } - const awsService = new AWS[call.service]({ - apiVersion: call.apiVersion, - credentials: credentials, - region: call.region, - }); - try { - const response = await awsService[call.action](call.parameters && decodeSpecialValues(call.parameters, physicalResourceId)).promise(); - flatData = { - apiVersion: awsService.config.apiVersion, - region: awsService.config.region, - ...flatten(response), - }; - let outputPaths; - if (call.outputPath) { - outputPaths = [call.outputPath]; - } - else if (call.outputPaths) { - outputPaths = call.outputPaths; - } - if (outputPaths) { - data = filterKeys(flatData, startsWithOneOf(outputPaths)); - } - else { - data = flatData; - } - } - catch (e) { - if (!call.ignoreErrorCodesMatching || !new RegExp(call.ignoreErrorCodesMatching).test(e.code)) { - throw e; - } - } - if ((_p = call.physicalResourceId) === null || _p === void 0 ? void 0 : _p.responsePath) { - physicalResourceId = flatData[call.physicalResourceId.responsePath]; - } - } - await respond('SUCCESS', 'OK', physicalResourceId, data); - } - catch (e) { - console.log(e); - await respond('FAILED', e.message || 'Internal Error', context.logStreamName, {}); - } - function respond(responseStatus, reason, physicalResourceId, data) { - const responseBody = JSON.stringify({ - Status: responseStatus, - Reason: reason, - PhysicalResourceId: physicalResourceId, - StackId: event.StackId, - RequestId: event.RequestId, - LogicalResourceId: event.LogicalResourceId, - NoEcho: false, - Data: data, - }); - console.log('Responding', responseBody); - // eslint-disable-next-line @typescript-eslint/no-require-imports - const parsedUrl = require('url').parse(event.ResponseURL); - const requestOptions = { - hostname: parsedUrl.hostname, - path: parsedUrl.path, - method: 'PUT', - headers: { 'content-type': '', 'content-length': responseBody.length }, - }; - return new Promise((resolve, reject) => { - try { - // eslint-disable-next-line @typescript-eslint/no-require-imports - const request = require('https').request(requestOptions, resolve); - request.on('error', reject); - request.write(responseBody); - request.end(); - } - catch (e) { - reject(e); - } - }); - } -} -exports.handler = handler; -function decodeCall(call) { - if (!call) { - return undefined; - } - return JSON.parse(call); -} -function startsWithOneOf(searchStrings) { - return function (string) { - for (const searchString of searchStrings) { - if (string.startsWith(searchString)) { - return true; - } - } - return false; - }; -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwrQkFBK0I7QUFDL0IsaURBQXlDO0FBQ3pDLHlCQUF5QjtBQUN6QiwrQkFBNEI7QUFTNUI7O0dBRUc7QUFDVSxRQUFBLDhCQUE4QixHQUFHLHNCQUFzQixDQUFDO0FBRXJFOzs7OztHQUtHO0FBQ0gsU0FBZ0IsT0FBTyxDQUFDLE1BQWM7SUFDcEMsT0FBTyxNQUFNLENBQUMsTUFBTSxDQUNsQixFQUFFLEVBQ0YsR0FBRyxTQUFTLFFBQVEsQ0FBQyxLQUFVLEVBQUUsT0FBaUIsRUFBRTtRQUNsRCxPQUFPLEVBQUUsQ0FBQyxNQUFNLENBQUMsR0FBRyxNQUFNLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQzthQUNuQyxHQUFHLENBQUMsR0FBRyxDQUFDLEVBQUU7WUFDVCxNQUFNLFFBQVEsR0FBRyxNQUFNLENBQUMsUUFBUSxDQUFDLEtBQUssQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLENBQUMsUUFBUSxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUMsQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLENBQUM7WUFDeEYsT0FBTyxPQUFPLFFBQVEsS0FBSyxRQUFRLElBQUksUUFBUSxLQUFLLElBQUk7Z0JBQ3RELENBQUMsQ0FBQyxRQUFRLENBQUMsUUFBUSxFQUFFLElBQUksQ0FBQyxNQUFNLENBQUMsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDO2dCQUN4QyxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUMsSUFBSSxDQUFDLE1BQU0sQ0FBQyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLEdBQUcsQ0FBQyxDQUFDLEVBQUUsUUFBUSxFQUFFLENBQUMsQ0FBQztRQUNyRCxDQUFDLENBQUMsQ0FBQyxDQUFDO0lBQ1IsQ0FBQyxDQUFDLE1BQU0sQ0FBQyxDQUNWLENBQUM7QUFDSixDQUFDO0FBYkQsMEJBYUM7QUFFRDs7R0FFRztBQUNILFNBQVMsbUJBQW1CLENBQUMsTUFBYyxFQUFFLGtCQUEwQjtJQUNyRSxPQUFPLElBQUksQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLFNBQVMsQ0FBQyxNQUFNLENBQUMsRUFBRSxDQUFDLEVBQUUsRUFBRSxDQUFDLEVBQUUsRUFBRTtRQUNsRCxRQUFRLENBQUMsRUFBRTtZQUNULEtBQUssc0NBQThCO2dCQUNqQyxPQUFPLGtCQUFrQixDQUFDO1lBQzVCO2dCQUNFLE9BQU8sQ0FBQyxDQUFDO1NBQ1o7SUFDSCxDQUFDLENBQUMsQ0FBQztBQUNMLENBQUM7QUFFRDs7R0FFRztBQUNILFNBQVMsVUFBVSxDQUFDLE1BQWMsRUFBRSxJQUE4QjtJQUNoRSxPQUFPLE1BQU0sQ0FBQyxPQUFPLENBQUMsTUFBTSxDQUFDO1NBQzFCLE1BQU0sQ0FDTCxDQUFDLEdBQUcsRUFBRSxDQUFDLENBQUMsRUFBRSxDQUFDLENBQUMsRUFBRSxFQUFFLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQztRQUN0QixDQUFDLENBQUMsRUFBRSxHQUFHLEdBQUcsRUFBRSxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUMsRUFBRTtRQUNwQixDQUFDLENBQUMsR0FBRyxFQUNQLEVBQUUsQ0FDSCxDQUFDO0FBQ04sQ0FBQztBQUVELElBQUksa0JBQWtCLEdBQUcsS0FBSyxDQUFDO0FBRS9CLFNBQWdCLG9CQUFvQjtJQUNsQyxrQkFBa0IsR0FBRyxLQUFLLENBQUM7QUFDN0IsQ0FBQztBQUZELG9EQUVDO0FBRUQ7O0dBRUc7QUFDSCxTQUFTLGdCQUFnQjtJQUN2QixPQUFPLENBQUMsR0FBRyxDQUFDLDhCQUE4QixDQUFDLENBQUM7SUFDNUMsb0ZBQW9GO0lBQ3BGLHdCQUFRLENBQUMsd0ZBQXdGLENBQUMsQ0FBQztJQUNuRyxrQkFBa0IsR0FBRyxJQUFJLENBQUM7QUFDNUIsQ0FBQztBQUVELGdDQUFnQztBQUNoQyxNQUFNLGVBQWUsR0FBcUQsRUFBRSxDQUFDO0FBQzdFOztHQUVHO0FBQ0gsU0FBUyxRQUFRLENBQUMsTUFBVztJQUMzQixNQUFNLFNBQVMsR0FBRyxNQUFNLENBQUMsU0FBUyxDQUFDO0lBQ25DLGVBQWUsQ0FBQyxPQUFPLENBQUMsQ0FBQyxFQUFFLFdBQVcsRUFBRSxXQUFXLEVBQUUsRUFBRSxFQUFFO1FBQ3ZELE1BQU0sZ0JBQWdCLEdBQUcsV0FBVyxDQUFDLFdBQVcsRUFBRSxDQUFDO1FBQ25ELElBQUksQ0FBQyxNQUFNLENBQUMsT0FBTyxDQUFDLFVBQVUsQ0FBQyxnQkFBZ0IsQ0FBQyxFQUFFO1lBQ2hELFNBQVMsQ0FBQyxRQUFRLENBQUMsZ0JBQWdCLENBQUMsR0FBRyxFQUFFLENBQUM7WUFDMUMsTUFBTSxDQUFDLFdBQVcsQ0FBQyxHQUFHLE1BQU0sQ0FBQyxPQUFPLENBQUMsYUFBYSxDQUFDLGdCQUFnQixFQUFFLFdBQVcsQ0FBQyxDQUFDO1NBQ25GO2FBQU07WUFDTCxNQUFNLENBQUMsT0FBTyxDQUFDLFdBQVcsQ0FBQyxNQUFNLENBQUMsV0FBVyxDQUFDLEVBQUUsV0FBVyxDQUFDLENBQUM7U0FDOUQ7UUFDRCxXQUFXLENBQUMsT0FBTyxDQUFDLFVBQVUsQ0FBQyxFQUFFO1lBQy9CLE1BQU0sQ0FBQyxjQUFjLENBQUMsU0FBUyxDQUFDLFFBQVEsQ0FBQyxnQkFBZ0IsQ0FBQyxFQUFFLFVBQVUsRUFBRTtnQkFDdEUsR0FBRyxFQUFFLFNBQVMsR0FBRztvQkFDZixNQUFNLGVBQWUsR0FBRyxpQkFBaUIsZ0JBQWdCLElBQUksVUFBVSxFQUFFLENBQUM7b0JBQzFFLE1BQU0sS0FBSyxHQUFHLElBQUksQ0FBQyxLQUFLLENBQUMsRUFBRSxDQUFDLFlBQVksQ0FBQyxXQUFJLENBQUMsU0FBUyxFQUFFLEdBQUcsZUFBZSxlQUFlLENBQUMsRUFBRSxPQUFPLENBQUMsQ0FBQyxDQUFDO29CQUN2RyxLQUFLLENBQUMsVUFBVSxHQUFHLElBQUksQ0FBQyxLQUFLLENBQUMsRUFBRSxDQUFDLFlBQVksQ0FBQyxXQUFJLENBQUMsU0FBUyxFQUFFLEdBQUcsZUFBZSxrQkFBa0IsQ0FBQyxFQUFFLE9BQU8sQ0FBQyxDQUFDLENBQUMsVUFBVSxDQUFDO29CQUMxSCxPQUFPLEtBQUssQ0FBQztnQkFDZixDQUFDO2dCQUNELFVBQVUsRUFBRSxJQUFJO2dCQUNoQixZQUFZLEVBQUUsSUFBSTthQUNuQixDQUFDLENBQUM7UUFDTCxDQUFDLENBQUMsQ0FBQztJQUNMLENBQUMsQ0FBQyxDQUFDO0lBQ0gsT0FBTyxNQUFNLENBQUM7QUFDaEIsQ0FBQztBQUVELDZGQUE2RjtBQUN0RixLQUFLLFVBQVUsT0FBTyxDQUFDLEtBQWtELEVBQUUsT0FBMEI7O0lBQzFHLElBQUk7UUFDRixJQUFJLEdBQVEsQ0FBQztRQUNiLElBQUksQ0FBQyxrQkFBa0IsSUFBSSxLQUFLLENBQUMsa0JBQWtCLENBQUMsbUJBQW1CLEtBQUssTUFBTSxFQUFFO1lBQ2xGLElBQUk7Z0JBQ0YsZ0JBQWdCLEVBQUUsQ0FBQztnQkFDbkIsR0FBRyxHQUFHLE9BQU8sQ0FBQywyQkFBMkIsQ0FBQyxDQUFDO2FBQzVDO1lBQUMsT0FBTyxDQUFDLEVBQUU7Z0JBQ1YsT0FBTyxDQUFDLEdBQUcsQ0FBQyx3Q0FBd0MsQ0FBQyxFQUFFLENBQUMsQ0FBQztnQkFDekQsR0FBRyxHQUFHLE9BQU8sQ0FBQyxTQUFTLENBQUMsQ0FBQyxDQUFDLG9DQUFvQzthQUMvRDtTQUNGO2FBQU0sSUFBSSxrQkFBa0IsRUFBRTtZQUM3QixHQUFHLEdBQUcsT0FBTyxDQUFDLDJCQUEyQixDQUFDLENBQUM7U0FDNUM7YUFBTTtZQUNMLEdBQUcsR0FBRyxPQUFPLENBQUMsU0FBUyxDQUFDLENBQUM7U0FDMUI7UUFDRCxJQUFJO1lBQ0YsR0FBRyxHQUFHLFFBQVEsQ0FBQyxHQUFHLENBQUMsQ0FBQztTQUNyQjtRQUFDLE9BQU8sQ0FBQyxFQUFFO1lBQ1YsT0FBTyxDQUFDLEdBQUcsQ0FBQyw0QkFBNEIsQ0FBQyx1Q0FBdUMsQ0FBQyxDQUFDO1NBQ25GO1FBRUQsT0FBTyxDQUFDLEdBQUcsQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUM7UUFDbkMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxtQkFBbUIsR0FBRyxHQUFHLENBQUMsT0FBTyxDQUFDLENBQUM7UUFFL0MsS0FBSyxDQUFDLGtCQUFrQixDQUFDLE1BQU0sR0FBRyxVQUFVLENBQUMsS0FBSyxDQUFDLGtCQUFrQixDQUFDLE1BQU0sQ0FBQyxDQUFDO1FBQzlFLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxNQUFNLEdBQUcsVUFBVSxDQUFDLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxNQUFNLENBQUMsQ0FBQztRQUM5RSxLQUFLLENBQUMsa0JBQWtCLENBQUMsTUFBTSxHQUFHLFVBQVUsQ0FBQyxLQUFLLENBQUMsa0JBQWtCLENBQUMsTUFBTSxDQUFDLENBQUM7UUFDOUUsK0JBQStCO1FBQy9CLElBQUksa0JBQTBCLENBQUM7UUFDL0IsUUFBUSxLQUFLLENBQUMsV0FBVyxFQUFFO1lBQ3pCLEtBQUssUUFBUTtnQkFDWCxrQkFBa0IsaUNBQUcsS0FBSyxDQUFDLGtCQUFrQixDQUFDLE1BQU0sMENBQUUsa0JBQWtCLDBDQUFFLEVBQUUsK0NBQ3ZELEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxNQUFNLDBDQUFFLGtCQUFrQiwwQ0FBRSxFQUFFLCtDQUN2RCxLQUFLLENBQUMsa0JBQWtCLENBQUMsTUFBTSwwQ0FBRSxrQkFBa0IsMENBQUUsRUFBRSxtQ0FDdkQsS0FBSyxDQUFDLGlCQUFpQixDQUFDO2dCQUM3QyxNQUFNO1lBQ1IsS0FBSyxRQUFRLENBQUM7WUFDZCxLQUFLLFFBQVE7Z0JBQ1gsa0JBQWtCLHFCQUFHLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxLQUFLLENBQUMsV0FBVyxDQUFDLDBDQUFFLGtCQUFrQiwwQ0FBRSxFQUFFLG1DQUFJLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQztnQkFDckgsTUFBTTtTQUNUO1FBRUQsSUFBSSxRQUFRLEdBQThCLEVBQUUsQ0FBQztRQUM3QyxJQUFJLElBQUksR0FBOEIsRUFBRSxDQUFDO1FBQ3pDLE1BQU0sSUFBSSxHQUEyQixLQUFLLENBQUMsa0JBQWtCLENBQUMsS0FBSyxDQUFDLFdBQVcsQ0FBQyxDQUFDO1FBRWpGLElBQUksSUFBSSxFQUFFO1lBRVIsSUFBSSxXQUFXLENBQUM7WUFDaEIsSUFBSSxJQUFJLENBQUMsY0FBYyxFQUFFO2dCQUN2QixNQUFNLFNBQVMsR0FBRyxDQUFDLElBQUksSUFBSSxFQUFFLENBQUMsQ0FBQyxPQUFPLEVBQUUsQ0FBQztnQkFFekMsTUFBTSxNQUFNLEdBQUc7b0JBQ2IsT0FBTyxFQUFFLElBQUksQ0FBQyxjQUFjO29CQUM1QixlQUFlLEVBQUUsR0FBRyxTQUFTLElBQUksa0JBQWtCLEVBQUUsQ0FBQyxTQUFTLENBQUMsQ0FBQyxFQUFFLEVBQUUsQ0FBQztpQkFDdkUsQ0FBQztnQkFFRixXQUFXLEdBQUcsSUFBSSxHQUFHLENBQUMsNkJBQTZCLENBQUM7b0JBQ2xELE1BQU0sRUFBRSxNQUFNO2lCQUNmLENBQUMsQ0FBQzthQUNKO1lBRUQsSUFBSSxDQUFDLE1BQU0sQ0FBQyxTQUFTLENBQUMsY0FBYyxDQUFDLElBQUksQ0FBQyxHQUFHLEVBQUUsSUFBSSxDQUFDLE9BQU8sQ0FBQyxFQUFFO2dCQUM1RCxNQUFNLEtBQUssQ0FBQyxXQUFXLElBQUksQ0FBQyxPQUFPLHNDQUFzQyxHQUFHLENBQUMsT0FBTyxHQUFHLENBQUMsQ0FBQzthQUMxRjtZQUNELE1BQU0sVUFBVSxHQUFHLElBQUssR0FBVyxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsQ0FBQztnQkFDaEQsVUFBVSxFQUFFLElBQUksQ0FBQyxVQUFVO2dCQUMzQixXQUFXLEVBQUUsV0FBVztnQkFDeEIsTUFBTSxFQUFFLElBQUksQ0FBQyxNQUFNO2FBQ3BCLENBQUMsQ0FBQztZQUVILElBQUk7Z0JBQ0YsTUFBTSxRQUFRLEdBQUcsTUFBTSxVQUFVLENBQUMsSUFBSSxDQUFDLE1BQU0sQ0FBQyxDQUM1QyxJQUFJLENBQUMsVUFBVSxJQUFJLG1CQUFtQixDQUFDLElBQUksQ0FBQyxVQUFVLEVBQUUsa0JBQWtCLENBQUMsQ0FBQyxDQUFDLE9BQU8sRUFBRSxDQUFDO2dCQUN6RixRQUFRLEdBQUc7b0JBQ1QsVUFBVSxFQUFFLFVBQVUsQ0FBQyxNQUFNLENBQUMsVUFBVTtvQkFDeEMsTUFBTSxFQUFFLFVBQVUsQ0FBQyxNQUFNLENBQUMsTUFBTTtvQkFDaEMsR0FBRyxPQUFPLENBQUMsUUFBUSxDQUFDO2lCQUNyQixDQUFDO2dCQUVGLElBQUksV0FBaUMsQ0FBQztnQkFDdEMsSUFBSSxJQUFJLENBQUMsVUFBVSxFQUFFO29CQUNuQixXQUFXLEdBQUcsQ0FBQyxJQUFJLENBQUMsVUFBVSxDQUFDLENBQUM7aUJBQ2pDO3FCQUFNLElBQUksSUFBSSxDQUFDLFdBQVcsRUFBRTtvQkFDM0IsV0FBVyxHQUFHLElBQUksQ0FBQyxXQUFXLENBQUM7aUJBQ2hDO2dCQUVELElBQUksV0FBVyxFQUFFO29CQUNmLElBQUksR0FBRyxVQUFVLENBQUMsUUFBUSxFQUFFLGVBQWUsQ0FBQyxXQUFXLENBQUMsQ0FBQyxDQUFDO2lCQUMzRDtxQkFBTTtvQkFDTCxJQUFJLEdBQUcsUUFBUSxDQUFDO2lCQUNqQjthQUNGO1lBQUMsT0FBTyxDQUFDLEVBQUU7Z0JBQ1YsSUFBSSxDQUFDLElBQUksQ0FBQyx3QkFBd0IsSUFBSSxDQUFDLElBQUksTUFBTSxDQUFDLElBQUksQ0FBQyx3QkFBd0IsQ0FBQyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLEVBQUU7b0JBQzdGLE1BQU0sQ0FBQyxDQUFDO2lCQUNUO2FBQ0Y7WUFFRCxVQUFJLElBQUksQ0FBQyxrQkFBa0IsMENBQUUsWUFBWSxFQUFFO2dCQUN6QyxrQkFBa0IsR0FBRyxRQUFRLENBQUMsSUFBSSxDQUFDLGtCQUFrQixDQUFDLFlBQVksQ0FBQyxDQUFDO2FBQ3JFO1NBQ0Y7UUFFRCxNQUFNLE9BQU8sQ0FBQyxTQUFTLEVBQUUsSUFBSSxFQUFFLGtCQUFrQixFQUFFLElBQUksQ0FBQyxDQUFDO0tBQzFEO0lBQUMsT0FBTyxDQUFDLEVBQUU7UUFDVixPQUFPLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBQ2YsTUFBTSxPQUFPLENBQUMsUUFBUSxFQUFFLENBQUMsQ0FBQyxPQUFPLElBQUksZ0JBQWdCLEVBQUUsT0FBTyxDQUFDLGFBQWEsRUFBRSxFQUFFLENBQUMsQ0FBQztLQUNuRjtJQUVELFNBQVMsT0FBTyxDQUFDLGNBQXNCLEVBQUUsTUFBYyxFQUFFLGtCQUEwQixFQUFFLElBQVM7UUFDNUYsTUFBTSxZQUFZLEdBQUcsSUFBSSxDQUFDLFNBQVMsQ0FBQztZQUNsQyxNQUFNLEVBQUUsY0FBYztZQUN0QixNQUFNLEVBQUUsTUFBTTtZQUNkLGtCQUFrQixFQUFFLGtCQUFrQjtZQUN0QyxPQUFPLEVBQUUsS0FBSyxDQUFDLE9BQU87WUFDdEIsU0FBUyxFQUFFLEtBQUssQ0FBQyxTQUFTO1lBQzFCLGlCQUFpQixFQUFFLEtBQUssQ0FBQyxpQkFBaUI7WUFDMUMsTUFBTSxFQUFFLEtBQUs7WUFDYixJQUFJLEVBQUUsSUFBSTtTQUNYLENBQUMsQ0FBQztRQUVILE9BQU8sQ0FBQyxHQUFHLENBQUMsWUFBWSxFQUFFLFlBQVksQ0FBQyxDQUFDO1FBRXhDLGlFQUFpRTtRQUNqRSxNQUFNLFNBQVMsR0FBRyxPQUFPLENBQUMsS0FBSyxDQUFDLENBQUMsS0FBSyxDQUFDLEtBQUssQ0FBQyxXQUFXLENBQUMsQ0FBQztRQUMxRCxNQUFNLGNBQWMsR0FBRztZQUNyQixRQUFRLEVBQUUsU0FBUyxDQUFDLFFBQVE7WUFDNUIsSUFBSSxFQUFFLFNBQVMsQ0FBQyxJQUFJO1lBQ3BCLE1BQU0sRUFBRSxLQUFLO1lBQ2IsT0FBTyxFQUFFLEVBQUUsY0FBYyxFQUFFLEVBQUUsRUFBRSxnQkFBZ0IsRUFBRSxZQUFZLENBQUMsTUFBTSxFQUFFO1NBQ3ZFLENBQUM7UUFFRixPQUFPLElBQUksT0FBTyxDQUFDLENBQUMsT0FBTyxFQUFFLE1BQU0sRUFBRSxFQUFFO1lBQ3JDLElBQUk7Z0JBQ0YsaUVBQWlFO2dCQUNqRSxNQUFNLE9BQU8sR0FBRyxPQUFPLENBQUMsT0FBTyxDQUFDLENBQUMsT0FBTyxDQUFDLGNBQWMsRUFBRSxPQUFPLENBQUMsQ0FBQztnQkFDbEUsT0FBTyxDQUFDLEVBQUUsQ0FBQyxPQUFPLEVBQUUsTUFBTSxDQUFDLENBQUM7Z0JBQzVCLE9BQU8sQ0FBQyxLQUFLLENBQUMsWUFBWSxDQUFDLENBQUM7Z0JBQzVCLE9BQU8sQ0FBQyxHQUFHLEVBQUUsQ0FBQzthQUNmO1lBQUMsT0FBTyxDQUFDLEVBQUU7Z0JBQ1YsTUFBTSxDQUFDLENBQUMsQ0FBQyxDQUFDO2FBQ1g7UUFDSCxDQUFDLENBQUMsQ0FBQztJQUNMLENBQUM7QUFDSCxDQUFDO0FBakpELDBCQWlKQztBQUVELFNBQVMsVUFBVSxDQUFDLElBQXdCO0lBQzFDLElBQUksQ0FBQyxJQUFJLEVBQUU7UUFBRSxPQUFPLFNBQVMsQ0FBQztLQUFFO0lBQ2hDLE9BQU8sSUFBSSxDQUFDLEtBQUssQ0FBQyxJQUFJLENBQUMsQ0FBQztBQUMxQixDQUFDO0FBRUQsU0FBUyxlQUFlLENBQUMsYUFBdUI7SUFDOUMsT0FBTyxVQUFTLE1BQWM7UUFDNUIsS0FBSyxNQUFNLFlBQVksSUFBSSxhQUFhLEVBQUU7WUFDeEMsSUFBSSxNQUFNLENBQUMsVUFBVSxDQUFDLFlBQVksQ0FBQyxFQUFFO2dCQUNuQyxPQUFPLElBQUksQ0FBQzthQUNiO1NBQ0Y7UUFDRCxPQUFPLEtBQUssQ0FBQztJQUNmLENBQUMsQ0FBQztBQUNKLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKiBlc2xpbnQtZGlzYWJsZSBuby1jb25zb2xlICovXG5pbXBvcnQgeyBleGVjU3luYyB9IGZyb20gJ2NoaWxkX3Byb2Nlc3MnO1xuaW1wb3J0ICogYXMgZnMgZnJvbSAnZnMnO1xuaW1wb3J0IHsgam9pbiB9IGZyb20gJ3BhdGgnO1xuLy8gaW1wb3J0IHRoZSBBV1NMYW1iZGEgcGFja2FnZSBleHBsaWNpdGx5LFxuLy8gd2hpY2ggaXMgZ2xvYmFsbHkgYXZhaWxhYmxlIGluIHRoZSBMYW1iZGEgcnVudGltZSxcbi8vIGFzIG90aGVyd2lzZSBsaW5raW5nIHRoaXMgcmVwb3NpdG9yeSB3aXRoIGxpbmstYWxsLnNoXG4vLyBmYWlscyBpbiB0aGUgQ0RLIGFwcCBleGVjdXRlZCB3aXRoIHRzLW5vZGVcbi8qIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBpbXBvcnQvbm8tZXh0cmFuZW91cy1kZXBlbmRlbmNpZXMsaW1wb3J0L25vLXVucmVzb2x2ZWQgKi9cbmltcG9ydCAqIGFzIEFXU0xhbWJkYSBmcm9tICdhd3MtbGFtYmRhJztcbmltcG9ydCB7IEF3c1Nka0NhbGwgfSBmcm9tICcuLi9hd3MtY3VzdG9tLXJlc291cmNlJztcblxuLyoqXG4gKiBTZXJpYWxpemVkIGZvcm0gb2YgdGhlIHBoeXNpY2FsIHJlc291cmNlIGlkIGZvciB1c2UgaW4gdGhlIG9wZXJhdGlvbiBwYXJhbWV0ZXJzXG4gKi9cbmV4cG9ydCBjb25zdCBQSFlTSUNBTF9SRVNPVVJDRV9JRF9SRUZFUkVOQ0UgPSAnUEhZU0lDQUw6UkVTT1VSQ0VJRDonO1xuXG4vKipcbiAqIEZsYXR0ZW5zIGEgbmVzdGVkIG9iamVjdFxuICpcbiAqIEBwYXJhbSBvYmplY3QgdGhlIG9iamVjdCB0byBiZSBmbGF0dGVuZWRcbiAqIEByZXR1cm5zIGEgZmxhdCBvYmplY3Qgd2l0aCBwYXRoIGFzIGtleXNcbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGZsYXR0ZW4ob2JqZWN0OiBvYmplY3QpOiB7IFtrZXk6IHN0cmluZ106IGFueSB9IHtcbiAgcmV0dXJuIE9iamVjdC5hc3NpZ24oXG4gICAge30sXG4gICAgLi4uZnVuY3Rpb24gX2ZsYXR0ZW4oY2hpbGQ6IGFueSwgcGF0aDogc3RyaW5nW10gPSBbXSk6IGFueSB7XG4gICAgICByZXR1cm4gW10uY29uY2F0KC4uLk9iamVjdC5rZXlzKGNoaWxkKVxuICAgICAgICAubWFwKGtleSA9PiB7XG4gICAgICAgICAgY29uc3QgY2hpbGRLZXkgPSBCdWZmZXIuaXNCdWZmZXIoY2hpbGRba2V5XSkgPyBjaGlsZFtrZXldLnRvU3RyaW5nKCd1dGY4JykgOiBjaGlsZFtrZXldO1xuICAgICAgICAgIHJldHVybiB0eXBlb2YgY2hpbGRLZXkgPT09ICdvYmplY3QnICYmIGNoaWxkS2V5ICE9PSBudWxsXG4gICAgICAgICAgICA/IF9mbGF0dGVuKGNoaWxkS2V5LCBwYXRoLmNvbmNhdChba2V5XSkpXG4gICAgICAgICAgICA6ICh7IFtwYXRoLmNvbmNhdChba2V5XSkuam9pbignLicpXTogY2hpbGRLZXkgfSk7XG4gICAgICAgIH0pKTtcbiAgICB9KG9iamVjdCksXG4gICk7XG59XG5cbi8qKlxuICogRGVjb2RlcyBlbmNvZGVkIHNwZWNpYWwgdmFsdWVzIChwaHlzaWNhbFJlc291cmNlSWQpXG4gKi9cbmZ1bmN0aW9uIGRlY29kZVNwZWNpYWxWYWx1ZXMob2JqZWN0OiBvYmplY3QsIHBoeXNpY2FsUmVzb3VyY2VJZDogc3RyaW5nKSB7XG4gIHJldHVybiBKU09OLnBhcnNlKEpTT04uc3RyaW5naWZ5KG9iamVjdCksIChfaywgdikgPT4ge1xuICAgIHN3aXRjaCAodikge1xuICAgICAgY2FzZSBQSFlTSUNBTF9SRVNPVVJDRV9JRF9SRUZFUkVOQ0U6XG4gICAgICAgIHJldHVybiBwaHlzaWNhbFJlc291cmNlSWQ7XG4gICAgICBkZWZhdWx0OlxuICAgICAgICByZXR1cm4gdjtcbiAgICB9XG4gIH0pO1xufVxuXG4vKipcbiAqIEZpbHRlcnMgdGhlIGtleXMgb2YgYW4gb2JqZWN0LlxuICovXG5mdW5jdGlvbiBmaWx0ZXJLZXlzKG9iamVjdDogb2JqZWN0LCBwcmVkOiAoa2V5OiBzdHJpbmcpID0+IGJvb2xlYW4pIHtcbiAgcmV0dXJuIE9iamVjdC5lbnRyaWVzKG9iamVjdClcbiAgICAucmVkdWNlKFxuICAgICAgKGFjYywgW2ssIHZdKSA9PiBwcmVkKGspXG4gICAgICAgID8geyAuLi5hY2MsIFtrXTogdiB9XG4gICAgICAgIDogYWNjLFxuICAgICAge30sXG4gICAgKTtcbn1cblxubGV0IGxhdGVzdFNka0luc3RhbGxlZCA9IGZhbHNlO1xuXG5leHBvcnQgZnVuY3Rpb24gZm9yY2VTZGtJbnN0YWxsYXRpb24oKSB7XG4gIGxhdGVzdFNka0luc3RhbGxlZCA9IGZhbHNlO1xufVxuXG4vKipcbiAqIEluc3RhbGxzIGxhdGVzdCBBV1MgU0RLIHYyXG4gKi9cbmZ1bmN0aW9uIGluc3RhbGxMYXRlc3RTZGsoKTogdm9pZCB7XG4gIGNvbnNvbGUubG9nKCdJbnN0YWxsaW5nIGxhdGVzdCBBV1MgU0RLIHYyJyk7XG4gIC8vIEJvdGggSE9NRSBhbmQgLS1wcmVmaXggYXJlIG5lZWRlZCBoZXJlIGJlY2F1c2UgL3RtcCBpcyB0aGUgb25seSB3cml0YWJsZSBsb2NhdGlvblxuICBleGVjU3luYygnSE9NRT0vdG1wIG5wbSBpbnN0YWxsIGF3cy1zZGtAMiAtLXByb2R1Y3Rpb24gLS1uby1wYWNrYWdlLWxvY2sgLS1uby1zYXZlIC0tcHJlZml4IC90bXAnKTtcbiAgbGF0ZXN0U2RrSW5zdGFsbGVkID0gdHJ1ZTtcbn1cblxuLy8gbm8gY3VycmVudGx5IHBhdGNoZWQgc2VydmljZXNcbmNvbnN0IHBhdGNoZWRTZXJ2aWNlczogeyBzZXJ2aWNlTmFtZTogc3RyaW5nOyBhcGlWZXJzaW9uczogc3RyaW5nW10gfVtdID0gW107XG4vKipcbiAqIFBhdGNoZXMgdGhlIEFXUyBTREsgYnkgbG9hZGluZyBzZXJ2aWNlIG1vZGVscyBpbiB0aGUgc2FtZSBtYW5uZXIgYXMgdGhlIGFjdHVhbCBTREtcbiAqL1xuZnVuY3Rpb24gcGF0Y2hTZGsoYXdzU2RrOiBhbnkpOiBhbnkge1xuICBjb25zdCBhcGlMb2FkZXIgPSBhd3NTZGsuYXBpTG9hZGVyO1xuICBwYXRjaGVkU2VydmljZXMuZm9yRWFjaCgoeyBzZXJ2aWNlTmFtZSwgYXBpVmVyc2lvbnMgfSkgPT4ge1xuICAgIGNvbnN0IGxvd2VyU2VydmljZU5hbWUgPSBzZXJ2aWNlTmFtZS50b0xvd2VyQ2FzZSgpO1xuICAgIGlmICghYXdzU2RrLlNlcnZpY2UuaGFzU2VydmljZShsb3dlclNlcnZpY2VOYW1lKSkge1xuICAgICAgYXBpTG9hZGVyLnNlcnZpY2VzW2xvd2VyU2VydmljZU5hbWVdID0ge307XG4gICAgICBhd3NTZGtbc2VydmljZU5hbWVdID0gYXdzU2RrLlNlcnZpY2UuZGVmaW5lU2VydmljZShsb3dlclNlcnZpY2VOYW1lLCBhcGlWZXJzaW9ucyk7XG4gICAgfSBlbHNlIHtcbiAgICAgIGF3c1Nkay5TZXJ2aWNlLmFkZFZlcnNpb25zKGF3c1Nka1tzZXJ2aWNlTmFtZV0sIGFwaVZlcnNpb25zKTtcbiAgICB9XG4gICAgYXBpVmVyc2lvbnMuZm9yRWFjaChhcGlWZXJzaW9uID0+IHtcbiAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShhcGlMb2FkZXIuc2VydmljZXNbbG93ZXJTZXJ2aWNlTmFtZV0sIGFwaVZlcnNpb24sIHtcbiAgICAgICAgZ2V0OiBmdW5jdGlvbiBnZXQoKSB7XG4gICAgICAgICAgY29uc3QgbW9kZWxGaWxlUHJlZml4ID0gYGF3cy1zZGstcGF0Y2gvJHtsb3dlclNlcnZpY2VOYW1lfS0ke2FwaVZlcnNpb259YDtcbiAgICAgICAgICBjb25zdCBtb2RlbCA9IEpTT04ucGFyc2UoZnMucmVhZEZpbGVTeW5jKGpvaW4oX19kaXJuYW1lLCBgJHttb2RlbEZpbGVQcmVmaXh9LnNlcnZpY2UuanNvbmApLCAndXRmLTgnKSk7XG4gICAgICAgICAgbW9kZWwucGFnaW5hdG9ycyA9IEpTT04ucGFyc2UoZnMucmVhZEZpbGVTeW5jKGpvaW4oX19kaXJuYW1lLCBgJHttb2RlbEZpbGVQcmVmaXh9LnBhZ2luYXRvcnMuanNvbmApLCAndXRmLTgnKSkucGFnaW5hdGlvbjtcbiAgICAgICAgICByZXR1cm4gbW9kZWw7XG4gICAgICAgIH0sXG4gICAgICAgIGVudW1lcmFibGU6IHRydWUsXG4gICAgICAgIGNvbmZpZ3VyYWJsZTogdHJ1ZSxcbiAgICAgIH0pO1xuICAgIH0pO1xuICB9KTtcbiAgcmV0dXJuIGF3c1Nkaztcbn1cblxuLyogZXNsaW50LWRpc2FibGUgQHR5cGVzY3JpcHQtZXNsaW50L25vLXJlcXVpcmUtaW1wb3J0cywgaW1wb3J0L25vLWV4dHJhbmVvdXMtZGVwZW5kZW5jaWVzICovXG5leHBvcnQgYXN5bmMgZnVuY3Rpb24gaGFuZGxlcihldmVudDogQVdTTGFtYmRhLkNsb3VkRm9ybWF0aW9uQ3VzdG9tUmVzb3VyY2VFdmVudCwgY29udGV4dDogQVdTTGFtYmRhLkNvbnRleHQpIHtcbiAgdHJ5IHtcbiAgICBsZXQgQVdTOiBhbnk7XG4gICAgaWYgKCFsYXRlc3RTZGtJbnN0YWxsZWQgJiYgZXZlbnQuUmVzb3VyY2VQcm9wZXJ0aWVzLkluc3RhbGxMYXRlc3RBd3NTZGsgPT09ICd0cnVlJykge1xuICAgICAgdHJ5IHtcbiAgICAgICAgaW5zdGFsbExhdGVzdFNkaygpO1xuICAgICAgICBBV1MgPSByZXF1aXJlKCcvdG1wL25vZGVfbW9kdWxlcy9hd3Mtc2RrJyk7XG4gICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgIGNvbnNvbGUubG9nKGBGYWlsZWQgdG8gaW5zdGFsbCBsYXRlc3QgQVdTIFNESyB2MjogJHtlfWApO1xuICAgICAgICBBV1MgPSByZXF1aXJlKCdhd3Mtc2RrJyk7IC8vIEZhbGxiYWNrIHRvIHByZS1pbnN0YWxsZWQgdmVyc2lvblxuICAgICAgfVxuICAgIH0gZWxzZSBpZiAobGF0ZXN0U2RrSW5zdGFsbGVkKSB7XG4gICAgICBBV1MgPSByZXF1aXJlKCcvdG1wL25vZGVfbW9kdWxlcy9hd3Mtc2RrJyk7XG4gICAgfSBlbHNlIHtcbiAgICAgIEFXUyA9IHJlcXVpcmUoJ2F3cy1zZGsnKTtcbiAgICB9XG4gICAgdHJ5IHtcbiAgICAgIEFXUyA9IHBhdGNoU2RrKEFXUyk7XG4gICAgfSBjYXRjaCAoZSkge1xuICAgICAgY29uc29sZS5sb2coYEZhaWxlZCB0byBwYXRjaCBBV1MgU0RLOiAke2V9LiBQcm9jZWVkaW5nIHdpdGggdGhlIGluc3RhbGxlZCBjb3B5LmApO1xuICAgIH1cblxuICAgIGNvbnNvbGUubG9nKEpTT04uc3RyaW5naWZ5KGV2ZW50KSk7XG4gICAgY29uc29sZS5sb2coJ0FXUyBTREsgVkVSU0lPTjogJyArIEFXUy5WRVJTSU9OKTtcblxuICAgIGV2ZW50LlJlc291cmNlUHJvcGVydGllcy5DcmVhdGUgPSBkZWNvZGVDYWxsKGV2ZW50LlJlc291cmNlUHJvcGVydGllcy5DcmVhdGUpO1xuICAgIGV2ZW50LlJlc291cmNlUHJvcGVydGllcy5VcGRhdGUgPSBkZWNvZGVDYWxsKGV2ZW50LlJlc291cmNlUHJvcGVydGllcy5VcGRhdGUpO1xuICAgIGV2ZW50LlJlc291cmNlUHJvcGVydGllcy5EZWxldGUgPSBkZWNvZGVDYWxsKGV2ZW50LlJlc291cmNlUHJvcGVydGllcy5EZWxldGUpO1xuICAgIC8vIERlZmF1bHQgcGh5c2ljYWwgcmVzb3VyY2UgaWRcbiAgICBsZXQgcGh5c2ljYWxSZXNvdXJjZUlkOiBzdHJpbmc7XG4gICAgc3dpdGNoIChldmVudC5SZXF1ZXN0VHlwZSkge1xuICAgICAgY2FzZSAnQ3JlYXRlJzpcbiAgICAgICAgcGh5c2ljYWxSZXNvdXJjZUlkID0gZXZlbnQuUmVzb3VyY2VQcm9wZXJ0aWVzLkNyZWF0ZT8ucGh5c2ljYWxSZXNvdXJjZUlkPy5pZCA/P1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldmVudC5SZXNvdXJjZVByb3BlcnRpZXMuVXBkYXRlPy5waHlzaWNhbFJlc291cmNlSWQ/LmlkID8/XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50LlJlc291cmNlUHJvcGVydGllcy5EZWxldGU/LnBoeXNpY2FsUmVzb3VyY2VJZD8uaWQgPz9cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnQuTG9naWNhbFJlc291cmNlSWQ7XG4gICAgICAgIGJyZWFrO1xuICAgICAgY2FzZSAnVXBkYXRlJzpcbiAgICAgIGNhc2UgJ0RlbGV0ZSc6XG4gICAgICAgIHBoeXNpY2FsUmVzb3VyY2VJZCA9IGV2ZW50LlJlc291cmNlUHJvcGVydGllc1tldmVudC5SZXF1ZXN0VHlwZV0/LnBoeXNpY2FsUmVzb3VyY2VJZD8uaWQgPz8gZXZlbnQuUGh5c2ljYWxSZXNvdXJjZUlkO1xuICAgICAgICBicmVhaztcbiAgICB9XG5cbiAgICBsZXQgZmxhdERhdGE6IHsgW2tleTogc3RyaW5nXTogc3RyaW5nIH0gPSB7fTtcbiAgICBsZXQgZGF0YTogeyBba2V5OiBzdHJpbmddOiBzdHJpbmcgfSA9IHt9O1xuICAgIGNvbnN0IGNhbGw6IEF3c1Nka0NhbGwgfCB1bmRlZmluZWQgPSBldmVudC5SZXNvdXJjZVByb3BlcnRpZXNbZXZlbnQuUmVxdWVzdFR5cGVdO1xuXG4gICAgaWYgKGNhbGwpIHtcblxuICAgICAgbGV0IGNyZWRlbnRpYWxzO1xuICAgICAgaWYgKGNhbGwuYXNzdW1lZFJvbGVBcm4pIHtcbiAgICAgICAgY29uc3QgdGltZXN0YW1wID0gKG5ldyBEYXRlKCkpLmdldFRpbWUoKTtcblxuICAgICAgICBjb25zdCBwYXJhbXMgPSB7XG4gICAgICAgICAgUm9sZUFybjogY2FsbC5hc3N1bWVkUm9sZUFybixcbiAgICAgICAgICBSb2xlU2Vzc2lvbk5hbWU6IGAke3RpbWVzdGFtcH0tJHtwaHlzaWNhbFJlc291cmNlSWR9YC5zdWJzdHJpbmcoMCwgNjQpLFxuICAgICAgICB9O1xuXG4gICAgICAgIGNyZWRlbnRpYWxzID0gbmV3IEFXUy5DaGFpbmFibGVUZW1wb3JhcnlDcmVkZW50aWFscyh7XG4gICAgICAgICAgcGFyYW1zOiBwYXJhbXMsXG4gICAgICAgIH0pO1xuICAgICAgfVxuXG4gICAgICBpZiAoIU9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChBV1MsIGNhbGwuc2VydmljZSkpIHtcbiAgICAgICAgdGhyb3cgRXJyb3IoYFNlcnZpY2UgJHtjYWxsLnNlcnZpY2V9IGRvZXMgbm90IGV4aXN0IGluIEFXUyBTREsgdmVyc2lvbiAke0FXUy5WRVJTSU9OfS5gKTtcbiAgICAgIH1cbiAgICAgIGNvbnN0IGF3c1NlcnZpY2UgPSBuZXcgKEFXUyBhcyBhbnkpW2NhbGwuc2VydmljZV0oe1xuICAgICAgICBhcGlWZXJzaW9uOiBjYWxsLmFwaVZlcnNpb24sXG4gICAgICAgIGNyZWRlbnRpYWxzOiBjcmVkZW50aWFscyxcbiAgICAgICAgcmVnaW9uOiBjYWxsLnJlZ2lvbixcbiAgICAgIH0pO1xuXG4gICAgICB0cnkge1xuICAgICAgICBjb25zdCByZXNwb25zZSA9IGF3YWl0IGF3c1NlcnZpY2VbY2FsbC5hY3Rpb25dKFxuICAgICAgICAgIGNhbGwucGFyYW1ldGVycyAmJiBkZWNvZGVTcGVjaWFsVmFsdWVzKGNhbGwucGFyYW1ldGVycywgcGh5c2ljYWxSZXNvdXJjZUlkKSkucHJvbWlzZSgpO1xuICAgICAgICBmbGF0RGF0YSA9IHtcbiAgICAgICAgICBhcGlWZXJzaW9uOiBhd3NTZXJ2aWNlLmNvbmZpZy5hcGlWZXJzaW9uLCAvLyBGb3IgdGVzdCBwdXJwb3NlczogY2hlY2sgaWYgYXBpVmVyc2lvbiB3YXMgY29ycmVjdGx5IHBhc3NlZC5cbiAgICAgICAgICByZWdpb246IGF3c1NlcnZpY2UuY29uZmlnLnJlZ2lvbiwgLy8gRm9yIHRlc3QgcHVycG9zZXM6IGNoZWNrIGlmIHJlZ2lvbiB3YXMgY29ycmVjdGx5IHBhc3NlZC5cbiAgICAgICAgICAuLi5mbGF0dGVuKHJlc3BvbnNlKSxcbiAgICAgICAgfTtcblxuICAgICAgICBsZXQgb3V0cHV0UGF0aHM6IHN0cmluZ1tdIHwgdW5kZWZpbmVkO1xuICAgICAgICBpZiAoY2FsbC5vdXRwdXRQYXRoKSB7XG4gICAgICAgICAgb3V0cHV0UGF0aHMgPSBbY2FsbC5vdXRwdXRQYXRoXTtcbiAgICAgICAgfSBlbHNlIGlmIChjYWxsLm91dHB1dFBhdGhzKSB7XG4gICAgICAgICAgb3V0cHV0UGF0aHMgPSBjYWxsLm91dHB1dFBhdGhzO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKG91dHB1dFBhdGhzKSB7XG4gICAgICAgICAgZGF0YSA9IGZpbHRlcktleXMoZmxhdERhdGEsIHN0YXJ0c1dpdGhPbmVPZihvdXRwdXRQYXRocykpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIGRhdGEgPSBmbGF0RGF0YTtcbiAgICAgICAgfVxuICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICBpZiAoIWNhbGwuaWdub3JlRXJyb3JDb2Rlc01hdGNoaW5nIHx8ICFuZXcgUmVnRXhwKGNhbGwuaWdub3JlRXJyb3JDb2Rlc01hdGNoaW5nKS50ZXN0KGUuY29kZSkpIHtcbiAgICAgICAgICB0aHJvdyBlO1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIGlmIChjYWxsLnBoeXNpY2FsUmVzb3VyY2VJZD8ucmVzcG9uc2VQYXRoKSB7XG4gICAgICAgIHBoeXNpY2FsUmVzb3VyY2VJZCA9IGZsYXREYXRhW2NhbGwucGh5c2ljYWxSZXNvdXJjZUlkLnJlc3BvbnNlUGF0aF07XG4gICAgICB9XG4gICAgfVxuXG4gICAgYXdhaXQgcmVzcG9uZCgnU1VDQ0VTUycsICdPSycsIHBoeXNpY2FsUmVzb3VyY2VJZCwgZGF0YSk7XG4gIH0gY2F0Y2ggKGUpIHtcbiAgICBjb25zb2xlLmxvZyhlKTtcbiAgICBhd2FpdCByZXNwb25kKCdGQUlMRUQnLCBlLm1lc3NhZ2UgfHwgJ0ludGVybmFsIEVycm9yJywgY29udGV4dC5sb2dTdHJlYW1OYW1lLCB7fSk7XG4gIH1cblxuICBmdW5jdGlvbiByZXNwb25kKHJlc3BvbnNlU3RhdHVzOiBzdHJpbmcsIHJlYXNvbjogc3RyaW5nLCBwaHlzaWNhbFJlc291cmNlSWQ6IHN0cmluZywgZGF0YTogYW55KSB7XG4gICAgY29uc3QgcmVzcG9uc2VCb2R5ID0gSlNPTi5zdHJpbmdpZnkoe1xuICAgICAgU3RhdHVzOiByZXNwb25zZVN0YXR1cyxcbiAgICAgIFJlYXNvbjogcmVhc29uLFxuICAgICAgUGh5c2ljYWxSZXNvdXJjZUlkOiBwaHlzaWNhbFJlc291cmNlSWQsXG4gICAgICBTdGFja0lkOiBldmVudC5TdGFja0lkLFxuICAgICAgUmVxdWVzdElkOiBldmVudC5SZXF1ZXN0SWQsXG4gICAgICBMb2dpY2FsUmVzb3VyY2VJZDogZXZlbnQuTG9naWNhbFJlc291cmNlSWQsXG4gICAgICBOb0VjaG86IGZhbHNlLFxuICAgICAgRGF0YTogZGF0YSxcbiAgICB9KTtcblxuICAgIGNvbnNvbGUubG9nKCdSZXNwb25kaW5nJywgcmVzcG9uc2VCb2R5KTtcblxuICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2xpbnQvbm8tcmVxdWlyZS1pbXBvcnRzXG4gICAgY29uc3QgcGFyc2VkVXJsID0gcmVxdWlyZSgndXJsJykucGFyc2UoZXZlbnQuUmVzcG9uc2VVUkwpO1xuICAgIGNvbnN0IHJlcXVlc3RPcHRpb25zID0ge1xuICAgICAgaG9zdG5hbWU6IHBhcnNlZFVybC5ob3N0bmFtZSxcbiAgICAgIHBhdGg6IHBhcnNlZFVybC5wYXRoLFxuICAgICAgbWV0aG9kOiAnUFVUJyxcbiAgICAgIGhlYWRlcnM6IHsgJ2NvbnRlbnQtdHlwZSc6ICcnLCAnY29udGVudC1sZW5ndGgnOiByZXNwb25zZUJvZHkubGVuZ3RoIH0sXG4gICAgfTtcblxuICAgIHJldHVybiBuZXcgUHJvbWlzZSgocmVzb2x2ZSwgcmVqZWN0KSA9PiB7XG4gICAgICB0cnkge1xuICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLXJlcXVpcmUtaW1wb3J0c1xuICAgICAgICBjb25zdCByZXF1ZXN0ID0gcmVxdWlyZSgnaHR0cHMnKS5yZXF1ZXN0KHJlcXVlc3RPcHRpb25zLCByZXNvbHZlKTtcbiAgICAgICAgcmVxdWVzdC5vbignZXJyb3InLCByZWplY3QpO1xuICAgICAgICByZXF1ZXN0LndyaXRlKHJlc3BvbnNlQm9keSk7XG4gICAgICAgIHJlcXVlc3QuZW5kKCk7XG4gICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgIHJlamVjdChlKTtcbiAgICAgIH1cbiAgICB9KTtcbiAgfVxufVxuXG5mdW5jdGlvbiBkZWNvZGVDYWxsKGNhbGw6IHN0cmluZyB8IHVuZGVmaW5lZCkge1xuICBpZiAoIWNhbGwpIHsgcmV0dXJuIHVuZGVmaW5lZDsgfVxuICByZXR1cm4gSlNPTi5wYXJzZShjYWxsKTtcbn1cblxuZnVuY3Rpb24gc3RhcnRzV2l0aE9uZU9mKHNlYXJjaFN0cmluZ3M6IHN0cmluZ1tdKTogKHN0cmluZzogc3RyaW5nKSA9PiBib29sZWFuIHtcbiAgcmV0dXJuIGZ1bmN0aW9uKHN0cmluZzogc3RyaW5nKTogYm9vbGVhbiB7XG4gICAgZm9yIChjb25zdCBzZWFyY2hTdHJpbmcgb2Ygc2VhcmNoU3RyaW5ncykge1xuICAgICAgaWYgKHN0cmluZy5zdGFydHNXaXRoKHNlYXJjaFN0cmluZykpIHtcbiAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICB9XG4gICAgfVxuICAgIHJldHVybiBmYWxzZTtcbiAgfTtcbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/aws-ecs-integ.assets.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/aws-ecs-integ.assets.json deleted file mode 100644 index 43da15f874cd3..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/aws-ecs-integ.assets.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "version": "20.0.0", - "files": { - "8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d": { - "source": { - "path": "asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d", - "packaging": "zip" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d.zip", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - }, - "8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9": { - "source": { - "path": "asset.8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9", - "packaging": "zip" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9.zip", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - }, - "9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90": { - "source": { - "path": "asset.9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90", - "packaging": "zip" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90.zip", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - }, - "0b2a2f517aed512c15790ab888051365faa60d6c56c60f963b9f68bd63700087": { - "source": { - "path": "aws-ecs-integ.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "0b2a2f517aed512c15790ab888051365faa60d6c56c60f963b9f68bd63700087.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-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/aws-ecs-integ.template.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/aws-ecs-integ.template.json deleted file mode 100644 index ff45156d14d40..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/aws-ecs-integ.template.json +++ /dev/null @@ -1,1346 +0,0 @@ -{ - "Resources": { - "vpcA2121C38": { - "Type": "AWS::EC2::VPC", - "Properties": { - "CidrBlock": "10.0.0.0/16", - "EnableDnsHostnames": true, - "EnableDnsSupport": true, - "InstanceTenancy": "default", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/vpc" - } - ] - } - }, - "vpcpublicSubnet1SubnetA635257E": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "vpcA2121C38" - }, - "AvailabilityZone": { - "Fn::Select": [ - 0, - { - "Fn::GetAZs": "" - } - ] - }, - "CidrBlock": "10.0.0.0/24", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/vpc/publicSubnet1" - } - ] - } - }, - "vpcpublicSubnet1RouteTableA38152FE": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "vpcA2121C38" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/vpc/publicSubnet1" - } - ] - } - }, - "vpcpublicSubnet1RouteTableAssociationB46101B8": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "vpcpublicSubnet1RouteTableA38152FE" - }, - "SubnetId": { - "Ref": "vpcpublicSubnet1SubnetA635257E" - } - } - }, - "vpcpublicSubnet1DefaultRouteF0973989": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "vpcpublicSubnet1RouteTableA38152FE" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "vpcIGWE57CBDCA" - } - }, - "DependsOn": [ - "vpcVPCGW7984C166" - ] - }, - "vpcpublicSubnet2Subnet027D165B": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "vpcA2121C38" - }, - "AvailabilityZone": { - "Fn::Select": [ - 1, - { - "Fn::GetAZs": "" - } - ] - }, - "CidrBlock": "10.0.1.0/24", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/vpc/publicSubnet2" - } - ] - } - }, - "vpcpublicSubnet2RouteTableA6135437": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "vpcA2121C38" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/vpc/publicSubnet2" - } - ] - } - }, - "vpcpublicSubnet2RouteTableAssociation73F6478A": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "vpcpublicSubnet2RouteTableA6135437" - }, - "SubnetId": { - "Ref": "vpcpublicSubnet2Subnet027D165B" - } - } - }, - "vpcpublicSubnet2DefaultRoute13685A07": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "vpcpublicSubnet2RouteTableA6135437" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "vpcIGWE57CBDCA" - } - }, - "DependsOn": [ - "vpcVPCGW7984C166" - ] - }, - "vpcIGWE57CBDCA": { - "Type": "AWS::EC2::InternetGateway", - "Properties": { - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/vpc" - } - ] - } - }, - "vpcVPCGW7984C166": { - "Type": "AWS::EC2::VPCGatewayAttachment", - "Properties": { - "VpcId": { - "Ref": "vpcA2121C38" - }, - "InternetGatewayId": { - "Ref": "vpcIGWE57CBDCA" - } - } - }, - "zoneEB40FF1E": { - "Type": "AWS::Route53::HostedZone", - "Properties": { - "Name": "myexample.com." - } - }, - "laterRecordD393EDE6": { - "Type": "AWS::Route53::RecordSet", - "Properties": { - "Name": "u-record.myexample.com.", - "Type": "CNAME", - "HostedZoneId": { - "Ref": "zoneEB40FF1E" - }, - "ResourceRecords": [ - "console.aws.amazon.com" - ], - "TTL": "1800" - } - }, - "productionenvironmentclusterC6599D2D": { - "Type": "AWS::ECS::Cluster" - }, - "nametaskdefinitionTaskRole50FE844E": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - }, - "DependsOn": [ - "nameserviceTaskRecordManagerCleanupE19F1043", - "nameserviceTaskRecordManagerRuleRunningCD85F46F", - "nameserviceTaskRecordManagerRuleStopped66D08B70" - ] - }, - "nametaskdefinition690762BB": { - "Type": "AWS::ECS::TaskDefinition", - "Properties": { - "ContainerDefinitions": [ - { - "Cpu": 256, - "Environment": [ - { - "Name": "PORT", - "Value": "80" - } - ], - "Essential": true, - "Image": "nathanpeck/name", - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "namelogsF4B17D31" - }, - "awslogs-stream-prefix": "name", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "Memory": 512, - "Name": "app", - "PortMappings": [ - { - "ContainerPort": 80, - "Protocol": "tcp" - } - ], - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ] - } - ], - "Cpu": "256", - "ExecutionRoleArn": { - "Fn::GetAtt": [ - "nametaskdefinitionExecutionRole45AC5C9A", - "Arn" - ] - }, - "Family": "awsecsintegnametaskdefinition0EA6A1A0", - "Memory": "512", - "NetworkMode": "awsvpc", - "RequiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "TaskRoleArn": { - "Fn::GetAtt": [ - "nametaskdefinitionTaskRole50FE844E", - "Arn" - ] - } - }, - "DependsOn": [ - "nameserviceTaskRecordManagerCleanupE19F1043", - "nameserviceTaskRecordManagerRuleRunningCD85F46F", - "nameserviceTaskRecordManagerRuleStopped66D08B70" - ] - }, - "nametaskdefinitionExecutionRole45AC5C9A": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - }, - "DependsOn": [ - "nameserviceTaskRecordManagerCleanupE19F1043", - "nameserviceTaskRecordManagerRuleRunningCD85F46F", - "nameserviceTaskRecordManagerRuleStopped66D08B70" - ] - }, - "nametaskdefinitionExecutionRoleDefaultPolicyF7942D20": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "namelogsF4B17D31", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "nametaskdefinitionExecutionRoleDefaultPolicyF7942D20", - "Roles": [ - { - "Ref": "nametaskdefinitionExecutionRole45AC5C9A" - } - ] - }, - "DependsOn": [ - "nameserviceTaskRecordManagerCleanupE19F1043", - "nameserviceTaskRecordManagerRuleRunningCD85F46F", - "nameserviceTaskRecordManagerRuleStopped66D08B70" - ] - }, - "namelogsF4B17D31": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "name-logs", - "RetentionInDays": 30 - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "nameserviceService8015C8D6": { - "Type": "AWS::ECS::Service", - "Properties": { - "Cluster": { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "DeploymentConfiguration": { - "MaximumPercent": 200, - "MinimumHealthyPercent": 100 - }, - "DesiredCount": 1, - "EnableECSManagedTags": false, - "LaunchType": "FARGATE", - "NetworkConfiguration": { - "AwsvpcConfiguration": { - "AssignPublicIp": "ENABLED", - "SecurityGroups": [ - { - "Fn::GetAtt": [ - "nameserviceSecurityGroup33F4662C", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Ref": "vpcpublicSubnet1SubnetA635257E" - }, - { - "Ref": "vpcpublicSubnet2Subnet027D165B" - } - ] - } - }, - "TaskDefinition": { - "Ref": "nametaskdefinition690762BB" - } - } - }, - "nameserviceSecurityGroup33F4662C": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "aws-ecs-integ/name-service/SecurityGroup", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "SecurityGroupIngress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Accept inbound traffic on traffic port from anywhere", - "FromPort": 80, - "IpProtocol": "tcp", - "ToPort": 80 - } - ], - "VpcId": { - "Ref": "vpcA2121C38" - } - } - }, - "nameserviceTaskRecordManagerEventsDLB8F13E1E": { - "Type": "AWS::SQS::Queue", - "Properties": { - "MessageRetentionPeriod": 1209600 - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "nameserviceTaskRecordManagerEventsQueueF805A6C1": { - "Type": "AWS::SQS::Queue", - "Properties": { - "RedrivePolicy": { - "deadLetterTargetArn": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerEventsDLB8F13E1E", - "Arn" - ] - }, - "maxReceiveCount": 500 - }, - "VisibilityTimeout": 30 - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "nameserviceTaskRecordManagerEventsQueuePolicy65CC6F9E": { - "Type": "AWS::SQS::QueuePolicy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "sqs:GetQueueAttributes", - "sqs:GetQueueUrl", - "sqs:SendMessage" - ], - "Condition": { - "ArnEquals": { - "aws:SourceArn": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerRuleRunningCD85F46F", - "Arn" - ] - } - } - }, - "Effect": "Allow", - "Principal": { - "Service": "events.amazonaws.com" - }, - "Resource": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerEventsQueueF805A6C1", - "Arn" - ] - } - }, - { - "Action": [ - "sqs:GetQueueAttributes", - "sqs:GetQueueUrl", - "sqs:SendMessage" - ], - "Condition": { - "ArnEquals": { - "aws:SourceArn": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerRuleStopped66D08B70", - "Arn" - ] - } - } - }, - "Effect": "Allow", - "Principal": { - "Service": "events.amazonaws.com" - }, - "Resource": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerEventsQueueF805A6C1", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "Queues": [ - { - "Ref": "nameserviceTaskRecordManagerEventsQueueF805A6C1" - } - ] - } - }, - "nameserviceTaskRecordManagerRecordsA4648C6E": { - "Type": "AWS::DynamoDB::Table", - "Properties": { - "KeySchema": [ - { - "AttributeName": "cluster_service", - "KeyType": "HASH" - } - ], - "AttributeDefinitions": [ - { - "AttributeName": "cluster_service", - "AttributeType": "S" - } - ], - "BillingMode": "PAY_PER_REQUEST" - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "nameserviceTaskRecordManagerRuleRunningCD85F46F": { - "Type": "AWS::Events::Rule", - "Properties": { - "EventPattern": { - "source": [ - "aws.ecs" - ], - "detail-type": [ - "ECS Task State Change" - ], - "detail": { - "clusterArn": [ - { - "Fn::GetAtt": [ - "productionenvironmentclusterC6599D2D", - "Arn" - ] - } - ], - "lastStatus": [ - "RUNNING" - ], - "desiredStatus": [ - "RUNNING" - ] - } - }, - "State": "ENABLED", - "Targets": [ - { - "Arn": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerEventsQueueF805A6C1", - "Arn" - ] - }, - "Id": "Target0" - } - ] - } - }, - "nameserviceTaskRecordManagerRuleStopped66D08B70": { - "Type": "AWS::Events::Rule", - "Properties": { - "EventPattern": { - "source": [ - "aws.ecs" - ], - "detail-type": [ - "ECS Task State Change" - ], - "detail": { - "clusterArn": [ - { - "Fn::GetAtt": [ - "productionenvironmentclusterC6599D2D", - "Arn" - ] - } - ], - "lastStatus": [ - "STOPPED" - ], - "desiredStatus": [ - "STOPPED" - ] - } - }, - "State": "ENABLED", - "Targets": [ - { - "Arn": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerEventsQueueF805A6C1", - "Arn" - ] - }, - "Id": "Target0" - } - ] - } - }, - "nameserviceTaskRecordManagerEventHandlerServiceRoleE66EE52A": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - ] - ] - } - ] - } - }, - "nameserviceTaskRecordManagerEventHandlerServiceRoleDefaultPolicy96DD8140": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "ec2:DescribeNetworkInterfaces", - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": [ - "route53:ChangeResourceRecordSets", - "route53:ListResourceRecordSets" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":route53:::hostedzone/", - { - "Ref": "zoneEB40FF1E" - } - ] - ] - } - }, - { - "Action": [ - "sqs:ChangeMessageVisibility", - "sqs:DeleteMessage", - "sqs:GetQueueAttributes", - "sqs:GetQueueUrl", - "sqs:ReceiveMessage" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerEventsQueueF805A6C1", - "Arn" - ] - } - }, - { - "Action": [ - "dynamodb:BatchGetItem", - "dynamodb:BatchWriteItem", - "dynamodb:ConditionCheckItem", - "dynamodb:DeleteItem", - "dynamodb:DescribeTable", - "dynamodb:GetItem", - "dynamodb:GetRecords", - "dynamodb:GetShardIterator", - "dynamodb:PutItem", - "dynamodb:Query", - "dynamodb:Scan", - "dynamodb:UpdateItem" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerRecordsA4648C6E", - "Arn" - ] - }, - { - "Ref": "AWS::NoValue" - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "nameserviceTaskRecordManagerEventHandlerServiceRoleDefaultPolicy96DD8140", - "Roles": [ - { - "Ref": "nameserviceTaskRecordManagerEventHandlerServiceRoleE66EE52A" - } - ] - } - }, - "nameserviceTaskRecordManagerEventHandler4B8C6905": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Ref": "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dS3Bucket1E7F92B6" - }, - "S3Key": { - "Fn::Join": [ - "", - [ - { - "Fn::Select": [ - 0, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dS3VersionKey86FCA825" - } - ] - } - ] - }, - { - "Fn::Select": [ - 1, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dS3VersionKey86FCA825" - } - ] - } - ] - } - ] - ] - } - }, - "Role": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerEventHandlerServiceRoleE66EE52A", - "Arn" - ] - }, - "Environment": { - "Variables": { - "HOSTED_ZONE_ID": { - "Ref": "zoneEB40FF1E" - }, - "RECORD_NAME": "test-record.myexample.com", - "RECORDS_TABLE": { - "Ref": "nameserviceTaskRecordManagerRecordsA4648C6E" - }, - "CLUSTER_ARN": { - "Fn::GetAtt": [ - "productionenvironmentclusterC6599D2D", - "Arn" - ] - }, - "SERVICE_NAME": { - "Fn::GetAtt": [ - "nameserviceService8015C8D6", - "Name" - ] - } - } - }, - "Handler": "index.queue_handler", - "ReservedConcurrentExecutions": 1, - "Runtime": "python3.8", - "Timeout": 30 - }, - "DependsOn": [ - "nameserviceTaskRecordManagerEventHandlerServiceRoleDefaultPolicy96DD8140", - "nameserviceTaskRecordManagerEventHandlerServiceRoleE66EE52A" - ] - }, - "nameserviceTaskRecordManagerEventHandlerSqsEventSourceawsecsintegnameserviceTaskRecordManagerEventsQueueC5EE9A869F1EB155": { - "Type": "AWS::Lambda::EventSourceMapping", - "Properties": { - "FunctionName": { - "Ref": "nameserviceTaskRecordManagerEventHandler4B8C6905" - }, - "EventSourceArn": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerEventsQueueF805A6C1", - "Arn" - ] - } - } - }, - "nameserviceTaskRecordManagerCleanupResourceProviderHandlerServiceRoleCCA462F0": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - ] - ] - } - ] - } - }, - "nameserviceTaskRecordManagerCleanupResourceProviderHandlerServiceRoleDefaultPolicy7D095576": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "route53:ChangeResourceRecordSets", - "route53:ListResourceRecordSets" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":route53:::hostedzone/", - { - "Ref": "zoneEB40FF1E" - } - ] - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "nameserviceTaskRecordManagerCleanupResourceProviderHandlerServiceRoleDefaultPolicy7D095576", - "Roles": [ - { - "Ref": "nameserviceTaskRecordManagerCleanupResourceProviderHandlerServiceRoleCCA462F0" - } - ] - } - }, - "nameserviceTaskRecordManagerCleanupResourceProviderHandler08068F99": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Ref": "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dS3Bucket1E7F92B6" - }, - "S3Key": { - "Fn::Join": [ - "", - [ - { - "Fn::Select": [ - 0, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dS3VersionKey86FCA825" - } - ] - } - ] - }, - { - "Fn::Select": [ - 1, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dS3VersionKey86FCA825" - } - ] - } - ] - } - ] - ] - } - }, - "Role": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerCleanupResourceProviderHandlerServiceRoleCCA462F0", - "Arn" - ] - }, - "Handler": "index.cleanup_resource_handler", - "Runtime": "python3.8", - "Timeout": 300 - }, - "DependsOn": [ - "nameserviceTaskRecordManagerCleanupResourceProviderHandlerServiceRoleDefaultPolicy7D095576", - "nameserviceTaskRecordManagerCleanupResourceProviderHandlerServiceRoleCCA462F0" - ] - }, - "nameserviceTaskRecordManagerCleanupResourceProviderframeworkonEventServiceRoleF0570BD0": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - ] - ] - } - ] - } - }, - "nameserviceTaskRecordManagerCleanupResourceProviderframeworkonEventServiceRoleDefaultPolicy350D6FAC": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "lambda:InvokeFunction", - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerCleanupResourceProviderHandler08068F99", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerCleanupResourceProviderHandler08068F99", - "Arn" - ] - }, - ":*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "nameserviceTaskRecordManagerCleanupResourceProviderframeworkonEventServiceRoleDefaultPolicy350D6FAC", - "Roles": [ - { - "Ref": "nameserviceTaskRecordManagerCleanupResourceProviderframeworkonEventServiceRoleF0570BD0" - } - ] - } - }, - "nameserviceTaskRecordManagerCleanupResourceProviderframeworkonEvent9B27C899": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Ref": "AssetParameters8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9S3Bucket40DFAF90" - }, - "S3Key": { - "Fn::Join": [ - "", - [ - { - "Fn::Select": [ - 0, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameters8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9S3VersionKey36104212" - } - ] - } - ] - }, - { - "Fn::Select": [ - 1, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameters8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9S3VersionKey36104212" - } - ] - } - ] - } - ] - ] - } - }, - "Role": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerCleanupResourceProviderframeworkonEventServiceRoleF0570BD0", - "Arn" - ] - }, - "Description": "AWS CDK resource provider framework - onEvent (aws-ecs-integ/name-service/TaskRecordManager/CleanupResourceProvider)", - "Environment": { - "Variables": { - "USER_ON_EVENT_FUNCTION_ARN": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerCleanupResourceProviderHandler08068F99", - "Arn" - ] - } - } - }, - "Handler": "framework.onEvent", - "Runtime": "nodejs14.x", - "Timeout": 900 - }, - "DependsOn": [ - "nameserviceTaskRecordManagerCleanupResourceProviderframeworkonEventServiceRoleDefaultPolicy350D6FAC", - "nameserviceTaskRecordManagerCleanupResourceProviderframeworkonEventServiceRoleF0570BD0" - ] - }, - "nameserviceTaskRecordManagerCleanupE19F1043": { - "Type": "AWS::CloudFormation::CustomResource", - "Properties": { - "ServiceToken": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerCleanupResourceProviderframeworkonEvent9B27C899", - "Arn" - ] - }, - "HostedZoneId": { - "Ref": "zoneEB40FF1E" - }, - "RecordName": "test-record.myexample.com" - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "nameserviceTaskRecordManagerPrimingCallCustomResourcePolicy376F02F0": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "sqs:SendMessage", - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerEventsQueueF805A6C1", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "nameserviceTaskRecordManagerPrimingCallCustomResourcePolicy376F02F0", - "Roles": [ - { - "Ref": "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2" - } - ] - }, - "DependsOn": [ - "nameserviceTaskRecordManagerEventHandler4B8C6905", - "nameserviceTaskRecordManagerEventHandlerServiceRoleDefaultPolicy96DD8140", - "nameserviceTaskRecordManagerEventHandlerServiceRoleE66EE52A", - "nameserviceTaskRecordManagerEventHandlerSqsEventSourceawsecsintegnameserviceTaskRecordManagerEventsQueueC5EE9A869F1EB155" - ] - }, - "nameserviceTaskRecordManagerPrimingCallE6113369": { - "Type": "Custom::AWS", - "Properties": { - "ServiceToken": { - "Fn::GetAtt": [ - "AWS679f53fac002430cb0da5b7982bd22872D164C4C", - "Arn" - ] - }, - "Create": { - "Fn::Join": [ - "", - [ - "{\"service\":\"SQS\",\"action\":\"sendMessage\",\"parameters\":{\"QueueUrl\":\"", - { - "Ref": "nameserviceTaskRecordManagerEventsQueueF805A6C1" - }, - "\",\"DelaySeconds\":10,\"MessageBody\":\"{ \\\"prime\\\": true }\",\"MessageAttributes\":{\"HostedZoneId\":{\"DataType\":\"String\",\"StringValue\":\"", - { - "Ref": "zoneEB40FF1E" - }, - "\"},\"RecordName\":{\"DataType\":\"String\",\"StringValue\":\"test-record\"}}},\"physicalResourceId\":{\"responsePath\":\"MessageId\"}}" - ] - ] - }, - "Update": { - "Fn::Join": [ - "", - [ - "{\"service\":\"SQS\",\"action\":\"sendMessage\",\"parameters\":{\"QueueUrl\":\"", - { - "Ref": "nameserviceTaskRecordManagerEventsQueueF805A6C1" - }, - "\",\"DelaySeconds\":10,\"MessageBody\":\"{ \\\"prime\\\": true }\",\"MessageAttributes\":{\"HostedZoneId\":{\"DataType\":\"String\",\"StringValue\":\"", - { - "Ref": "zoneEB40FF1E" - }, - "\"},\"RecordName\":{\"DataType\":\"String\",\"StringValue\":\"test-record\"}}},\"physicalResourceId\":{\"responsePath\":\"MessageId\"}}" - ] - ] - }, - "InstallLatestAwsSdk": true - }, - "DependsOn": [ - "nameserviceTaskRecordManagerEventHandler4B8C6905", - "nameserviceTaskRecordManagerEventHandlerServiceRoleDefaultPolicy96DD8140", - "nameserviceTaskRecordManagerEventHandlerServiceRoleE66EE52A", - "nameserviceTaskRecordManagerEventHandlerSqsEventSourceawsecsintegnameserviceTaskRecordManagerEventsQueueC5EE9A869F1EB155", - "nameserviceTaskRecordManagerPrimingCallCustomResourcePolicy376F02F0" - ], - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - ] - ] - } - ] - } - }, - "AWS679f53fac002430cb0da5b7982bd22872D164C4C": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Ref": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3BucketB21FB59F" - }, - "S3Key": { - "Fn::Join": [ - "", - [ - { - "Fn::Select": [ - 0, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3VersionKey73D4F058" - } - ] - } - ] - }, - { - "Fn::Select": [ - 1, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3VersionKey73D4F058" - } - ] - } - ] - } - ] - ] - } - }, - "Role": { - "Fn::GetAtt": [ - "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2", - "Arn" - ] - }, - "Handler": "index.handler", - "Runtime": "nodejs14.x", - "Timeout": 120 - }, - "DependsOn": [ - "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2" - ] - } - }, - "Parameters": { - "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dS3Bucket1E7F92B6": { - "Type": "String", - "Description": "S3 bucket for asset \"8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d\"" - }, - "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dS3VersionKey86FCA825": { - "Type": "String", - "Description": "S3 key for asset version \"8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d\"" - }, - "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dArtifactHash0F81F2AB": { - "Type": "String", - "Description": "Artifact hash for asset \"8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d\"" - }, - "AssetParameters8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9S3Bucket40DFAF90": { - "Type": "String", - "Description": "S3 bucket for asset \"8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9\"" - }, - "AssetParameters8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9S3VersionKey36104212": { - "Type": "String", - "Description": "S3 key for asset version \"8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9\"" - }, - "AssetParameters8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9ArtifactHash26B5BCAA": { - "Type": "String", - "Description": "Artifact hash for asset \"8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9\"" - }, - "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3BucketB21FB59F": { - "Type": "String", - "Description": "S3 bucket for asset \"9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90\"" - }, - "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3VersionKey73D4F058": { - "Type": "String", - "Description": "S3 key for asset version \"9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90\"" - }, - "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90ArtifactHashC00C7285": { - "Type": "String", - "Description": "Artifact hash for asset \"9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90\"" - } - }, - "Outputs": { - "DnsName": { - "Value": "test-record.myexample.com" - }, - "DnsServer": { - "Value": { - "Fn::Select": [ - 0, - { - "Fn::GetAtt": [ - "zoneEB40FF1E", - "NameServers" - ] - } - ] - } - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/cdk.out b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/cdk.out deleted file mode 100644 index 588d7b269d34f..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/integ.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/integ.json deleted file mode 100644 index 53e04504bce72..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/integ.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "version": "20.0.0", - "testCases": { - "integ.assign-public-ip": { - "stacks": [ - "aws-ecs-integ" - ], - "diffAssets": false, - "stackUpdateWorkflow": true - } - }, - "synthContext": {}, - "enableLookups": false -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/manifest.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/manifest.json deleted file mode 100644 index 7684dc02119c2..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/manifest.json +++ /dev/null @@ -1,378 +0,0 @@ -{ - "version": "20.0.0", - "artifacts": { - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - }, - "aws-ecs-integ": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "aws-ecs-integ.template.json", - "validateOnSynth": false - }, - "metadata": { - "/aws-ecs-integ": [ - { - "type": "aws:cdk:asset", - "data": { - "path": "asset.8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d", - "id": "8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d", - "packaging": "zip", - "sourceHash": "8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d", - "s3BucketParameter": "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dS3Bucket1E7F92B6", - "s3KeyParameter": "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dS3VersionKey86FCA825", - "artifactHashParameter": "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dArtifactHash0F81F2AB" - } - }, - { - "type": "aws:cdk:asset", - "data": { - "path": "asset.8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9", - "id": "8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9", - "packaging": "zip", - "sourceHash": "8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9", - "s3BucketParameter": "AssetParameters8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9S3Bucket40DFAF90", - "s3KeyParameter": "AssetParameters8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9S3VersionKey36104212", - "artifactHashParameter": "AssetParameters8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9ArtifactHash26B5BCAA" - } - }, - { - "type": "aws:cdk:asset", - "data": { - "path": "asset.9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90", - "id": "9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90", - "packaging": "zip", - "sourceHash": "9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90", - "s3BucketParameter": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3BucketB21FB59F", - "s3KeyParameter": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3VersionKey73D4F058", - "artifactHashParameter": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90ArtifactHashC00C7285" - } - } - ], - "/aws-ecs-integ/vpc/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcA2121C38" - } - ], - "/aws-ecs-integ/vpc/publicSubnet1/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcpublicSubnet1SubnetA635257E" - } - ], - "/aws-ecs-integ/vpc/publicSubnet1/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcpublicSubnet1RouteTableA38152FE" - } - ], - "/aws-ecs-integ/vpc/publicSubnet1/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcpublicSubnet1RouteTableAssociationB46101B8" - } - ], - "/aws-ecs-integ/vpc/publicSubnet1/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcpublicSubnet1DefaultRouteF0973989" - } - ], - "/aws-ecs-integ/vpc/publicSubnet2/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcpublicSubnet2Subnet027D165B" - } - ], - "/aws-ecs-integ/vpc/publicSubnet2/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcpublicSubnet2RouteTableA6135437" - } - ], - "/aws-ecs-integ/vpc/publicSubnet2/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcpublicSubnet2RouteTableAssociation73F6478A" - } - ], - "/aws-ecs-integ/vpc/publicSubnet2/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcpublicSubnet2DefaultRoute13685A07" - } - ], - "/aws-ecs-integ/vpc/IGW": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcIGWE57CBDCA" - } - ], - "/aws-ecs-integ/vpc/VPCGW": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcVPCGW7984C166" - } - ], - "/aws-ecs-integ/zone/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "zoneEB40FF1E" - } - ], - "/aws-ecs-integ/laterRecord/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "laterRecordD393EDE6" - } - ], - "/aws-ecs-integ/production-environment-cluster/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentclusterC6599D2D" - } - ], - "/aws-ecs-integ/name-task-definition/TaskRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nametaskdefinitionTaskRole50FE844E" - } - ], - "/aws-ecs-integ/name-task-definition/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nametaskdefinition690762BB" - } - ], - "/aws-ecs-integ/name-task-definition/ExecutionRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nametaskdefinitionExecutionRole45AC5C9A" - } - ], - "/aws-ecs-integ/name-task-definition/ExecutionRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nametaskdefinitionExecutionRoleDefaultPolicyF7942D20" - } - ], - "/aws-ecs-integ/name-logs/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "namelogsF4B17D31" - } - ], - "/aws-ecs-integ/name-service/Service": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceService8015C8D6" - } - ], - "/aws-ecs-integ/name-service/SecurityGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceSecurityGroup33F4662C" - } - ], - "/aws-ecs-integ/name-service/TaskRecordManager/EventsDL/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceTaskRecordManagerEventsDLB8F13E1E" - } - ], - "/aws-ecs-integ/name-service/TaskRecordManager/EventsQueue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceTaskRecordManagerEventsQueueF805A6C1" - } - ], - "/aws-ecs-integ/name-service/TaskRecordManager/EventsQueue/Policy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceTaskRecordManagerEventsQueuePolicy65CC6F9E" - } - ], - "/aws-ecs-integ/name-service/TaskRecordManager/Records/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceTaskRecordManagerRecordsA4648C6E" - } - ], - "/aws-ecs-integ/name-service/TaskRecordManager/RuleRunning/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceTaskRecordManagerRuleRunningCD85F46F" - } - ], - "/aws-ecs-integ/name-service/TaskRecordManager/RuleStopped/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceTaskRecordManagerRuleStopped66D08B70" - } - ], - "/aws-ecs-integ/name-service/TaskRecordManager/EventHandler/ServiceRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceTaskRecordManagerEventHandlerServiceRoleE66EE52A" - } - ], - "/aws-ecs-integ/name-service/TaskRecordManager/EventHandler/ServiceRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceTaskRecordManagerEventHandlerServiceRoleDefaultPolicy96DD8140" - } - ], - "/aws-ecs-integ/name-service/TaskRecordManager/EventHandler/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceTaskRecordManagerEventHandler4B8C6905" - } - ], - "/aws-ecs-integ/name-service/TaskRecordManager/EventHandler/SqsEventSource:awsecsintegnameserviceTaskRecordManagerEventsQueueC5EE9A86/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceTaskRecordManagerEventHandlerSqsEventSourceawsecsintegnameserviceTaskRecordManagerEventsQueueC5EE9A869F1EB155" - } - ], - "/aws-ecs-integ/name-service/TaskRecordManager/CleanupResourceProviderHandler/ServiceRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceTaskRecordManagerCleanupResourceProviderHandlerServiceRoleCCA462F0" - } - ], - "/aws-ecs-integ/name-service/TaskRecordManager/CleanupResourceProviderHandler/ServiceRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceTaskRecordManagerCleanupResourceProviderHandlerServiceRoleDefaultPolicy7D095576" - } - ], - "/aws-ecs-integ/name-service/TaskRecordManager/CleanupResourceProviderHandler/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceTaskRecordManagerCleanupResourceProviderHandler08068F99" - } - ], - "/aws-ecs-integ/name-service/TaskRecordManager/CleanupResourceProvider/framework-onEvent/ServiceRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceTaskRecordManagerCleanupResourceProviderframeworkonEventServiceRoleF0570BD0" - } - ], - "/aws-ecs-integ/name-service/TaskRecordManager/CleanupResourceProvider/framework-onEvent/ServiceRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceTaskRecordManagerCleanupResourceProviderframeworkonEventServiceRoleDefaultPolicy350D6FAC" - } - ], - "/aws-ecs-integ/name-service/TaskRecordManager/CleanupResourceProvider/framework-onEvent/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceTaskRecordManagerCleanupResourceProviderframeworkonEvent9B27C899" - } - ], - "/aws-ecs-integ/name-service/TaskRecordManager/Cleanup/Default": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceTaskRecordManagerCleanupE19F1043" - } - ], - "/aws-ecs-integ/name-service/TaskRecordManager/PrimingCall/CustomResourcePolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceTaskRecordManagerPrimingCallCustomResourcePolicy376F02F0" - } - ], - "/aws-ecs-integ/name-service/TaskRecordManager/PrimingCall/Resource/Default": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceTaskRecordManagerPrimingCallE6113369" - } - ], - "/aws-ecs-integ/AssetParameters/8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/S3Bucket": [ - { - "type": "aws:cdk:logicalId", - "data": "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dS3Bucket1E7F92B6" - } - ], - "/aws-ecs-integ/AssetParameters/8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/S3VersionKey": [ - { - "type": "aws:cdk:logicalId", - "data": "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dS3VersionKey86FCA825" - } - ], - "/aws-ecs-integ/AssetParameters/8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/ArtifactHash": [ - { - "type": "aws:cdk:logicalId", - "data": "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dArtifactHash0F81F2AB" - } - ], - "/aws-ecs-integ/AssetParameters/8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9/S3Bucket": [ - { - "type": "aws:cdk:logicalId", - "data": "AssetParameters8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9S3Bucket40DFAF90" - } - ], - "/aws-ecs-integ/AssetParameters/8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9/S3VersionKey": [ - { - "type": "aws:cdk:logicalId", - "data": "AssetParameters8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9S3VersionKey36104212" - } - ], - "/aws-ecs-integ/AssetParameters/8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9/ArtifactHash": [ - { - "type": "aws:cdk:logicalId", - "data": "AssetParameters8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9ArtifactHash26B5BCAA" - } - ], - "/aws-ecs-integ/AssetParameters/9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90/S3Bucket": [ - { - "type": "aws:cdk:logicalId", - "data": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3BucketB21FB59F" - } - ], - "/aws-ecs-integ/AssetParameters/9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90/S3VersionKey": [ - { - "type": "aws:cdk:logicalId", - "data": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3VersionKey73D4F058" - } - ], - "/aws-ecs-integ/AssetParameters/9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90/ArtifactHash": [ - { - "type": "aws:cdk:logicalId", - "data": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90ArtifactHashC00C7285" - } - ], - "/aws-ecs-integ/AWS679f53fac002430cb0da5b7982bd2287/ServiceRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2" - } - ], - "/aws-ecs-integ/AWS679f53fac002430cb0da5b7982bd2287/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "AWS679f53fac002430cb0da5b7982bd22872D164C4C" - } - ], - "/aws-ecs-integ/DnsName": [ - { - "type": "aws:cdk:logicalId", - "data": "DnsName" - } - ], - "/aws-ecs-integ/DnsServer": [ - { - "type": "aws:cdk:logicalId", - "data": "DnsServer" - } - ] - }, - "displayName": "aws-ecs-integ" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/tree.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/tree.json deleted file mode 100644 index 24e2854d72e08..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.integ.snapshot/tree.json +++ /dev/null @@ -1,2161 +0,0 @@ -{ - "version": "tree-0.1", - "tree": { - "id": "App", - "path": "", - "children": { - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.0.9" - } - }, - "aws-ecs-integ": { - "id": "aws-ecs-integ", - "path": "aws-ecs-integ", - "children": { - "vpc": { - "id": "vpc", - "path": "aws-ecs-integ/vpc", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/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-integ/vpc" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnVPC", - "version": "0.0.0" - } - }, - "publicSubnet1": { - "id": "publicSubnet1", - "path": "aws-ecs-integ/vpc/publicSubnet1", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-ecs-integ/vpc/publicSubnet1/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "vpcA2121C38" - }, - "availabilityZone": { - "Fn::Select": [ - 0, - { - "Fn::GetAZs": "" - } - ] - }, - "cidrBlock": "10.0.0.0/24", - "mapPublicIpOnLaunch": true, - "tags": [ - { - "key": "aws-cdk:subnet-name", - "value": "public" - }, - { - "key": "aws-cdk:subnet-type", - "value": "Public" - }, - { - "key": "Name", - "value": "aws-ecs-integ/vpc/publicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-ecs-integ/vpc/publicSubnet1/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-ecs-integ/vpc/publicSubnet1/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "vpcA2121C38" - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/vpc/publicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-ecs-integ/vpc/publicSubnet1/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "vpcpublicSubnet1RouteTableA38152FE" - }, - "subnetId": { - "Ref": "vpcpublicSubnet1SubnetA635257E" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-ecs-integ/vpc/publicSubnet1/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "vpcpublicSubnet1RouteTableA38152FE" - }, - "destinationCidrBlock": "0.0.0.0/0", - "gatewayId": { - "Ref": "vpcIGWE57CBDCA" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PublicSubnet", - "version": "0.0.0" - } - }, - "publicSubnet2": { - "id": "publicSubnet2", - "path": "aws-ecs-integ/vpc/publicSubnet2", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-ecs-integ/vpc/publicSubnet2/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "vpcA2121C38" - }, - "availabilityZone": { - "Fn::Select": [ - 1, - { - "Fn::GetAZs": "" - } - ] - }, - "cidrBlock": "10.0.1.0/24", - "mapPublicIpOnLaunch": true, - "tags": [ - { - "key": "aws-cdk:subnet-name", - "value": "public" - }, - { - "key": "aws-cdk:subnet-type", - "value": "Public" - }, - { - "key": "Name", - "value": "aws-ecs-integ/vpc/publicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-ecs-integ/vpc/publicSubnet2/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-ecs-integ/vpc/publicSubnet2/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "vpcA2121C38" - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/vpc/publicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-ecs-integ/vpc/publicSubnet2/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "vpcpublicSubnet2RouteTableA6135437" - }, - "subnetId": { - "Ref": "vpcpublicSubnet2Subnet027D165B" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-ecs-integ/vpc/publicSubnet2/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "vpcpublicSubnet2RouteTableA6135437" - }, - "destinationCidrBlock": "0.0.0.0/0", - "gatewayId": { - "Ref": "vpcIGWE57CBDCA" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PublicSubnet", - "version": "0.0.0" - } - }, - "IGW": { - "id": "IGW", - "path": "aws-ecs-integ/vpc/IGW", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::InternetGateway", - "aws:cdk:cloudformation:props": { - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/vpc" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnInternetGateway", - "version": "0.0.0" - } - }, - "VPCGW": { - "id": "VPCGW", - "path": "aws-ecs-integ/vpc/VPCGW", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "vpcA2121C38" - }, - "internetGatewayId": { - "Ref": "vpcIGWE57CBDCA" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnVPCGatewayAttachment", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.Vpc", - "version": "0.0.0" - } - }, - "zone": { - "id": "zone", - "path": "aws-ecs-integ/zone", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/zone/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Route53::HostedZone", - "aws:cdk:cloudformation:props": { - "name": "myexample.com." - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-route53.CfnHostedZone", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-route53.PublicHostedZone", - "version": "0.0.0" - } - }, - "laterRecord": { - "id": "laterRecord", - "path": "aws-ecs-integ/laterRecord", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/laterRecord/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Route53::RecordSet", - "aws:cdk:cloudformation:props": { - "name": "u-record.myexample.com.", - "type": "CNAME", - "hostedZoneId": { - "Ref": "zoneEB40FF1E" - }, - "resourceRecords": [ - "console.aws.amazon.com" - ], - "ttl": "1800" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-route53.CfnRecordSet", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-route53.CnameRecord", - "version": "0.0.0" - } - }, - "production": { - "id": "production", - "path": "aws-ecs-integ/production", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.0.9" - } - }, - "production-environment-cluster": { - "id": "production-environment-cluster", - "path": "aws-ecs-integ/production-environment-cluster", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/production-environment-cluster/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ECS::Cluster", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.CfnCluster", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.Cluster", - "version": "0.0.0" - } - }, - "name": { - "id": "name", - "path": "aws-ecs-integ/name", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.0.9" - } - }, - "name-task-definition": { - "id": "name-task-definition", - "path": "aws-ecs-integ/name-task-definition", - "children": { - "TaskRole": { - "id": "TaskRole", - "path": "aws-ecs-integ/name-task-definition/TaskRole", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-task-definition/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/aws-iam.CfnRole", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-task-definition/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ECS::TaskDefinition", - "aws:cdk:cloudformation:props": { - "containerDefinitions": [ - { - "cpu": 256, - "essential": true, - "image": "nathanpeck/name", - "memory": 512, - "name": "app", - "portMappings": [ - { - "containerPort": 80, - "protocol": "tcp" - } - ], - "ulimits": [ - { - "name": "nofile", - "softLimit": 1024000, - "hardLimit": 1024000 - } - ], - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-group": { - "Ref": "namelogsF4B17D31" - }, - "awslogs-stream-prefix": "name", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "environment": [ - { - "name": "PORT", - "value": "80" - } - ] - } - ], - "cpu": "256", - "executionRoleArn": { - "Fn::GetAtt": [ - "nametaskdefinitionExecutionRole45AC5C9A", - "Arn" - ] - }, - "family": "awsecsintegnametaskdefinition0EA6A1A0", - "memory": "512", - "networkMode": "awsvpc", - "requiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "taskRoleArn": { - "Fn::GetAtt": [ - "nametaskdefinitionTaskRole50FE844E", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.CfnTaskDefinition", - "version": "0.0.0" - } - }, - "app": { - "id": "app", - "path": "aws-ecs-integ/name-task-definition/app", - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.ContainerDefinition", - "version": "0.0.0" - } - }, - "ExecutionRole": { - "id": "ExecutionRole", - "path": "aws-ecs-integ/name-task-definition/ExecutionRole", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-task-definition/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/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "aws-ecs-integ/name-task-definition/ExecutionRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-task-definition/ExecutionRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "namelogsF4B17D31", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "nametaskdefinitionExecutionRoleDefaultPolicyF7942D20", - "roles": [ - { - "Ref": "nametaskdefinitionExecutionRole45AC5C9A" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.TaskDefinition", - "version": "0.0.0" - } - }, - "name-logs": { - "id": "name-logs", - "path": "aws-ecs-integ/name-logs", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-logs/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", - "aws:cdk:cloudformation:props": { - "logGroupName": "name-logs", - "retentionInDays": 30 - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.CfnLogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.LogGroup", - "version": "0.0.0" - } - }, - "name-service": { - "id": "name-service", - "path": "aws-ecs-integ/name-service", - "children": { - "Service": { - "id": "Service", - "path": "aws-ecs-integ/name-service/Service", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ECS::Service", - "aws:cdk:cloudformation:props": { - "cluster": { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "deploymentConfiguration": { - "maximumPercent": 200, - "minimumHealthyPercent": 100 - }, - "desiredCount": 1, - "enableEcsManagedTags": false, - "launchType": "FARGATE", - "networkConfiguration": { - "awsvpcConfiguration": { - "assignPublicIp": "ENABLED", - "subnets": [ - { - "Ref": "vpcpublicSubnet1SubnetA635257E" - }, - { - "Ref": "vpcpublicSubnet2Subnet027D165B" - } - ], - "securityGroups": [ - { - "Fn::GetAtt": [ - "nameserviceSecurityGroup33F4662C", - "GroupId" - ] - } - ] - } - }, - "taskDefinition": { - "Ref": "nametaskdefinition690762BB" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.CfnService", - "version": "0.0.0" - } - }, - "SecurityGroup": { - "id": "SecurityGroup", - "path": "aws-ecs-integ/name-service/SecurityGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-service/SecurityGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", - "aws:cdk:cloudformation:props": { - "groupDescription": "aws-ecs-integ/name-service/SecurityGroup", - "securityGroupEgress": [ - { - "cidrIp": "0.0.0.0/0", - "description": "Allow all outbound traffic by default", - "ipProtocol": "-1" - } - ], - "securityGroupIngress": [ - { - "cidrIp": "0.0.0.0/0", - "ipProtocol": "tcp", - "fromPort": 80, - "toPort": 80, - "description": "Accept inbound traffic on traffic port from anywhere" - } - ], - "vpcId": { - "Ref": "vpcA2121C38" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSecurityGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.SecurityGroup", - "version": "0.0.0" - } - }, - "TaskRecordManager": { - "id": "TaskRecordManager", - "path": "aws-ecs-integ/name-service/TaskRecordManager", - "children": { - "EventsDL": { - "id": "EventsDL", - "path": "aws-ecs-integ/name-service/TaskRecordManager/EventsDL", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-service/TaskRecordManager/EventsDL/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": { - "messageRetentionPeriod": 1209600 - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "EventsQueue": { - "id": "EventsQueue", - "path": "aws-ecs-integ/name-service/TaskRecordManager/EventsQueue", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-service/TaskRecordManager/EventsQueue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": { - "redrivePolicy": { - "deadLetterTargetArn": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerEventsDLB8F13E1E", - "Arn" - ] - }, - "maxReceiveCount": 500 - }, - "visibilityTimeout": 30 - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - }, - "Policy": { - "id": "Policy", - "path": "aws-ecs-integ/name-service/TaskRecordManager/EventsQueue/Policy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-service/TaskRecordManager/EventsQueue/Policy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::QueuePolicy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "sqs:GetQueueAttributes", - "sqs:GetQueueUrl", - "sqs:SendMessage" - ], - "Condition": { - "ArnEquals": { - "aws:SourceArn": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerRuleRunningCD85F46F", - "Arn" - ] - } - } - }, - "Effect": "Allow", - "Principal": { - "Service": "events.amazonaws.com" - }, - "Resource": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerEventsQueueF805A6C1", - "Arn" - ] - } - }, - { - "Action": [ - "sqs:GetQueueAttributes", - "sqs:GetQueueUrl", - "sqs:SendMessage" - ], - "Condition": { - "ArnEquals": { - "aws:SourceArn": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerRuleStopped66D08B70", - "Arn" - ] - } - } - }, - "Effect": "Allow", - "Principal": { - "Service": "events.amazonaws.com" - }, - "Resource": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerEventsQueueF805A6C1", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "queues": [ - { - "Ref": "nameserviceTaskRecordManagerEventsQueueF805A6C1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueuePolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.QueuePolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "Records": { - "id": "Records", - "path": "aws-ecs-integ/name-service/TaskRecordManager/Records", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-service/TaskRecordManager/Records/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::DynamoDB::Table", - "aws:cdk:cloudformation:props": { - "keySchema": [ - { - "attributeName": "cluster_service", - "keyType": "HASH" - } - ], - "attributeDefinitions": [ - { - "attributeName": "cluster_service", - "attributeType": "S" - } - ], - "billingMode": "PAY_PER_REQUEST" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-dynamodb.CfnTable", - "version": "0.0.0" - } - }, - "ScalingRole": { - "id": "ScalingRole", - "path": "aws-ecs-integ/name-service/TaskRecordManager/Records/ScalingRole", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-dynamodb.Table", - "version": "0.0.0" - } - }, - "RuleRunning": { - "id": "RuleRunning", - "path": "aws-ecs-integ/name-service/TaskRecordManager/RuleRunning", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-service/TaskRecordManager/RuleRunning/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Events::Rule", - "aws:cdk:cloudformation:props": { - "eventPattern": { - "source": [ - "aws.ecs" - ], - "detail-type": [ - "ECS Task State Change" - ], - "detail": { - "clusterArn": [ - { - "Fn::GetAtt": [ - "productionenvironmentclusterC6599D2D", - "Arn" - ] - } - ], - "lastStatus": [ - "RUNNING" - ], - "desiredStatus": [ - "RUNNING" - ] - } - }, - "state": "ENABLED", - "targets": [ - { - "id": "Target0", - "arn": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerEventsQueueF805A6C1", - "Arn" - ] - } - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-events.CfnRule", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-events.Rule", - "version": "0.0.0" - } - }, - "RuleStopped": { - "id": "RuleStopped", - "path": "aws-ecs-integ/name-service/TaskRecordManager/RuleStopped", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-service/TaskRecordManager/RuleStopped/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Events::Rule", - "aws:cdk:cloudformation:props": { - "eventPattern": { - "source": [ - "aws.ecs" - ], - "detail-type": [ - "ECS Task State Change" - ], - "detail": { - "clusterArn": [ - { - "Fn::GetAtt": [ - "productionenvironmentclusterC6599D2D", - "Arn" - ] - } - ], - "lastStatus": [ - "STOPPED" - ], - "desiredStatus": [ - "STOPPED" - ] - } - }, - "state": "ENABLED", - "targets": [ - { - "id": "Target0", - "arn": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerEventsQueueF805A6C1", - "Arn" - ] - } - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-events.CfnRule", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-events.Rule", - "version": "0.0.0" - } - }, - "EventHandler": { - "id": "EventHandler", - "path": "aws-ecs-integ/name-service/TaskRecordManager/EventHandler", - "children": { - "ServiceRole": { - "id": "ServiceRole", - "path": "aws-ecs-integ/name-service/TaskRecordManager/EventHandler/ServiceRole", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-service/TaskRecordManager/EventHandler/ServiceRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "managedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - ] - ] - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "aws-ecs-integ/name-service/TaskRecordManager/EventHandler/ServiceRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-service/TaskRecordManager/EventHandler/ServiceRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": "ec2:DescribeNetworkInterfaces", - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": [ - "route53:ChangeResourceRecordSets", - "route53:ListResourceRecordSets" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":route53:::hostedzone/", - { - "Ref": "zoneEB40FF1E" - } - ] - ] - } - }, - { - "Action": [ - "sqs:ChangeMessageVisibility", - "sqs:DeleteMessage", - "sqs:GetQueueAttributes", - "sqs:GetQueueUrl", - "sqs:ReceiveMessage" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerEventsQueueF805A6C1", - "Arn" - ] - } - }, - { - "Action": [ - "dynamodb:BatchGetItem", - "dynamodb:BatchWriteItem", - "dynamodb:ConditionCheckItem", - "dynamodb:DeleteItem", - "dynamodb:DescribeTable", - "dynamodb:GetItem", - "dynamodb:GetRecords", - "dynamodb:GetShardIterator", - "dynamodb:PutItem", - "dynamodb:Query", - "dynamodb:Scan", - "dynamodb:UpdateItem" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerRecordsA4648C6E", - "Arn" - ] - }, - { - "Ref": "AWS::NoValue" - } - ] - } - ], - "Version": "2012-10-17" - }, - "policyName": "nameserviceTaskRecordManagerEventHandlerServiceRoleDefaultPolicy96DD8140", - "roles": [ - { - "Ref": "nameserviceTaskRecordManagerEventHandlerServiceRoleE66EE52A" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Code": { - "id": "Code", - "path": "aws-ecs-integ/name-service/TaskRecordManager/EventHandler/Code", - "children": { - "Stage": { - "id": "Stage", - "path": "aws-ecs-integ/name-service/TaskRecordManager/EventHandler/Code/Stage", - "constructInfo": { - "fqn": "@aws-cdk/core.AssetStaging", - "version": "0.0.0" - } - }, - "AssetBucket": { - "id": "AssetBucket", - "path": "aws-ecs-integ/name-service/TaskRecordManager/EventHandler/Code/AssetBucket", - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.BucketBase", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3-assets.Asset", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-service/TaskRecordManager/EventHandler/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Lambda::Function", - "aws:cdk:cloudformation:props": { - "code": { - "s3Bucket": { - "Ref": "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dS3Bucket1E7F92B6" - }, - "s3Key": { - "Fn::Join": [ - "", - [ - { - "Fn::Select": [ - 0, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dS3VersionKey86FCA825" - } - ] - } - ] - }, - { - "Fn::Select": [ - 1, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dS3VersionKey86FCA825" - } - ] - } - ] - } - ] - ] - } - }, - "role": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerEventHandlerServiceRoleE66EE52A", - "Arn" - ] - }, - "environment": { - "variables": { - "HOSTED_ZONE_ID": { - "Ref": "zoneEB40FF1E" - }, - "RECORD_NAME": "test-record.myexample.com", - "RECORDS_TABLE": { - "Ref": "nameserviceTaskRecordManagerRecordsA4648C6E" - }, - "CLUSTER_ARN": { - "Fn::GetAtt": [ - "productionenvironmentclusterC6599D2D", - "Arn" - ] - }, - "SERVICE_NAME": { - "Fn::GetAtt": [ - "nameserviceService8015C8D6", - "Name" - ] - } - } - }, - "handler": "index.queue_handler", - "reservedConcurrentExecutions": 1, - "runtime": "python3.8", - "timeout": 30 - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-lambda.CfnFunction", - "version": "0.0.0" - } - }, - "SqsEventSource:awsecsintegnameserviceTaskRecordManagerEventsQueueC5EE9A86": { - "id": "SqsEventSource:awsecsintegnameserviceTaskRecordManagerEventsQueueC5EE9A86", - "path": "aws-ecs-integ/name-service/TaskRecordManager/EventHandler/SqsEventSource:awsecsintegnameserviceTaskRecordManagerEventsQueueC5EE9A86", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-service/TaskRecordManager/EventHandler/SqsEventSource:awsecsintegnameserviceTaskRecordManagerEventsQueueC5EE9A86/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Lambda::EventSourceMapping", - "aws:cdk:cloudformation:props": { - "functionName": { - "Ref": "nameserviceTaskRecordManagerEventHandler4B8C6905" - }, - "eventSourceArn": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerEventsQueueF805A6C1", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-lambda.CfnEventSourceMapping", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-lambda.EventSourceMapping", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-lambda.Function", - "version": "0.0.0" - } - }, - "CleanupResourceProviderHandler": { - "id": "CleanupResourceProviderHandler", - "path": "aws-ecs-integ/name-service/TaskRecordManager/CleanupResourceProviderHandler", - "children": { - "ServiceRole": { - "id": "ServiceRole", - "path": "aws-ecs-integ/name-service/TaskRecordManager/CleanupResourceProviderHandler/ServiceRole", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-service/TaskRecordManager/CleanupResourceProviderHandler/ServiceRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "managedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - ] - ] - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "aws-ecs-integ/name-service/TaskRecordManager/CleanupResourceProviderHandler/ServiceRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-service/TaskRecordManager/CleanupResourceProviderHandler/ServiceRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "route53:ChangeResourceRecordSets", - "route53:ListResourceRecordSets" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":route53:::hostedzone/", - { - "Ref": "zoneEB40FF1E" - } - ] - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "nameserviceTaskRecordManagerCleanupResourceProviderHandlerServiceRoleDefaultPolicy7D095576", - "roles": [ - { - "Ref": "nameserviceTaskRecordManagerCleanupResourceProviderHandlerServiceRoleCCA462F0" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-service/TaskRecordManager/CleanupResourceProviderHandler/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Lambda::Function", - "aws:cdk:cloudformation:props": { - "code": { - "s3Bucket": { - "Ref": "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dS3Bucket1E7F92B6" - }, - "s3Key": { - "Fn::Join": [ - "", - [ - { - "Fn::Select": [ - 0, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dS3VersionKey86FCA825" - } - ] - } - ] - }, - { - "Fn::Select": [ - 1, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dS3VersionKey86FCA825" - } - ] - } - ] - } - ] - ] - } - }, - "role": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerCleanupResourceProviderHandlerServiceRoleCCA462F0", - "Arn" - ] - }, - "handler": "index.cleanup_resource_handler", - "runtime": "python3.8", - "timeout": 300 - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-lambda.CfnFunction", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-lambda.Function", - "version": "0.0.0" - } - }, - "CleanupResourceProvider": { - "id": "CleanupResourceProvider", - "path": "aws-ecs-integ/name-service/TaskRecordManager/CleanupResourceProvider", - "children": { - "framework-onEvent": { - "id": "framework-onEvent", - "path": "aws-ecs-integ/name-service/TaskRecordManager/CleanupResourceProvider/framework-onEvent", - "children": { - "ServiceRole": { - "id": "ServiceRole", - "path": "aws-ecs-integ/name-service/TaskRecordManager/CleanupResourceProvider/framework-onEvent/ServiceRole", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-service/TaskRecordManager/CleanupResourceProvider/framework-onEvent/ServiceRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "managedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - ] - ] - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "aws-ecs-integ/name-service/TaskRecordManager/CleanupResourceProvider/framework-onEvent/ServiceRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-service/TaskRecordManager/CleanupResourceProvider/framework-onEvent/ServiceRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": "lambda:InvokeFunction", - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerCleanupResourceProviderHandler08068F99", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerCleanupResourceProviderHandler08068F99", - "Arn" - ] - }, - ":*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "policyName": "nameserviceTaskRecordManagerCleanupResourceProviderframeworkonEventServiceRoleDefaultPolicy350D6FAC", - "roles": [ - { - "Ref": "nameserviceTaskRecordManagerCleanupResourceProviderframeworkonEventServiceRoleF0570BD0" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Code": { - "id": "Code", - "path": "aws-ecs-integ/name-service/TaskRecordManager/CleanupResourceProvider/framework-onEvent/Code", - "children": { - "Stage": { - "id": "Stage", - "path": "aws-ecs-integ/name-service/TaskRecordManager/CleanupResourceProvider/framework-onEvent/Code/Stage", - "constructInfo": { - "fqn": "@aws-cdk/core.AssetStaging", - "version": "0.0.0" - } - }, - "AssetBucket": { - "id": "AssetBucket", - "path": "aws-ecs-integ/name-service/TaskRecordManager/CleanupResourceProvider/framework-onEvent/Code/AssetBucket", - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.BucketBase", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3-assets.Asset", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-service/TaskRecordManager/CleanupResourceProvider/framework-onEvent/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Lambda::Function", - "aws:cdk:cloudformation:props": { - "code": { - "s3Bucket": { - "Ref": "AssetParameters8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9S3Bucket40DFAF90" - }, - "s3Key": { - "Fn::Join": [ - "", - [ - { - "Fn::Select": [ - 0, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameters8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9S3VersionKey36104212" - } - ] - } - ] - }, - { - "Fn::Select": [ - 1, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameters8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9S3VersionKey36104212" - } - ] - } - ] - } - ] - ] - } - }, - "role": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerCleanupResourceProviderframeworkonEventServiceRoleF0570BD0", - "Arn" - ] - }, - "description": "AWS CDK resource provider framework - onEvent (aws-ecs-integ/name-service/TaskRecordManager/CleanupResourceProvider)", - "environment": { - "variables": { - "USER_ON_EVENT_FUNCTION_ARN": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerCleanupResourceProviderHandler08068F99", - "Arn" - ] - } - } - }, - "handler": "framework.onEvent", - "runtime": "nodejs14.x", - "timeout": 900 - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-lambda.CfnFunction", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-lambda.Function", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/custom-resources.Provider", - "version": "0.0.0" - } - }, - "Cleanup": { - "id": "Cleanup", - "path": "aws-ecs-integ/name-service/TaskRecordManager/Cleanup", - "children": { - "Default": { - "id": "Default", - "path": "aws-ecs-integ/name-service/TaskRecordManager/Cleanup/Default", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CustomResource", - "version": "0.0.0" - } - }, - "PrimingCall": { - "id": "PrimingCall", - "path": "aws-ecs-integ/name-service/TaskRecordManager/PrimingCall", - "children": { - "Provider": { - "id": "Provider", - "path": "aws-ecs-integ/name-service/TaskRecordManager/PrimingCall/Provider", - "constructInfo": { - "fqn": "@aws-cdk/aws-lambda.SingletonFunction", - "version": "0.0.0" - } - }, - "CustomResourcePolicy": { - "id": "CustomResourcePolicy", - "path": "aws-ecs-integ/name-service/TaskRecordManager/PrimingCall/CustomResourcePolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-service/TaskRecordManager/PrimingCall/CustomResourcePolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": "sqs:SendMessage", - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerEventsQueueF805A6C1", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "nameserviceTaskRecordManagerPrimingCallCustomResourcePolicy376F02F0", - "roles": [ - { - "Ref": "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-service/TaskRecordManager/PrimingCall/Resource", - "children": { - "Default": { - "id": "Default", - "path": "aws-ecs-integ/name-service/TaskRecordManager/PrimingCall/Resource/Default", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CustomResource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/custom-resources.AwsCustomResource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.0.9" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.FargateService", - "version": "0.0.0" - } - }, - "AssetParameters": { - "id": "AssetParameters", - "path": "aws-ecs-integ/AssetParameters", - "children": { - "8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d": { - "id": "8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d", - "path": "aws-ecs-integ/AssetParameters/8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d", - "children": { - "S3Bucket": { - "id": "S3Bucket", - "path": "aws-ecs-integ/AssetParameters/8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/S3Bucket", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnParameter", - "version": "0.0.0" - } - }, - "S3VersionKey": { - "id": "S3VersionKey", - "path": "aws-ecs-integ/AssetParameters/8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/S3VersionKey", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnParameter", - "version": "0.0.0" - } - }, - "ArtifactHash": { - "id": "ArtifactHash", - "path": "aws-ecs-integ/AssetParameters/8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d/ArtifactHash", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnParameter", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.0.9" - } - }, - "8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9": { - "id": "8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9", - "path": "aws-ecs-integ/AssetParameters/8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9", - "children": { - "S3Bucket": { - "id": "S3Bucket", - "path": "aws-ecs-integ/AssetParameters/8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9/S3Bucket", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnParameter", - "version": "0.0.0" - } - }, - "S3VersionKey": { - "id": "S3VersionKey", - "path": "aws-ecs-integ/AssetParameters/8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9/S3VersionKey", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnParameter", - "version": "0.0.0" - } - }, - "ArtifactHash": { - "id": "ArtifactHash", - "path": "aws-ecs-integ/AssetParameters/8dd02cc4ac473ca5b08800e92edaa31a1a7db4005928021d029c5363584f11b9/ArtifactHash", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnParameter", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.0.9" - } - }, - "9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90": { - "id": "9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90", - "path": "aws-ecs-integ/AssetParameters/9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90", - "children": { - "S3Bucket": { - "id": "S3Bucket", - "path": "aws-ecs-integ/AssetParameters/9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90/S3Bucket", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnParameter", - "version": "0.0.0" - } - }, - "S3VersionKey": { - "id": "S3VersionKey", - "path": "aws-ecs-integ/AssetParameters/9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90/S3VersionKey", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnParameter", - "version": "0.0.0" - } - }, - "ArtifactHash": { - "id": "ArtifactHash", - "path": "aws-ecs-integ/AssetParameters/9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90/ArtifactHash", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnParameter", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.0.9" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.0.9" - } - }, - "AWS679f53fac002430cb0da5b7982bd2287": { - "id": "AWS679f53fac002430cb0da5b7982bd2287", - "path": "aws-ecs-integ/AWS679f53fac002430cb0da5b7982bd2287", - "children": { - "ServiceRole": { - "id": "ServiceRole", - "path": "aws-ecs-integ/AWS679f53fac002430cb0da5b7982bd2287/ServiceRole", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/AWS679f53fac002430cb0da5b7982bd2287/ServiceRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "managedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - ] - ] - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Code": { - "id": "Code", - "path": "aws-ecs-integ/AWS679f53fac002430cb0da5b7982bd2287/Code", - "children": { - "Stage": { - "id": "Stage", - "path": "aws-ecs-integ/AWS679f53fac002430cb0da5b7982bd2287/Code/Stage", - "constructInfo": { - "fqn": "@aws-cdk/core.AssetStaging", - "version": "0.0.0" - } - }, - "AssetBucket": { - "id": "AssetBucket", - "path": "aws-ecs-integ/AWS679f53fac002430cb0da5b7982bd2287/Code/AssetBucket", - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.BucketBase", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3-assets.Asset", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/AWS679f53fac002430cb0da5b7982bd2287/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Lambda::Function", - "aws:cdk:cloudformation:props": { - "code": { - "s3Bucket": { - "Ref": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3BucketB21FB59F" - }, - "s3Key": { - "Fn::Join": [ - "", - [ - { - "Fn::Select": [ - 0, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3VersionKey73D4F058" - } - ] - } - ] - }, - { - "Fn::Select": [ - 1, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameters9d784cf317cead201dfe56ed0404d6d23eba6d499ca7354138230c2267f2fe90S3VersionKey73D4F058" - } - ] - } - ] - } - ] - ] - } - }, - "role": { - "Fn::GetAtt": [ - "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2", - "Arn" - ] - }, - "handler": "index.handler", - "runtime": "nodejs14.x", - "timeout": 120 - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-lambda.CfnFunction", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-lambda.Function", - "version": "0.0.0" - } - }, - "DnsName": { - "id": "DnsName", - "path": "aws-ecs-integ/DnsName", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnOutput", - "version": "0.0.0" - } - }, - "DnsServer": { - "id": "DnsServer", - "path": "aws-ecs-integ/DnsServer", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnOutput", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Stack", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.App", - "version": "0.0.0" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.test.ts b/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.test.ts deleted file mode 100644 index be8d6e6bcac51..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/assign-public-ip.test.ts +++ /dev/null @@ -1,193 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as route53 from '@aws-cdk/aws-route53'; -import * as cdk from '@aws-cdk/core'; -import { AssignPublicIpExtension, Container, Environment, EnvironmentCapacityType, Service, ServiceDescription } from '../lib'; -import { TaskRecordManager } from '../lib/extensions/assign-public-ip/task-record-manager'; - -describe('assign public ip', () => { - test('should assign a public ip to fargate tasks', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const environment = new Environment(stack, 'production'); - const serviceDescription = new ServiceDescription(); - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - serviceDescription.add(new AssignPublicIpExtension()); - - new Service(stack, 'my-service', { - environment, - serviceDescription, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ECS::Service', { - NetworkConfiguration: { - AwsvpcConfiguration: { - AssignPublicIp: 'ENABLED', - }, - }, - }); - }); - - test('errors when adding a public ip to ec2-backed service', () => { - // GIVEN - const stack = new cdk.Stack(); - - const vpc = new ec2.Vpc(stack, 'VPC'); - const cluster = new ecs.Cluster(stack, 'Cluster', { vpc }); - cluster.addAsgCapacityProvider(new ecs.AsgCapacityProvider(stack, 'Provider', { - autoScalingGroup: new autoscaling.AutoScalingGroup(stack, 'DefaultAutoScalingGroup', { - vpc, - machineImage: ec2.MachineImage.latestAmazonLinux(), - instanceType: new ec2.InstanceType('t2.micro'), - }), - })); - - const environment = new Environment(stack, 'production', { - vpc, - cluster, - capacityType: EnvironmentCapacityType.EC2, - }); - - const serviceDescription = new ServiceDescription(); - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - serviceDescription.add(new AssignPublicIpExtension()); - - // WHEN / THEN - expect(() => { - new Service(stack, 'my-service', { - environment, - serviceDescription, - }); - }).toThrow(/Fargate/i); - }); - - test('should not add a task record manager by default', () => { - // GIVEN - const stack = new cdk.Stack(); - - const environment = new Environment(stack, 'production'); - const serviceDescription = new ServiceDescription(); - - // WHEN - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - serviceDescription.add(new AssignPublicIpExtension()); - - const service = new Service(stack, 'my-service', { - environment, - serviceDescription, - }); - - // THEN - expect(service.ecsService.node.tryFindChild('TaskRecordManager')).toBeUndefined(); - }); - - test('should add a task record manager when dns is requested', () => { - // GIVEN - const stack = new cdk.Stack(); - const dnsZone = new route53.PublicHostedZone(stack, 'zone', { - zoneName: 'myexample.com', - }); - - const environment = new Environment(stack, 'production'); - const serviceDescription = new ServiceDescription(); - - // WHEN - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - serviceDescription.add(new AssignPublicIpExtension({ - dns: { - zone: dnsZone, - recordName: 'test-record', - }, - })); - - const service = new Service(stack, 'my-service', { - environment, - serviceDescription, - }); - - // THEN - expect(service.ecsService.node.tryFindChild('TaskRecordManager')).toBeDefined(); - }); - - test('task record manager listens for ecs events', () => { - // GIVEN - const stack = new cdk.Stack(); - const dnsZone = new route53.PublicHostedZone(stack, 'zone', { - zoneName: 'myexample.com', - }); - - const environment = new Environment(stack, 'production'); - const serviceDescription = new ServiceDescription(); - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - serviceDescription.add(new AssignPublicIpExtension()); - - const service = new Service(stack, 'my-service', { - environment, - serviceDescription, - }); - - // WHEN - new TaskRecordManager(stack, 'manager', { - dnsRecordName: 'test-record', - dnsZone: dnsZone, - service: service.ecsService, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Events::Rule', { - EventPattern: { - 'source': ['aws.ecs'], - 'detail-type': [ - 'ECS Task State Change', - ], - 'detail': { - lastStatus: ['RUNNING'], - desiredStatus: ['RUNNING'], - }, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Events::Rule', { - EventPattern: { - 'source': ['aws.ecs'], - 'detail-type': [ - 'ECS Task State Change', - ], - 'detail': { - lastStatus: ['STOPPED'], - desiredStatus: ['STOPPED'], - }, - }, - }); - }); -}); diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/cloudwatch-agent.test.ts b/packages/@aws-cdk-containers/ecs-service-extensions/test/cloudwatch-agent.test.ts deleted file mode 100644 index 929f94180b3a2..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/cloudwatch-agent.test.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as cdk from '@aws-cdk/core'; -import { CloudwatchAgentExtension, Container, Environment, Service, ServiceDescription } from '../lib'; - -describe('cloudwatch agent', () => { - test('should be able to add AWS X-Ray to a service', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const environment = new Environment(stack, 'production'); - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - serviceDescription.add(new CloudwatchAgentExtension()); - - new Service(stack, 'my-service', { - environment, - serviceDescription, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ECS::TaskDefinition', { - ContainerDefinitions: [ - { - Cpu: 256, - DependsOn: [ - { - Condition: 'START', - ContainerName: 'cloudwatch-agent', - }, - ], - Essential: true, - Image: 'nathanpeck/name', - Memory: 512, - Name: 'app', - PortMappings: [ - { - ContainerPort: 80, - Protocol: 'tcp', - }, - ], - Ulimits: [ - { - HardLimit: 1024000, - Name: 'nofile', - SoftLimit: 1024000, - }, - ], - }, - { - Environment: [ - { - Name: 'CW_CONFIG_CONTENT', - Value: '{"logs":{"metrics_collected":{"emf":{}}},"metrics":{"metrics_collected":{"statsd":{}}}}', - }, - ], - Essential: true, - Image: 'amazon/cloudwatch-agent:latest', - LogConfiguration: { - LogDriver: 'awslogs', - Options: { - 'awslogs-group': { - Ref: 'myservicetaskdefinitioncloudwatchagentLogGroupDF0CD679', - }, - 'awslogs-stream-prefix': 'cloudwatch-agent', - 'awslogs-region': { - Ref: 'AWS::Region', - }, - }, - }, - MemoryReservation: 50, - Name: 'cloudwatch-agent', - User: '0:1338', - }, - ], - Cpu: '256', - ExecutionRoleArn: { - 'Fn::GetAtt': [ - 'myservicetaskdefinitionExecutionRole0CE74AD0', - 'Arn', - ], - }, - Family: 'myservicetaskdefinition', - Memory: '512', - NetworkMode: 'awsvpc', - RequiresCompatibilities: [ - 'EC2', - 'FARGATE', - ], - TaskRoleArn: { - 'Fn::GetAtt': [ - 'myservicetaskdefinitionTaskRole92ACD903', - 'Arn', - ], - }, - }); - }); -}); \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/container.test.ts b/packages/@aws-cdk-containers/ecs-service-extensions/test/container.test.ts deleted file mode 100644 index 80fbe097b08d0..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/container.test.ts +++ /dev/null @@ -1,309 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as iam from '@aws-cdk/aws-iam'; -import * as awslogs from '@aws-cdk/aws-logs'; -import * as cdk from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; -import { Container, Environment, EnvironmentCapacityType, FireLensExtension, Service, ServiceDescription } from '../lib'; - -describe('container', () => { - test('should be able to add a container to the service', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const cluster = new ecs.Cluster(stack, 'Cluster', { vpc }); - cluster.addAsgCapacityProvider(new ecs.AsgCapacityProvider(stack, 'Provider', { - autoScalingGroup: new autoscaling.AutoScalingGroup(stack, 'DefaultAutoScalingGroup', { - vpc, - machineImage: ec2.MachineImage.latestAmazonLinux(), - instanceType: new ec2.InstanceType('t2.micro'), - }), - })); - - const environment = new Environment(stack, 'production', { - vpc, - cluster, - capacityType: EnvironmentCapacityType.EC2, - }); - const serviceDescription = new ServiceDescription(); - const taskRole = new iam.Role(stack, 'CustomTaskRole', { - assumedBy: new iam.ServicePrincipal('ecs-tasks.amazonaws.com'), - }); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - new Service(stack, 'my-service', { - environment, - serviceDescription, - taskRole, - }); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::ECS::Service', 1); - - Template.fromStack(stack).hasResourceProperties('AWS::ECS::TaskDefinition', { - ContainerDefinitions: [ - { - Cpu: 256, - Essential: true, - Image: 'nathanpeck/name', - Memory: 512, - Name: 'app', - PortMappings: [ - { - ContainerPort: 80, - Protocol: 'tcp', - }, - ], - Ulimits: [ - { - HardLimit: 1024000, - Name: 'nofile', - SoftLimit: 1024000, - }, - ], - }, - ], - Cpu: '256', - Family: 'myservicetaskdefinition', - Memory: '512', - NetworkMode: 'awsvpc', - RequiresCompatibilities: [ - 'EC2', - 'FARGATE', - ], - TaskRoleArn: { - 'Fn::GetAtt': [ - 'CustomTaskRole3C6B13FD', - 'Arn', - ], - }, - }); - }); - - test('should be able to enable default logging behavior - with enable default log driver feature flag', () => { - // GIVEN - const stack = new cdk.Stack(); - stack.node.setContext(cxapi.ECS_SERVICE_EXTENSIONS_ENABLE_DEFAULT_LOG_DRIVER, true); - - const vpc = new ec2.Vpc(stack, 'VPC'); - const cluster = new ecs.Cluster(stack, 'Cluster', { vpc }); - cluster.addAsgCapacityProvider(new ecs.AsgCapacityProvider(stack, 'Provider', { - autoScalingGroup: new autoscaling.AutoScalingGroup(stack, 'DefaultAutoScalingGroup', { - vpc, - machineImage: ec2.MachineImage.latestAmazonLinux(), - instanceType: new ec2.InstanceType('t2.micro'), - }), - })); - - const environment = new Environment(stack, 'production', { - vpc, - cluster, - capacityType: EnvironmentCapacityType.EC2, - }); - const serviceDescription = new ServiceDescription(); - const taskRole = new iam.Role(stack, 'CustomTaskRole', { - assumedBy: new iam.ServicePrincipal('ecs-tasks.amazonaws.com'), - }); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - new Service(stack, 'my-service', { - environment, - serviceDescription, - taskRole, - }); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::ECS::Service', 1); - - // Ensure that the log group was created - Template.fromStack(stack).resourceCountIs('AWS::Logs::LogGroup', 1); - - Template.fromStack(stack).hasResourceProperties('AWS::ECS::TaskDefinition', { - ContainerDefinitions: [ - { - Cpu: 256, - Essential: true, - Image: 'nathanpeck/name', - LogConfiguration: { - LogDriver: 'awslogs', - Options: { - 'awslogs-group': { - Ref: 'myservicelogs176EE19F', - }, - 'awslogs-stream-prefix': 'my-service', - 'awslogs-region': { - Ref: 'AWS::Region', - }, - }, - }, - Memory: 512, - Name: 'app', - PortMappings: [ - { - ContainerPort: 80, - Protocol: 'tcp', - }, - ], - Ulimits: [ - { - HardLimit: 1024000, - Name: 'nofile', - SoftLimit: 1024000, - }, - ], - }, - ], - Cpu: '256', - Family: 'myservicetaskdefinition', - Memory: '512', - NetworkMode: 'awsvpc', - RequiresCompatibilities: [ - 'EC2', - 'FARGATE', - ], - TaskRoleArn: { - 'Fn::GetAtt': [ - 'CustomTaskRole3C6B13FD', - 'Arn', - ], - }, - }); - }); - - test('should be able to add user-provided log group in the log driver options', () => { - // GIVEN - const stack = new cdk.Stack(); - stack.node.setContext(cxapi.ECS_SERVICE_EXTENSIONS_ENABLE_DEFAULT_LOG_DRIVER, true); - - const vpc = new ec2.Vpc(stack, 'VPC'); - const cluster = new ecs.Cluster(stack, 'Cluster', { vpc }); - cluster.addAsgCapacityProvider(new ecs.AsgCapacityProvider(stack, 'Provider', { - autoScalingGroup: new autoscaling.AutoScalingGroup(stack, 'DefaultAutoScalingGroup', { - vpc, - machineImage: ec2.MachineImage.latestAmazonLinux(), - instanceType: new ec2.InstanceType('t2.micro'), - }), - })); - - const environment = new Environment(stack, 'production', { - vpc, - cluster, - capacityType: EnvironmentCapacityType.EC2, - }); - const serviceDescription = new ServiceDescription(); - const taskRole = new iam.Role(stack, 'CustomTaskRole', { - assumedBy: new iam.ServicePrincipal('ecs-tasks.amazonaws.com'), - }); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - logGroup: new awslogs.LogGroup(stack, 'MyLogGroup'), - })); - - new Service(stack, 'my-service', { - environment, - serviceDescription, - taskRole, - }); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::ECS::Service', 1); - - // Ensure that the log group was created - Template.fromStack(stack).resourceCountIs('AWS::Logs::LogGroup', 1); - - Template.fromStack(stack).hasResourceProperties('AWS::ECS::TaskDefinition', { - ContainerDefinitions: [ - { - Cpu: 256, - Essential: true, - Image: 'nathanpeck/name', - LogConfiguration: { - LogDriver: 'awslogs', - Options: { - 'awslogs-group': { - Ref: 'MyLogGroup5C0DAD85', - }, - 'awslogs-stream-prefix': 'my-service', - 'awslogs-region': { - Ref: 'AWS::Region', - }, - }, - }, - Memory: 512, - Name: 'app', - PortMappings: [ - { - ContainerPort: 80, - Protocol: 'tcp', - }, - ], - Ulimits: [ - { - HardLimit: 1024000, - Name: 'nofile', - SoftLimit: 1024000, - }, - ], - }, - ], - Cpu: '256', - Family: 'myservicetaskdefinition', - Memory: '512', - NetworkMode: 'awsvpc', - RequiresCompatibilities: [ - 'EC2', - 'FARGATE', - ], - TaskRoleArn: { - 'Fn::GetAtt': [ - 'CustomTaskRole3C6B13FD', - 'Arn', - ], - }, - }); - }); - - test('should error when log group is provided in the container extension and another observability extension is added', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const environment = new Environment(stack, 'production'); - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - logGroup: new awslogs.LogGroup(stack, 'MyLogGroup'), - })); - serviceDescription.add(new FireLensExtension()); - - // THEN - expect(() => { - new Service(stack, 'my-service', { - environment, - serviceDescription, - }); - }).toThrow(/Log configuration already specified. You cannot provide a log group for the application container of service 'my-service' while also adding log configuration separately using service extensions./); - }); -}); diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/custom-service-extension.integ.snapshot/aws-ecs-integ.assets.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/custom-service-extension.integ.snapshot/aws-ecs-integ.assets.json deleted file mode 100644 index 96f7fa4d6a6aa..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/custom-service-extension.integ.snapshot/aws-ecs-integ.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "20.0.0", - "files": { - "0c4bd04678299111d98eaa888bf6d98b39f6762a55b9ff2f659c9ef35371f748": { - "source": { - "path": "aws-ecs-integ.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "0c4bd04678299111d98eaa888bf6d98b39f6762a55b9ff2f659c9ef35371f748.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-containers/ecs-service-extensions/test/custom-service-extension.integ.snapshot/aws-ecs-integ.template.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/custom-service-extension.integ.snapshot/aws-ecs-integ.template.json deleted file mode 100644 index de9aec45a0fea..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/custom-service-extension.integ.snapshot/aws-ecs-integ.template.json +++ /dev/null @@ -1,651 +0,0 @@ -{ - "Resources": { - "productionenvironmentvpcAEB47DF7": { - "Type": "AWS::EC2::VPC", - "Properties": { - "CidrBlock": "10.0.0.0/16", - "EnableDnsHostnames": true, - "EnableDnsSupport": true, - "InstanceTenancy": "default", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1Subnet8D92C089": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1RouteTableAssociationA8117374": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - } - } - }, - "productionenvironmentvpcPublicSubnet1DefaultRoute524C894D": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - }, - "DependsOn": [ - "productionenvironmentvpcVPCGW1B428D07" - ] - }, - "productionenvironmentvpcPublicSubnet1EIP54BA88DB": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1NATGateway6075E4CA": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - }, - "AllocationId": { - "Fn::GetAtt": [ - "productionenvironmentvpcPublicSubnet1EIP54BA88DB", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - }, - "DependsOn": [ - "productionenvironmentvpcPublicSubnet1DefaultRoute524C894D", - "productionenvironmentvpcPublicSubnet1RouteTableAssociationA8117374" - ] - }, - "productionenvironmentvpcPublicSubnet2Subnet298E6C31": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet2RouteTable842A68D7": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet2RouteTableAssociation0A7549F3": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet2RouteTable842A68D7" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - } - } - }, - "productionenvironmentvpcPublicSubnet2DefaultRoute92CD697D": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet2RouteTable842A68D7" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - }, - "DependsOn": [ - "productionenvironmentvpcVPCGW1B428D07" - ] - }, - "productionenvironmentvpcPublicSubnet2EIP14CA46AA": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet2NATGatewayE1850FCC": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - }, - "AllocationId": { - "Fn::GetAtt": [ - "productionenvironmentvpcPublicSubnet2EIP14CA46AA", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - }, - "DependsOn": [ - "productionenvironmentvpcPublicSubnet2DefaultRoute92CD697D", - "productionenvironmentvpcPublicSubnet2RouteTableAssociation0A7549F3" - ] - }, - "productionenvironmentvpcPrivateSubnet1Subnet53F632E6": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet1RouteTableAssociation8BA32463": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - } - } - }, - "productionenvironmentvpcPrivateSubnet1DefaultRouteFBB3DE6C": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "productionenvironmentvpcPublicSubnet1NATGateway6075E4CA" - } - } - }, - "productionenvironmentvpcPrivateSubnet2Subnet756FB93C": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet2RouteTableAssociation09188261": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - } - }, - "productionenvironmentvpcPrivateSubnet2DefaultRoute5F9AB6C1": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "productionenvironmentvpcPublicSubnet2NATGatewayE1850FCC" - } - } - }, - "productionenvironmentvpcIGWE7C39890": { - "Type": "AWS::EC2::InternetGateway", - "Properties": { - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc" - } - ] - } - }, - "productionenvironmentvpcVPCGW1B428D07": { - "Type": "AWS::EC2::VPCGatewayAttachment", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "InternetGatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - } - }, - "productionenvironmentclusterC6599D2D": { - "Type": "AWS::ECS::Cluster" - }, - "nametaskdefinitionTaskRole50FE844E": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "nametaskdefinition690762BB": { - "Type": "AWS::ECS::TaskDefinition", - "Properties": { - "ContainerDefinitions": [ - { - "Cpu": 1024, - "Environment": [ - { - "Name": "PORT", - "Value": "80" - } - ], - "Essential": true, - "Image": "nathanpeck/name", - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "namelogsF4B17D31" - }, - "awslogs-stream-prefix": "name", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "Memory": 2048, - "Name": "app", - "PortMappings": [ - { - "ContainerPort": 80, - "Protocol": "tcp" - } - ], - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ] - } - ], - "Cpu": "1024", - "ExecutionRoleArn": { - "Fn::GetAtt": [ - "nametaskdefinitionExecutionRole45AC5C9A", - "Arn" - ] - }, - "Family": "awsecsintegnametaskdefinition0EA6A1A0", - "Memory": "2048", - "NetworkMode": "awsvpc", - "RequiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "TaskRoleArn": { - "Fn::GetAtt": [ - "nametaskdefinitionTaskRole50FE844E", - "Arn" - ] - } - } - }, - "nametaskdefinitionExecutionRole45AC5C9A": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "nametaskdefinitionExecutionRoleDefaultPolicyF7942D20": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "namelogsF4B17D31", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "nametaskdefinitionExecutionRoleDefaultPolicyF7942D20", - "Roles": [ - { - "Ref": "nametaskdefinitionExecutionRole45AC5C9A" - } - ] - } - }, - "namelogsF4B17D31": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "name-logs", - "RetentionInDays": 30 - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "nameserviceService8015C8D6": { - "Type": "AWS::ECS::Service", - "Properties": { - "Cluster": { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "DeploymentConfiguration": { - "MaximumPercent": 200, - "MinimumHealthyPercent": 100 - }, - "DesiredCount": 10, - "EnableECSManagedTags": false, - "LaunchType": "FARGATE", - "NetworkConfiguration": { - "AwsvpcConfiguration": { - "AssignPublicIp": "DISABLED", - "SecurityGroups": [ - { - "Fn::GetAtt": [ - "nameserviceSecurityGroup33F4662C", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - }, - { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - ] - } - }, - "TaskDefinition": { - "Ref": "nametaskdefinition690762BB" - } - } - }, - "nameserviceSecurityGroup33F4662C": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "aws-ecs-integ/name-service/SecurityGroup", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "nameserviceTaskCountTarget366C2B3A": { - "Type": "AWS::ApplicationAutoScaling::ScalableTarget", - "Properties": { - "MaxCapacity": 20, - "MinCapacity": 5, - "ResourceId": { - "Fn::Join": [ - "", - [ - "service/", - { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "/", - { - "Fn::GetAtt": [ - "nameserviceService8015C8D6", - "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" - } - }, - "nameserviceTaskCountTargetTargetCpuUtilization50E2840097": { - "Type": "AWS::ApplicationAutoScaling::ScalingPolicy", - "Properties": { - "PolicyName": "awsecsintegnameserviceTaskCountTargetTargetCpuUtilization508522EB56", - "PolicyType": "TargetTrackingScaling", - "ScalingTargetId": { - "Ref": "nameserviceTaskCountTarget366C2B3A" - }, - "TargetTrackingScalingPolicyConfiguration": { - "PredefinedMetricSpecification": { - "PredefinedMetricType": "ECSServiceAverageCPUUtilization" - }, - "ScaleInCooldown": 60, - "ScaleOutCooldown": 60, - "TargetValue": 50 - } - } - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/custom-service-extension.integ.snapshot/cdk.out b/packages/@aws-cdk-containers/ecs-service-extensions/test/custom-service-extension.integ.snapshot/cdk.out deleted file mode 100644 index 588d7b269d34f..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/custom-service-extension.integ.snapshot/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/custom-service-extension.integ.snapshot/integ.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/custom-service-extension.integ.snapshot/integ.json deleted file mode 100644 index b6de8c13acc3b..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/custom-service-extension.integ.snapshot/integ.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "version": "20.0.0", - "testCases": { - "integ.custom-service-extension": { - "stacks": [ - "aws-ecs-integ" - ], - "diffAssets": false, - "stackUpdateWorkflow": true - } - }, - "synthContext": {}, - "enableLookups": false -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/custom-service-extension.integ.snapshot/manifest.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/custom-service-extension.integ.snapshot/manifest.json deleted file mode 100644 index b04bfd09f5e8a..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/custom-service-extension.integ.snapshot/manifest.json +++ /dev/null @@ -1,220 +0,0 @@ -{ - "version": "20.0.0", - "artifacts": { - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - }, - "aws-ecs-integ": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "aws-ecs-integ.template.json", - "validateOnSynth": false - }, - "metadata": { - "/aws-ecs-integ/production-environment-vpc/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcAEB47DF7" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet1/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet1/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet1/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet1RouteTableAssociationA8117374" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet1/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet1DefaultRoute524C894D" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet1/EIP": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet1EIP54BA88DB" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet1/NATGateway": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet1NATGateway6075E4CA" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet2/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet2/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet2RouteTable842A68D7" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet2/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet2RouteTableAssociation0A7549F3" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet2/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet2DefaultRoute92CD697D" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet2/EIP": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet2EIP14CA46AA" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet2/NATGateway": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet2NATGatewayE1850FCC" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet1/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet1/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet1/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet1RouteTableAssociation8BA32463" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet1/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet1DefaultRouteFBB3DE6C" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet2/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet2/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet2/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet2RouteTableAssociation09188261" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet2/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet2DefaultRoute5F9AB6C1" - } - ], - "/aws-ecs-integ/production-environment-vpc/IGW": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcIGWE7C39890" - } - ], - "/aws-ecs-integ/production-environment-vpc/VPCGW": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcVPCGW1B428D07" - } - ], - "/aws-ecs-integ/production-environment-cluster/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentclusterC6599D2D" - } - ], - "/aws-ecs-integ/name-task-definition/TaskRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nametaskdefinitionTaskRole50FE844E" - } - ], - "/aws-ecs-integ/name-task-definition/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nametaskdefinition690762BB" - } - ], - "/aws-ecs-integ/name-task-definition/ExecutionRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nametaskdefinitionExecutionRole45AC5C9A" - } - ], - "/aws-ecs-integ/name-task-definition/ExecutionRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nametaskdefinitionExecutionRoleDefaultPolicyF7942D20" - } - ], - "/aws-ecs-integ/name-logs/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "namelogsF4B17D31" - } - ], - "/aws-ecs-integ/name-service/Service": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceService8015C8D6" - } - ], - "/aws-ecs-integ/name-service/SecurityGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceSecurityGroup33F4662C" - } - ], - "/aws-ecs-integ/name-service/TaskCount/Target/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceTaskCountTarget366C2B3A" - } - ], - "/aws-ecs-integ/name-service/TaskCount/Target/TargetCpuUtilization50/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameserviceTaskCountTargetTargetCpuUtilization50E2840097" - } - ] - }, - "displayName": "aws-ecs-integ" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/custom-service-extension.integ.snapshot/tree.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/custom-service-extension.integ.snapshot/tree.json deleted file mode 100644 index 7576805c86192..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/custom-service-extension.integ.snapshot/tree.json +++ /dev/null @@ -1,1151 +0,0 @@ -{ - "version": "tree-0.1", - "tree": { - "id": "App", - "path": "", - "children": { - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.78" - } - }, - "aws-ecs-integ": { - "id": "aws-ecs-integ", - "path": "aws-ecs-integ", - "children": { - "production": { - "id": "production", - "path": "aws-ecs-integ/production", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.78" - } - }, - "production-environment-vpc": { - "id": "production-environment-vpc", - "path": "aws-ecs-integ/production-environment-vpc", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/production-environment-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-integ/production-environment-vpc" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnVPC", - "version": "0.0.0" - } - }, - "PublicSubnet1": { - "id": "PublicSubnet1", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21" - }, - "subnetId": { - "Ref": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21" - }, - "destinationCidrBlock": "0.0.0.0/0", - "gatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - }, - "EIP": { - "id": "EIP", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1/EIP", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::EIP", - "aws:cdk:cloudformation:props": { - "domain": "vpc", - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnEIP", - "version": "0.0.0" - } - }, - "NATGateway": { - "id": "NATGateway", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1/NATGateway", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", - "aws:cdk:cloudformation:props": { - "subnetId": { - "Ref": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - }, - "allocationId": { - "Fn::GetAtt": [ - "productionenvironmentvpcPublicSubnet1EIP54BA88DB", - "AllocationId" - ] - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnNatGateway", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PublicSubnet", - "version": "0.0.0" - } - }, - "PublicSubnet2": { - "id": "PublicSubnet2", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPublicSubnet2RouteTable842A68D7" - }, - "subnetId": { - "Ref": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPublicSubnet2RouteTable842A68D7" - }, - "destinationCidrBlock": "0.0.0.0/0", - "gatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - }, - "EIP": { - "id": "EIP", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2/EIP", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::EIP", - "aws:cdk:cloudformation:props": { - "domain": "vpc", - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnEIP", - "version": "0.0.0" - } - }, - "NATGateway": { - "id": "NATGateway", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2/NATGateway", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", - "aws:cdk:cloudformation:props": { - "subnetId": { - "Ref": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - }, - "allocationId": { - "Fn::GetAtt": [ - "productionenvironmentvpcPublicSubnet2EIP14CA46AA", - "AllocationId" - ] - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnNatGateway", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PublicSubnet", - "version": "0.0.0" - } - }, - "PrivateSubnet1": { - "id": "PrivateSubnet1", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C" - }, - "subnetId": { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C" - }, - "destinationCidrBlock": "0.0.0.0/0", - "natGatewayId": { - "Ref": "productionenvironmentvpcPublicSubnet1NATGateway6075E4CA" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PrivateSubnet", - "version": "0.0.0" - } - }, - "PrivateSubnet2": { - "id": "PrivateSubnet2", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2" - }, - "subnetId": { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2" - }, - "destinationCidrBlock": "0.0.0.0/0", - "natGatewayId": { - "Ref": "productionenvironmentvpcPublicSubnet2NATGatewayE1850FCC" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PrivateSubnet", - "version": "0.0.0" - } - }, - "IGW": { - "id": "IGW", - "path": "aws-ecs-integ/production-environment-vpc/IGW", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::InternetGateway", - "aws:cdk:cloudformation:props": { - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnInternetGateway", - "version": "0.0.0" - } - }, - "VPCGW": { - "id": "VPCGW", - "path": "aws-ecs-integ/production-environment-vpc/VPCGW", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "internetGatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnVPCGatewayAttachment", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.Vpc", - "version": "0.0.0" - } - }, - "production-environment-cluster": { - "id": "production-environment-cluster", - "path": "aws-ecs-integ/production-environment-cluster", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/production-environment-cluster/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ECS::Cluster", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.CfnCluster", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.Cluster", - "version": "0.0.0" - } - }, - "name": { - "id": "name", - "path": "aws-ecs-integ/name", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.78" - } - }, - "name-task-definition": { - "id": "name-task-definition", - "path": "aws-ecs-integ/name-task-definition", - "children": { - "TaskRole": { - "id": "TaskRole", - "path": "aws-ecs-integ/name-task-definition/TaskRole", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-task-definition/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/aws-iam.CfnRole", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-task-definition/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ECS::TaskDefinition", - "aws:cdk:cloudformation:props": { - "containerDefinitions": [ - { - "cpu": 1024, - "essential": true, - "image": "nathanpeck/name", - "memory": 2048, - "name": "app", - "portMappings": [ - { - "containerPort": 80, - "protocol": "tcp" - } - ], - "ulimits": [ - { - "name": "nofile", - "softLimit": 1024000, - "hardLimit": 1024000 - } - ], - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-group": { - "Ref": "namelogsF4B17D31" - }, - "awslogs-stream-prefix": "name", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "environment": [ - { - "name": "PORT", - "value": "80" - } - ] - } - ], - "cpu": "1024", - "executionRoleArn": { - "Fn::GetAtt": [ - "nametaskdefinitionExecutionRole45AC5C9A", - "Arn" - ] - }, - "family": "awsecsintegnametaskdefinition0EA6A1A0", - "memory": "2048", - "networkMode": "awsvpc", - "requiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "taskRoleArn": { - "Fn::GetAtt": [ - "nametaskdefinitionTaskRole50FE844E", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.CfnTaskDefinition", - "version": "0.0.0" - } - }, - "app": { - "id": "app", - "path": "aws-ecs-integ/name-task-definition/app", - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.ContainerDefinition", - "version": "0.0.0" - } - }, - "ExecutionRole": { - "id": "ExecutionRole", - "path": "aws-ecs-integ/name-task-definition/ExecutionRole", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-task-definition/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/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "aws-ecs-integ/name-task-definition/ExecutionRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-task-definition/ExecutionRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "namelogsF4B17D31", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "nametaskdefinitionExecutionRoleDefaultPolicyF7942D20", - "roles": [ - { - "Ref": "nametaskdefinitionExecutionRole45AC5C9A" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.TaskDefinition", - "version": "0.0.0" - } - }, - "name-logs": { - "id": "name-logs", - "path": "aws-ecs-integ/name-logs", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-logs/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", - "aws:cdk:cloudformation:props": { - "logGroupName": "name-logs", - "retentionInDays": 30 - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.CfnLogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.LogGroup", - "version": "0.0.0" - } - }, - "name-service": { - "id": "name-service", - "path": "aws-ecs-integ/name-service", - "children": { - "Service": { - "id": "Service", - "path": "aws-ecs-integ/name-service/Service", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ECS::Service", - "aws:cdk:cloudformation:props": { - "cluster": { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "deploymentConfiguration": { - "maximumPercent": 200, - "minimumHealthyPercent": 100 - }, - "desiredCount": 10, - "enableEcsManagedTags": false, - "launchType": "FARGATE", - "networkConfiguration": { - "awsvpcConfiguration": { - "assignPublicIp": "DISABLED", - "subnets": [ - { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - }, - { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - ], - "securityGroups": [ - { - "Fn::GetAtt": [ - "nameserviceSecurityGroup33F4662C", - "GroupId" - ] - } - ] - } - }, - "taskDefinition": { - "Ref": "nametaskdefinition690762BB" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.CfnService", - "version": "0.0.0" - } - }, - "SecurityGroup": { - "id": "SecurityGroup", - "path": "aws-ecs-integ/name-service/SecurityGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-service/SecurityGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", - "aws:cdk:cloudformation:props": { - "groupDescription": "aws-ecs-integ/name-service/SecurityGroup", - "securityGroupEgress": [ - { - "cidrIp": "0.0.0.0/0", - "description": "Allow all outbound traffic by default", - "ipProtocol": "-1" - } - ], - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSecurityGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.SecurityGroup", - "version": "0.0.0" - } - }, - "ScalingRole": { - "id": "ScalingRole", - "path": "aws-ecs-integ/name-service/ScalingRole", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "TaskCount": { - "id": "TaskCount", - "path": "aws-ecs-integ/name-service/TaskCount", - "children": { - "Target": { - "id": "Target", - "path": "aws-ecs-integ/name-service/TaskCount/Target", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-service/TaskCount/Target/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ApplicationAutoScaling::ScalableTarget", - "aws:cdk:cloudformation:props": { - "maxCapacity": 20, - "minCapacity": 5, - "resourceId": { - "Fn::Join": [ - "", - [ - "service/", - { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "/", - { - "Fn::GetAtt": [ - "nameserviceService8015C8D6", - "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/aws-applicationautoscaling.CfnScalableTarget", - "version": "0.0.0" - } - }, - "TargetCpuUtilization50": { - "id": "TargetCpuUtilization50", - "path": "aws-ecs-integ/name-service/TaskCount/Target/TargetCpuUtilization50", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-service/TaskCount/Target/TargetCpuUtilization50/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ApplicationAutoScaling::ScalingPolicy", - "aws:cdk:cloudformation:props": { - "policyName": "awsecsintegnameserviceTaskCountTargetTargetCpuUtilization508522EB56", - "policyType": "TargetTrackingScaling", - "scalingTargetId": { - "Ref": "nameserviceTaskCountTarget366C2B3A" - }, - "targetTrackingScalingPolicyConfiguration": { - "predefinedMetricSpecification": { - "predefinedMetricType": "ECSServiceAverageCPUUtilization" - }, - "scaleInCooldown": 60, - "scaleOutCooldown": 60, - "targetValue": 50 - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-applicationautoscaling.CfnScalingPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-applicationautoscaling.TargetTrackingScalingPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-applicationautoscaling.ScalableTarget", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.ScalableTaskCount", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.FargateService", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Stack", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.App", - "version": "0.0.0" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/environment.test.ts b/packages/@aws-cdk-containers/ecs-service-extensions/test/environment.test.ts deleted file mode 100644 index dc49c70a1b9d8..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/environment.test.ts +++ /dev/null @@ -1,244 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as cdk from '@aws-cdk/core'; -import { Container, Environment, EnvironmentCapacityType, Service, ServiceDescription } from '../lib'; - -describe('environment', () => { - test('should be able to add a service to an environment', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const environment = new Environment(stack, 'production'); - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - new Service(stack, 'my-service', { - environment, - serviceDescription, - }); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::ECS::Service', 1); - - Template.fromStack(stack).hasResourceProperties('AWS::ECS::TaskDefinition', { - ContainerDefinitions: [ - { - Cpu: 256, - Essential: true, - Image: 'nathanpeck/name', - Memory: 512, - Name: 'app', - PortMappings: [ - { - ContainerPort: 80, - Protocol: 'tcp', - }, - ], - Ulimits: [ - { - HardLimit: 1024000, - Name: 'nofile', - SoftLimit: 1024000, - }, - ], - }, - ], - Cpu: '256', - Family: 'myservicetaskdefinition', - Memory: '512', - NetworkMode: 'awsvpc', - RequiresCompatibilities: [ - 'EC2', - 'FARGATE', - ], - TaskRoleArn: { - 'Fn::GetAtt': [ - 'myservicetaskdefinitionTaskRole92ACD903', - 'Arn', - ], - }, - }); - }); - - test('should be able to create a Fargate environment with a given VPC and cluster', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const vpc = new ec2.Vpc(stack, 'VPC'); - const cluster = new ecs.Cluster(stack, 'Cluster', { vpc }); - - const environment = new Environment(stack, 'production', { - vpc, - cluster, - }); - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - new Service(stack, 'my-service', { - environment, - serviceDescription, - }); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::ECS::Service', 1); - - Template.fromStack(stack).hasResourceProperties('AWS::ECS::TaskDefinition', { - ContainerDefinitions: [ - { - Cpu: 256, - Essential: true, - Image: 'nathanpeck/name', - Memory: 512, - Name: 'app', - PortMappings: [ - { - ContainerPort: 80, - Protocol: 'tcp', - }, - ], - Ulimits: [ - { - HardLimit: 1024000, - Name: 'nofile', - SoftLimit: 1024000, - }, - ], - }, - ], - Cpu: '256', - Family: 'myservicetaskdefinition', - Memory: '512', - NetworkMode: 'awsvpc', - RequiresCompatibilities: [ - 'EC2', - 'FARGATE', - ], - TaskRoleArn: { - 'Fn::GetAtt': [ - 'myservicetaskdefinitionTaskRole92ACD903', - 'Arn', - ], - }, - }); - }); - - test('should be able to create an environment for EC2', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const vpc = new ec2.Vpc(stack, 'VPC'); - const cluster = new ecs.Cluster(stack, 'Cluster', { vpc }); - cluster.addAsgCapacityProvider(new ecs.AsgCapacityProvider(stack, 'Provider', { - autoScalingGroup: new autoscaling.AutoScalingGroup(stack, 'DefaultAutoScalingGroup', { - vpc, - machineImage: ec2.MachineImage.latestAmazonLinux(), - instanceType: new ec2.InstanceType('t2.micro'), - }), - })); - - const environment = new Environment(stack, 'production', { - vpc, - cluster, - capacityType: EnvironmentCapacityType.EC2, - }); - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - new Service(stack, 'my-service', { - environment, - serviceDescription, - }); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::ECS::Service', 1); - - Template.fromStack(stack).hasResourceProperties('AWS::ECS::TaskDefinition', { - ContainerDefinitions: [ - { - Cpu: 256, - Essential: true, - Image: 'nathanpeck/name', - Memory: 512, - Name: 'app', - PortMappings: [ - { - ContainerPort: 80, - Protocol: 'tcp', - }, - ], - Ulimits: [ - { - HardLimit: 1024000, - Name: 'nofile', - SoftLimit: 1024000, - }, - ], - }, - ], - Cpu: '256', - Family: 'myservicetaskdefinition', - Memory: '512', - NetworkMode: 'awsvpc', - RequiresCompatibilities: [ - 'EC2', - 'FARGATE', - ], - TaskRoleArn: { - 'Fn::GetAtt': [ - 'myservicetaskdefinitionTaskRole92ACD903', - 'Arn', - ], - }, - }); - }); - - test('should be able to create an environment from attributes', () => { - // GIVEN - const stack = new cdk.Stack(); - - const vpc = new ec2.Vpc(stack, 'VPC'); - const cluster = new ecs.Cluster(stack, 'Cluster', { vpc }); - cluster.addAsgCapacityProvider(new ecs.AsgCapacityProvider(stack, 'Provider', { - autoScalingGroup: new autoscaling.AutoScalingGroup(stack, 'DefaultAutoScalingGroup', { - vpc, - machineImage: ec2.MachineImage.latestAmazonLinux(), - instanceType: new ec2.InstanceType('t2.micro'), - }), - })); - - // WHEN - const environment = Environment.fromEnvironmentAttributes(stack, 'Environment', { - capacityType: EnvironmentCapacityType.EC2, - cluster: cluster, - }); - - // THEN - expect(environment.capacityType).toEqual(EnvironmentCapacityType.EC2); - expect(environment.cluster).toEqual(cluster); - expect(environment.vpc).toEqual(vpc); - expect(environment.id).toEqual('Environment'); - }); -}); diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/firelens.test.ts b/packages/@aws-cdk-containers/ecs-service-extensions/test/firelens.test.ts deleted file mode 100644 index 6cdd83d07610c..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/firelens.test.ts +++ /dev/null @@ -1,118 +0,0 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as cdk from '@aws-cdk/core'; -import { Container, Environment, FireLensExtension, Service, ServiceDescription } from '../lib'; - -describe('firelens', () => { - test('should be able to add Firelens to a service', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const environment = new Environment(stack, 'production'); - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - serviceDescription.add(new FireLensExtension()); - - new Service(stack, 'my-service', { - environment, - serviceDescription, - }); - - // THEN - - // Ensure that the log group was created - Template.fromStack(stack).hasResource('AWS::Logs::LogGroup', Match.anyValue()); - - // Ensure that task has a Firelens sidecar and a log configuration - // pointing at the sidecar - Template.fromStack(stack).hasResourceProperties('AWS::ECS::TaskDefinition', { - ContainerDefinitions: [ - { - Cpu: 256, - DependsOn: [ - { - Condition: 'START', - ContainerName: 'firelens', - }, - ], - Essential: true, - Image: 'nathanpeck/name', - LogConfiguration: { - LogDriver: 'awsfirelens', - Options: { - Name: 'cloudwatch', - region: { - Ref: 'AWS::Region', - }, - log_group_name: { - Ref: 'myservicelogs176EE19F', - }, - log_stream_prefix: 'my-service/', - }, - }, - Memory: 512, - Name: 'app', - PortMappings: [ - { - ContainerPort: 80, - Protocol: 'tcp', - }, - ], - Ulimits: [ - { - HardLimit: 1024000, - Name: 'nofile', - SoftLimit: 1024000, - }, - ], - }, - { - Essential: true, - FirelensConfiguration: { - Type: 'fluentbit', - }, - Image: { - Ref: 'SsmParameterValueawsserviceawsforfluentbitlatestC96584B6F00A464EAD1953AFF4B05118Parameter', - }, - LogConfiguration: { - LogDriver: 'awslogs', - Options: { - 'awslogs-group': { - Ref: 'myservicetaskdefinitionfirelensLogGroup0D59B0EB', - }, - 'awslogs-stream-prefix': 'firelens', - 'awslogs-region': { - Ref: 'AWS::Region', - }, - }, - }, - MemoryReservation: 50, - Name: 'firelens', - User: '0:1338', - }, - ], - Cpu: '256', - Family: 'myservicetaskdefinition', - Memory: '512', - NetworkMode: 'awsvpc', - RequiresCompatibilities: [ - 'EC2', - 'FARGATE', - ], - TaskRoleArn: { - 'Fn::GetAtt': [ - 'myservicetaskdefinitionTaskRole92ACD903', - 'Arn', - ], - }, - }); - }); -}); \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/http-load-balancer.test.ts b/packages/@aws-cdk-containers/ecs-service-extensions/test/http-load-balancer.test.ts deleted file mode 100644 index 8af4ef5d44ab6..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/http-load-balancer.test.ts +++ /dev/null @@ -1,140 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as cdk from '@aws-cdk/core'; -import { Container, Environment, HttpLoadBalancerExtension, Service, ServiceDescription } from '../lib'; - -describe('http load balancer', () => { - test('should be able to add an HTTP load balancer to a service', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const environment = new Environment(stack, 'production'); - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - serviceDescription.add(new HttpLoadBalancerExtension()); - - new Service(stack, 'my-service', { - environment, - serviceDescription, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ECS::TaskDefinition', { - ContainerDefinitions: [ - { - Cpu: 256, - Essential: true, - Image: 'nathanpeck/name', - Memory: 512, - Name: 'app', - PortMappings: [ - { - ContainerPort: 80, - Protocol: 'tcp', - }, - ], - Ulimits: [ - { - HardLimit: 1024000, - Name: 'nofile', - SoftLimit: 1024000, - }, - ], - }, - ], - Cpu: '256', - Family: 'myservicetaskdefinition', - Memory: '512', - NetworkMode: 'awsvpc', - RequiresCompatibilities: [ - 'EC2', - 'FARGATE', - ], - TaskRoleArn: { - 'Fn::GetAtt': [ - 'myservicetaskdefinitionTaskRole92ACD903', - 'Arn', - ], - }, - }); - - Template.fromStack(stack).resourceCountIs('AWS::ElasticLoadBalancingV2::LoadBalancer', 1); - Template.fromStack(stack).resourceCountIs('AWS::ElasticLoadBalancingV2::Listener', 1); - }); - - test('allows scaling on request count for the HTTP load balancer', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const environment = new Environment(stack, 'production'); - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - serviceDescription.add(new HttpLoadBalancerExtension({ requestsPerTarget: 100 })); - - new Service(stack, 'my-service', { - environment, - serviceDescription, - autoScaleTaskCount: { - maxTaskCount: 5, - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalableTarget', { - MaxCapacity: 5, - MinCapacity: 1, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalingPolicy', { - PolicyType: 'TargetTrackingScaling', - TargetTrackingScalingPolicyConfiguration: { - PredefinedMetricSpecification: { - PredefinedMetricType: 'ALBRequestCountPerTarget', - }, - TargetValue: 100, - }, - }); - }); - - test('should error when adding scaling policy if scaling target has not been configured', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const environment = new Environment(stack, 'production'); - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - serviceDescription.add(new HttpLoadBalancerExtension({ requestsPerTarget: 100 })); - - // THEN - expect(() => { - new Service(stack, 'my-service', { - environment, - serviceDescription, - }); - }).toThrow(/Auto scaling target for the service 'my-service' hasn't been configured. Please use Service construct to configure 'minTaskCount' and 'maxTaskCount'./); - }); -}); \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/imported-environment.integ.snapshot/cdk.out b/packages/@aws-cdk-containers/ecs-service-extensions/test/imported-environment.integ.snapshot/cdk.out deleted file mode 100644 index 90bef2e09ad39..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/imported-environment.integ.snapshot/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"17.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/imported-environment.integ.snapshot/imported-environment-integ.assets.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/imported-environment.integ.snapshot/imported-environment-integ.assets.json deleted file mode 100644 index 0ea5cec6feccc..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/imported-environment.integ.snapshot/imported-environment-integ.assets.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "version": "17.0.0", - "files": { - "78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01": { - "source": { - "path": "importedenvironmentintegResourcesAB23EBEF.nested.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - }, - "7fe9c99c1005b092d9fa9efe78ab85333dfa158c59b57e1044f1ceba138ba46e": { - "source": { - "path": "imported-environment-integ.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "7fe9c99c1005b092d9fa9efe78ab85333dfa158c59b57e1044f1ceba138ba46e.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-containers/ecs-service-extensions/test/imported-environment.integ.snapshot/imported-environment-integ.template.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/imported-environment.integ.snapshot/imported-environment-integ.template.json deleted file mode 100644 index e717d68f82ecc..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/imported-environment.integ.snapshot/imported-environment-integ.template.json +++ /dev/null @@ -1,439 +0,0 @@ -{ - "Resources": { - "ResourcesNestedStackResourcesNestedStackResourceCDA26E60": { - "Type": "AWS::CloudFormation::Stack", - "Properties": { - "TemplateURL": { - "Fn::Join": [ - "", - [ - "https://s3.", - { - "Ref": "AWS::Region" - }, - ".", - { - "Ref": "AWS::URLSuffix" - }, - "/", - { - "Ref": "AssetParameters78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01S3Bucket64585C1B" - }, - "/", - { - "Fn::Select": [ - 0, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameters78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01S3VersionKey41670582" - } - ] - } - ] - }, - { - "Fn::Select": [ - 1, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameters78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01S3VersionKey41670582" - } - ] - } - ] - } - ] - ] - } - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "ServiceloadbalancerD5D60894": { - "Type": "AWS::ElasticLoadBalancingV2::LoadBalancer", - "Properties": { - "LoadBalancerAttributes": [ - { - "Key": "deletion_protection.enabled", - "Value": "false" - } - ], - "Scheme": "internet-facing", - "SecurityGroups": [ - { - "Fn::GetAtt": [ - "ServiceloadbalancerSecurityGroup2DA3E8D6", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Fn::GetAtt": [ - "ResourcesNestedStackResourcesNestedStackResourceCDA26E60", - "Outputs.importedenvironmentintegResourcesEnvironmentenvironmentvpcPublicSubnet1Subnet0D15D382Ref" - ] - }, - { - "Fn::GetAtt": [ - "ResourcesNestedStackResourcesNestedStackResourceCDA26E60", - "Outputs.importedenvironmentintegResourcesEnvironmentenvironmentvpcPublicSubnet2Subnet68645ACARef" - ] - } - ], - "Type": "application" - } - }, - "ServiceloadbalancerSecurityGroup2DA3E8D6": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "Automatically created Security Group for ELB importedenvironmentintegServiceloadbalancerFAE8A5FA", - "SecurityGroupIngress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow from anyone on port 80", - "FromPort": 80, - "IpProtocol": "tcp", - "ToPort": 80 - } - ], - "VpcId": { - "Fn::GetAtt": [ - "ResourcesNestedStackResourcesNestedStackResourceCDA26E60", - "Outputs.importedenvironmentintegResourcesEnvironmentenvironmentvpcDC34D4D3Ref" - ] - } - } - }, - "ServiceloadbalancerSecurityGrouptoimportedenvironmentintegServiceserviceSecurityGroup2BE90F7480B17EB7CA": { - "Type": "AWS::EC2::SecurityGroupEgress", - "Properties": { - "GroupId": { - "Fn::GetAtt": [ - "ServiceloadbalancerSecurityGroup2DA3E8D6", - "GroupId" - ] - }, - "IpProtocol": "tcp", - "Description": "Load balancer to target", - "DestinationSecurityGroupId": { - "Fn::GetAtt": [ - "ServiceserviceSecurityGroup1915660F", - "GroupId" - ] - }, - "FromPort": 80, - "ToPort": 80 - } - }, - "ServiceloadbalancerServicelistenerC862F722": { - "Type": "AWS::ElasticLoadBalancingV2::Listener", - "Properties": { - "DefaultActions": [ - { - "TargetGroupArn": { - "Ref": "ServiceloadbalancerServicelistenerServiceGroup844B51E6" - }, - "Type": "forward" - } - ], - "LoadBalancerArn": { - "Ref": "ServiceloadbalancerD5D60894" - }, - "Port": 80, - "Protocol": "HTTP" - } - }, - "ServiceloadbalancerServicelistenerServiceGroup844B51E6": { - "Type": "AWS::ElasticLoadBalancingV2::TargetGroup", - "Properties": { - "Port": 80, - "Protocol": "HTTP", - "TargetGroupAttributes": [ - { - "Key": "deregistration_delay.timeout_seconds", - "Value": "10" - }, - { - "Key": "stickiness.enabled", - "Value": "false" - } - ], - "TargetType": "ip", - "VpcId": { - "Fn::GetAtt": [ - "ResourcesNestedStackResourcesNestedStackResourceCDA26E60", - "Outputs.importedenvironmentintegResourcesEnvironmentenvironmentvpcDC34D4D3Ref" - ] - } - } - }, - "ServicetaskdefinitionTaskRole5B4B60A4": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "Servicetaskdefinition0CEAD834": { - "Type": "AWS::ECS::TaskDefinition", - "Properties": { - "ContainerDefinitions": [ - { - "Cpu": 256, - "Environment": [ - { - "Name": "PORT", - "Value": "80" - } - ], - "Essential": true, - "Image": "nathanpeck/name", - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "Servicelogs9F4E1F70" - }, - "awslogs-stream-prefix": "Service", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "Memory": 512, - "Name": "app", - "PortMappings": [ - { - "ContainerPort": 80, - "Protocol": "tcp" - } - ], - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ] - } - ], - "Cpu": "256", - "ExecutionRoleArn": { - "Fn::GetAtt": [ - "ServicetaskdefinitionExecutionRoleD09F4578", - "Arn" - ] - }, - "Family": "importedenvironmentintegServicetaskdefinition63936B87", - "Memory": "512", - "NetworkMode": "awsvpc", - "RequiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "TaskRoleArn": { - "Fn::GetAtt": [ - "ServicetaskdefinitionTaskRole5B4B60A4", - "Arn" - ] - } - } - }, - "ServicetaskdefinitionExecutionRoleD09F4578": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "ServicetaskdefinitionExecutionRoleDefaultPolicy25CEAFC5": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "Servicelogs9F4E1F70", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "ServicetaskdefinitionExecutionRoleDefaultPolicy25CEAFC5", - "Roles": [ - { - "Ref": "ServicetaskdefinitionExecutionRoleD09F4578" - } - ] - } - }, - "Servicelogs9F4E1F70": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "Service-logs", - "RetentionInDays": 30 - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "ServiceserviceService6A153CB8": { - "Type": "AWS::ECS::Service", - "Properties": { - "Cluster": { - "Fn::GetAtt": [ - "ResourcesNestedStackResourcesNestedStackResourceCDA26E60", - "Outputs.importedenvironmentintegResourcesEnvironmentenvironmentcluster594A3DCARef" - ] - }, - "DeploymentConfiguration": { - "MaximumPercent": 200, - "MinimumHealthyPercent": 100 - }, - "DesiredCount": 1, - "EnableECSManagedTags": false, - "HealthCheckGracePeriodSeconds": 60, - "LaunchType": "FARGATE", - "LoadBalancers": [ - { - "ContainerName": "app", - "ContainerPort": 80, - "TargetGroupArn": { - "Ref": "ServiceloadbalancerServicelistenerServiceGroup844B51E6" - } - } - ], - "NetworkConfiguration": { - "AwsvpcConfiguration": { - "AssignPublicIp": "DISABLED", - "SecurityGroups": [ - { - "Fn::GetAtt": [ - "ServiceserviceSecurityGroup1915660F", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Fn::GetAtt": [ - "ResourcesNestedStackResourcesNestedStackResourceCDA26E60", - "Outputs.importedenvironmentintegResourcesEnvironmentenvironmentvpcPrivateSubnet1Subnet7309E967Ref" - ] - }, - { - "Fn::GetAtt": [ - "ResourcesNestedStackResourcesNestedStackResourceCDA26E60", - "Outputs.importedenvironmentintegResourcesEnvironmentenvironmentvpcPrivateSubnet2Subnet55014443Ref" - ] - } - ] - } - }, - "TaskDefinition": { - "Ref": "Servicetaskdefinition0CEAD834" - } - }, - "DependsOn": [ - "ServiceloadbalancerServicelistenerC862F722", - "ServiceloadbalancerServicelistenerServiceGroup844B51E6" - ] - }, - "ServiceserviceSecurityGroup1915660F": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "imported-environment-integ/Service-service/SecurityGroup", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "VpcId": { - "Fn::GetAtt": [ - "ResourcesNestedStackResourcesNestedStackResourceCDA26E60", - "Outputs.importedenvironmentintegResourcesEnvironmentenvironmentvpcDC34D4D3Ref" - ] - } - } - }, - "ServiceserviceSecurityGroupfromimportedenvironmentintegServiceloadbalancerSecurityGroup68EE533C8070FCF629": { - "Type": "AWS::EC2::SecurityGroupIngress", - "Properties": { - "IpProtocol": "tcp", - "Description": "Load balancer to target", - "FromPort": 80, - "GroupId": { - "Fn::GetAtt": [ - "ServiceserviceSecurityGroup1915660F", - "GroupId" - ] - }, - "SourceSecurityGroupId": { - "Fn::GetAtt": [ - "ServiceloadbalancerSecurityGroup2DA3E8D6", - "GroupId" - ] - }, - "ToPort": 80 - } - } - }, - "Outputs": { - "Serviceloadbalancerdnsoutput": { - "Value": { - "Fn::GetAtt": [ - "ServiceloadbalancerD5D60894", - "DNSName" - ] - } - } - }, - "Parameters": { - "AssetParameters78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01S3Bucket64585C1B": { - "Type": "String", - "Description": "S3 bucket for asset \"78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01\"" - }, - "AssetParameters78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01S3VersionKey41670582": { - "Type": "String", - "Description": "S3 key for asset version \"78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01\"" - }, - "AssetParameters78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01ArtifactHashF1155D65": { - "Type": "String", - "Description": "Artifact hash for asset \"78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01\"" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/imported-environment.integ.snapshot/importedenvironmentintegResourcesAB23EBEF.nested.template.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/imported-environment.integ.snapshot/importedenvironmentintegResourcesAB23EBEF.nested.template.json deleted file mode 100644 index 31aa8b1dd95d4..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/imported-environment.integ.snapshot/importedenvironmentintegResourcesAB23EBEF.nested.template.json +++ /dev/null @@ -1,422 +0,0 @@ -{ - "Resources": { - "Environmentenvironmentvpc02635CAD": { - "Type": "AWS::EC2::VPC", - "Properties": { - "CidrBlock": "10.0.0.0/16", - "EnableDnsHostnames": true, - "EnableDnsSupport": true, - "InstanceTenancy": "default", - "Tags": [ - { - "Key": "Name", - "Value": "imported-environment-integ/Resources/Environment-environment-vpc" - } - ] - } - }, - "EnvironmentenvironmentvpcPublicSubnet1Subnet90FA3050": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "Environmentenvironmentvpc02635CAD" - }, - "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": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet1" - } - ] - } - }, - "EnvironmentenvironmentvpcPublicSubnet1RouteTableF562A242": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "Environmentenvironmentvpc02635CAD" - }, - "Tags": [ - { - "Key": "Name", - "Value": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet1" - } - ] - } - }, - "EnvironmentenvironmentvpcPublicSubnet1RouteTableAssociationFDE85030": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "EnvironmentenvironmentvpcPublicSubnet1RouteTableF562A242" - }, - "SubnetId": { - "Ref": "EnvironmentenvironmentvpcPublicSubnet1Subnet90FA3050" - } - } - }, - "EnvironmentenvironmentvpcPublicSubnet1DefaultRoute4171CB3F": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "EnvironmentenvironmentvpcPublicSubnet1RouteTableF562A242" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "EnvironmentenvironmentvpcIGWD3352EF8" - } - }, - "DependsOn": [ - "EnvironmentenvironmentvpcVPCGWD59F3C86" - ] - }, - "EnvironmentenvironmentvpcPublicSubnet1EIP0B5752AE": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet1" - } - ] - } - }, - "EnvironmentenvironmentvpcPublicSubnet1NATGateway65E8E64D": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "EnvironmentenvironmentvpcPublicSubnet1Subnet90FA3050" - }, - "AllocationId": { - "Fn::GetAtt": [ - "EnvironmentenvironmentvpcPublicSubnet1EIP0B5752AE", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet1" - } - ] - } - }, - "EnvironmentenvironmentvpcPublicSubnet2Subnet80565813": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "Environmentenvironmentvpc02635CAD" - }, - "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": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet2" - } - ] - } - }, - "EnvironmentenvironmentvpcPublicSubnet2RouteTableCC311A3A": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "Environmentenvironmentvpc02635CAD" - }, - "Tags": [ - { - "Key": "Name", - "Value": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet2" - } - ] - } - }, - "EnvironmentenvironmentvpcPublicSubnet2RouteTableAssociation54B3A48A": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "EnvironmentenvironmentvpcPublicSubnet2RouteTableCC311A3A" - }, - "SubnetId": { - "Ref": "EnvironmentenvironmentvpcPublicSubnet2Subnet80565813" - } - } - }, - "EnvironmentenvironmentvpcPublicSubnet2DefaultRouteCA3995A5": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "EnvironmentenvironmentvpcPublicSubnet2RouteTableCC311A3A" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "EnvironmentenvironmentvpcIGWD3352EF8" - } - }, - "DependsOn": [ - "EnvironmentenvironmentvpcVPCGWD59F3C86" - ] - }, - "EnvironmentenvironmentvpcPublicSubnet2EIP54A162E2": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet2" - } - ] - } - }, - "EnvironmentenvironmentvpcPublicSubnet2NATGatewayEDDF81A3": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "EnvironmentenvironmentvpcPublicSubnet2Subnet80565813" - }, - "AllocationId": { - "Fn::GetAtt": [ - "EnvironmentenvironmentvpcPublicSubnet2EIP54A162E2", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet2" - } - ] - } - }, - "EnvironmentenvironmentvpcPrivateSubnet1SubnetE66B59C1": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "Environmentenvironmentvpc02635CAD" - }, - "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": "imported-environment-integ/Resources/Environment-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "EnvironmentenvironmentvpcPrivateSubnet1RouteTable2FAF7412": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "Environmentenvironmentvpc02635CAD" - }, - "Tags": [ - { - "Key": "Name", - "Value": "imported-environment-integ/Resources/Environment-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "EnvironmentenvironmentvpcPrivateSubnet1RouteTableAssociation46A426C7": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "EnvironmentenvironmentvpcPrivateSubnet1RouteTable2FAF7412" - }, - "SubnetId": { - "Ref": "EnvironmentenvironmentvpcPrivateSubnet1SubnetE66B59C1" - } - } - }, - "EnvironmentenvironmentvpcPrivateSubnet1DefaultRoute1AFA55BA": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "EnvironmentenvironmentvpcPrivateSubnet1RouteTable2FAF7412" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "EnvironmentenvironmentvpcPublicSubnet1NATGateway65E8E64D" - } - } - }, - "EnvironmentenvironmentvpcPrivateSubnet2SubnetD38DAD67": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "Environmentenvironmentvpc02635CAD" - }, - "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": "imported-environment-integ/Resources/Environment-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "EnvironmentenvironmentvpcPrivateSubnet2RouteTable244FED3F": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "Environmentenvironmentvpc02635CAD" - }, - "Tags": [ - { - "Key": "Name", - "Value": "imported-environment-integ/Resources/Environment-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "EnvironmentenvironmentvpcPrivateSubnet2RouteTableAssociation9FE6BFCD": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "EnvironmentenvironmentvpcPrivateSubnet2RouteTable244FED3F" - }, - "SubnetId": { - "Ref": "EnvironmentenvironmentvpcPrivateSubnet2SubnetD38DAD67" - } - } - }, - "EnvironmentenvironmentvpcPrivateSubnet2DefaultRouteF5A23DA3": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "EnvironmentenvironmentvpcPrivateSubnet2RouteTable244FED3F" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "EnvironmentenvironmentvpcPublicSubnet2NATGatewayEDDF81A3" - } - } - }, - "EnvironmentenvironmentvpcIGWD3352EF8": { - "Type": "AWS::EC2::InternetGateway", - "Properties": { - "Tags": [ - { - "Key": "Name", - "Value": "imported-environment-integ/Resources/Environment-environment-vpc" - } - ] - } - }, - "EnvironmentenvironmentvpcVPCGWD59F3C86": { - "Type": "AWS::EC2::VPCGatewayAttachment", - "Properties": { - "VpcId": { - "Ref": "Environmentenvironmentvpc02635CAD" - }, - "InternetGatewayId": { - "Ref": "EnvironmentenvironmentvpcIGWD3352EF8" - } - } - }, - "EnvironmentenvironmentclusterA67A8E69": { - "Type": "AWS::ECS::Cluster" - } - }, - "Outputs": { - "importedenvironmentintegResourcesEnvironmentenvironmentvpcPublicSubnet1Subnet0D15D382Ref": { - "Value": { - "Ref": "EnvironmentenvironmentvpcPublicSubnet1Subnet90FA3050" - } - }, - "importedenvironmentintegResourcesEnvironmentenvironmentvpcPublicSubnet2Subnet68645ACARef": { - "Value": { - "Ref": "EnvironmentenvironmentvpcPublicSubnet2Subnet80565813" - } - }, - "importedenvironmentintegResourcesEnvironmentenvironmentvpcDC34D4D3Ref": { - "Value": { - "Ref": "Environmentenvironmentvpc02635CAD" - } - }, - "importedenvironmentintegResourcesEnvironmentenvironmentcluster594A3DCARef": { - "Value": { - "Ref": "EnvironmentenvironmentclusterA67A8E69" - } - }, - "importedenvironmentintegResourcesEnvironmentenvironmentvpcPrivateSubnet1Subnet7309E967Ref": { - "Value": { - "Ref": "EnvironmentenvironmentvpcPrivateSubnet1SubnetE66B59C1" - } - }, - "importedenvironmentintegResourcesEnvironmentenvironmentvpcPrivateSubnet2Subnet55014443Ref": { - "Value": { - "Ref": "EnvironmentenvironmentvpcPrivateSubnet2SubnetD38DAD67" - } - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/imported-environment.integ.snapshot/manifest.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/imported-environment.integ.snapshot/manifest.json deleted file mode 100644 index a7b371a74e01b..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/imported-environment.integ.snapshot/manifest.json +++ /dev/null @@ -1,351 +0,0 @@ -{ - "version": "17.0.0", - "artifacts": { - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - }, - "imported-environment-integ": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "imported-environment-integ.template.json", - "validateOnSynth": false - }, - "metadata": { - "/imported-environment-integ": [ - { - "type": "aws:cdk:asset", - "data": { - "path": "importedenvironmentintegResourcesAB23EBEF.nested.template.json", - "id": "78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01", - "packaging": "file", - "sourceHash": "78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01", - "s3BucketParameter": "AssetParameters78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01S3Bucket64585C1B", - "s3KeyParameter": "AssetParameters78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01S3VersionKey41670582", - "artifactHashParameter": "AssetParameters78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01ArtifactHashF1155D65" - } - } - ], - "/imported-environment-integ/Resources/Environment-environment-vpc/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Environmentenvironmentvpc02635CAD" - } - ], - "/imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet1/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "EnvironmentenvironmentvpcPublicSubnet1Subnet90FA3050" - } - ], - "/imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet1/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "EnvironmentenvironmentvpcPublicSubnet1RouteTableF562A242" - } - ], - "/imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet1/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "EnvironmentenvironmentvpcPublicSubnet1RouteTableAssociationFDE85030" - } - ], - "/imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet1/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "EnvironmentenvironmentvpcPublicSubnet1DefaultRoute4171CB3F" - } - ], - "/imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet1/EIP": [ - { - "type": "aws:cdk:logicalId", - "data": "EnvironmentenvironmentvpcPublicSubnet1EIP0B5752AE" - } - ], - "/imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet1/NATGateway": [ - { - "type": "aws:cdk:logicalId", - "data": "EnvironmentenvironmentvpcPublicSubnet1NATGateway65E8E64D" - } - ], - "/imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet2/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "EnvironmentenvironmentvpcPublicSubnet2Subnet80565813" - } - ], - "/imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet2/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "EnvironmentenvironmentvpcPublicSubnet2RouteTableCC311A3A" - } - ], - "/imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet2/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "EnvironmentenvironmentvpcPublicSubnet2RouteTableAssociation54B3A48A" - } - ], - "/imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet2/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "EnvironmentenvironmentvpcPublicSubnet2DefaultRouteCA3995A5" - } - ], - "/imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet2/EIP": [ - { - "type": "aws:cdk:logicalId", - "data": "EnvironmentenvironmentvpcPublicSubnet2EIP54A162E2" - } - ], - "/imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet2/NATGateway": [ - { - "type": "aws:cdk:logicalId", - "data": "EnvironmentenvironmentvpcPublicSubnet2NATGatewayEDDF81A3" - } - ], - "/imported-environment-integ/Resources/Environment-environment-vpc/PrivateSubnet1/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "EnvironmentenvironmentvpcPrivateSubnet1SubnetE66B59C1" - } - ], - "/imported-environment-integ/Resources/Environment-environment-vpc/PrivateSubnet1/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "EnvironmentenvironmentvpcPrivateSubnet1RouteTable2FAF7412" - } - ], - "/imported-environment-integ/Resources/Environment-environment-vpc/PrivateSubnet1/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "EnvironmentenvironmentvpcPrivateSubnet1RouteTableAssociation46A426C7" - } - ], - "/imported-environment-integ/Resources/Environment-environment-vpc/PrivateSubnet1/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "EnvironmentenvironmentvpcPrivateSubnet1DefaultRoute1AFA55BA" - } - ], - "/imported-environment-integ/Resources/Environment-environment-vpc/PrivateSubnet2/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "EnvironmentenvironmentvpcPrivateSubnet2SubnetD38DAD67" - } - ], - "/imported-environment-integ/Resources/Environment-environment-vpc/PrivateSubnet2/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "EnvironmentenvironmentvpcPrivateSubnet2RouteTable244FED3F" - } - ], - "/imported-environment-integ/Resources/Environment-environment-vpc/PrivateSubnet2/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "EnvironmentenvironmentvpcPrivateSubnet2RouteTableAssociation9FE6BFCD" - } - ], - "/imported-environment-integ/Resources/Environment-environment-vpc/PrivateSubnet2/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "EnvironmentenvironmentvpcPrivateSubnet2DefaultRouteF5A23DA3" - } - ], - "/imported-environment-integ/Resources/Environment-environment-vpc/IGW": [ - { - "type": "aws:cdk:logicalId", - "data": "EnvironmentenvironmentvpcIGWD3352EF8" - } - ], - "/imported-environment-integ/Resources/Environment-environment-vpc/VPCGW": [ - { - "type": "aws:cdk:logicalId", - "data": "EnvironmentenvironmentvpcVPCGWD59F3C86" - } - ], - "/imported-environment-integ/Resources/Environment-environment-cluster/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "EnvironmentenvironmentclusterA67A8E69" - } - ], - "/imported-environment-integ/Resources/importedenvironmentintegResourcesEnvironmentenvironmentvpcPublicSubnet1Subnet0D15D382Ref": [ - { - "type": "aws:cdk:logicalId", - "data": "importedenvironmentintegResourcesEnvironmentenvironmentvpcPublicSubnet1Subnet0D15D382Ref" - } - ], - "/imported-environment-integ/Resources/importedenvironmentintegResourcesEnvironmentenvironmentvpcPublicSubnet2Subnet68645ACARef": [ - { - "type": "aws:cdk:logicalId", - "data": "importedenvironmentintegResourcesEnvironmentenvironmentvpcPublicSubnet2Subnet68645ACARef" - } - ], - "/imported-environment-integ/Resources/importedenvironmentintegResourcesEnvironmentenvironmentvpcDC34D4D3Ref": [ - { - "type": "aws:cdk:logicalId", - "data": "importedenvironmentintegResourcesEnvironmentenvironmentvpcDC34D4D3Ref" - } - ], - "/imported-environment-integ/Resources/importedenvironmentintegResourcesEnvironmentenvironmentcluster594A3DCARef": [ - { - "type": "aws:cdk:logicalId", - "data": "importedenvironmentintegResourcesEnvironmentenvironmentcluster594A3DCARef" - } - ], - "/imported-environment-integ/Resources/importedenvironmentintegResourcesEnvironmentenvironmentvpcPrivateSubnet1Subnet7309E967Ref": [ - { - "type": "aws:cdk:logicalId", - "data": "importedenvironmentintegResourcesEnvironmentenvironmentvpcPrivateSubnet1Subnet7309E967Ref" - } - ], - "/imported-environment-integ/Resources/importedenvironmentintegResourcesEnvironmentenvironmentvpcPrivateSubnet2Subnet55014443Ref": [ - { - "type": "aws:cdk:logicalId", - "data": "importedenvironmentintegResourcesEnvironmentenvironmentvpcPrivateSubnet2Subnet55014443Ref" - } - ], - "/imported-environment-integ/Resources.NestedStack/Resources.NestedStackResource": [ - { - "type": "aws:cdk:logicalId", - "data": "ResourcesNestedStackResourcesNestedStackResourceCDA26E60" - } - ], - "/imported-environment-integ/Vpc/PublicSubnet1": [ - { - "type": "aws:cdk:warning", - "data": "No routeTableId was provided to the subnet at 'imported-environment-integ/Vpc/PublicSubnet1'. Attempting to read its .routeTable.routeTableId will return null/undefined. (More info: https://github.com/aws/aws-cdk/pull/3171)" - } - ], - "/imported-environment-integ/Vpc/PublicSubnet2": [ - { - "type": "aws:cdk:warning", - "data": "No routeTableId was provided to the subnet at 'imported-environment-integ/Vpc/PublicSubnet2'. Attempting to read its .routeTable.routeTableId will return null/undefined. (More info: https://github.com/aws/aws-cdk/pull/3171)" - } - ], - "/imported-environment-integ/Vpc/PrivateSubnet1": [ - { - "type": "aws:cdk:warning", - "data": "No routeTableId was provided to the subnet at 'imported-environment-integ/Vpc/PrivateSubnet1'. Attempting to read its .routeTable.routeTableId will return null/undefined. (More info: https://github.com/aws/aws-cdk/pull/3171)" - } - ], - "/imported-environment-integ/Vpc/PrivateSubnet2": [ - { - "type": "aws:cdk:warning", - "data": "No routeTableId was provided to the subnet at 'imported-environment-integ/Vpc/PrivateSubnet2'. Attempting to read its .routeTable.routeTableId will return null/undefined. (More info: https://github.com/aws/aws-cdk/pull/3171)" - } - ], - "/imported-environment-integ/Service-load-balancer/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "ServiceloadbalancerD5D60894" - } - ], - "/imported-environment-integ/Service-load-balancer/SecurityGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "ServiceloadbalancerSecurityGroup2DA3E8D6" - } - ], - "/imported-environment-integ/Service-load-balancer/SecurityGroup/to importedenvironmentintegServiceserviceSecurityGroup2BE90F74:80": [ - { - "type": "aws:cdk:logicalId", - "data": "ServiceloadbalancerSecurityGrouptoimportedenvironmentintegServiceserviceSecurityGroup2BE90F7480B17EB7CA" - } - ], - "/imported-environment-integ/Service-load-balancer/Service-listener/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "ServiceloadbalancerServicelistenerC862F722" - } - ], - "/imported-environment-integ/Service-load-balancer/Service-listener/ServiceGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "ServiceloadbalancerServicelistenerServiceGroup844B51E6" - } - ], - "/imported-environment-integ/Service-load-balancer-dns-output": [ - { - "type": "aws:cdk:logicalId", - "data": "Serviceloadbalancerdnsoutput" - } - ], - "/imported-environment-integ/Service-task-definition/TaskRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "ServicetaskdefinitionTaskRole5B4B60A4" - } - ], - "/imported-environment-integ/Service-task-definition/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Servicetaskdefinition0CEAD834", - "trace": [ - "!!DESTRUCTIVE_CHANGES: WILL_REPLACE" - ] - } - ], - "/imported-environment-integ/Service-task-definition/ExecutionRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "ServicetaskdefinitionExecutionRoleD09F4578" - } - ], - "/imported-environment-integ/Service-task-definition/ExecutionRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "ServicetaskdefinitionExecutionRoleDefaultPolicy25CEAFC5" - } - ], - "/imported-environment-integ/Service-logs/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Servicelogs9F4E1F70" - } - ], - "/imported-environment-integ/Service-service/Service": [ - { - "type": "aws:cdk:logicalId", - "data": "ServiceserviceService6A153CB8" - } - ], - "/imported-environment-integ/Service-service/SecurityGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "ServiceserviceSecurityGroup1915660F" - } - ], - "/imported-environment-integ/Service-service/SecurityGroup/from importedenvironmentintegServiceloadbalancerSecurityGroup68EE533C:80": [ - { - "type": "aws:cdk:logicalId", - "data": "ServiceserviceSecurityGroupfromimportedenvironmentintegServiceloadbalancerSecurityGroup68EE533C8070FCF629" - } - ], - "/imported-environment-integ/AssetParameters/78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01/S3Bucket": [ - { - "type": "aws:cdk:logicalId", - "data": "AssetParameters78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01S3Bucket64585C1B" - } - ], - "/imported-environment-integ/AssetParameters/78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01/S3VersionKey": [ - { - "type": "aws:cdk:logicalId", - "data": "AssetParameters78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01S3VersionKey41670582" - } - ], - "/imported-environment-integ/AssetParameters/78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01/ArtifactHash": [ - { - "type": "aws:cdk:logicalId", - "data": "AssetParameters78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01ArtifactHashF1155D65" - } - ] - }, - "displayName": "imported-environment-integ" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/imported-environment.integ.snapshot/tree.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/imported-environment.integ.snapshot/tree.json deleted file mode 100644 index 4e7b1a30254dc..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/imported-environment.integ.snapshot/tree.json +++ /dev/null @@ -1,1630 +0,0 @@ -{ - "version": "tree-0.1", - "tree": { - "id": "App", - "path": "", - "children": { - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.0.9" - } - }, - "imported-environment-integ": { - "id": "imported-environment-integ", - "path": "imported-environment-integ", - "children": { - "Resources": { - "id": "Resources", - "path": "imported-environment-integ/Resources", - "children": { - "Environment": { - "id": "Environment", - "path": "imported-environment-integ/Resources/Environment", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.0.9" - } - }, - "Environment-environment-vpc": { - "id": "Environment-environment-vpc", - "path": "imported-environment-integ/Resources/Environment-environment-vpc", - "children": { - "Resource": { - "id": "Resource", - "path": "imported-environment-integ/Resources/Environment-environment-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": "imported-environment-integ/Resources/Environment-environment-vpc" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - }, - "PublicSubnet1": { - "id": "PublicSubnet1", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet1", - "children": { - "Subnet": { - "id": "Subnet", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet1/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Environmentenvironmentvpc02635CAD" - }, - "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": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet1/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet1/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Environmentenvironmentvpc02635CAD" - }, - "tags": [ - { - "key": "Name", - "value": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet1/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "EnvironmentenvironmentvpcPublicSubnet1RouteTableF562A242" - }, - "subnetId": { - "Ref": "EnvironmentenvironmentvpcPublicSubnet1Subnet90FA3050" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet1/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "EnvironmentenvironmentvpcPublicSubnet1RouteTableF562A242" - }, - "destinationCidrBlock": "0.0.0.0/0", - "gatewayId": { - "Ref": "EnvironmentenvironmentvpcIGWD3352EF8" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - }, - "EIP": { - "id": "EIP", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet1/EIP", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::EIP", - "aws:cdk:cloudformation:props": { - "domain": "vpc", - "tags": [ - { - "key": "Name", - "value": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - }, - "NATGateway": { - "id": "NATGateway", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet1/NATGateway", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", - "aws:cdk:cloudformation:props": { - "subnetId": { - "Ref": "EnvironmentenvironmentvpcPublicSubnet1Subnet90FA3050" - }, - "allocationId": { - "Fn::GetAtt": [ - "EnvironmentenvironmentvpcPublicSubnet1EIP0B5752AE", - "AllocationId" - ] - }, - "tags": [ - { - "key": "Name", - "value": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "PublicSubnet2": { - "id": "PublicSubnet2", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet2", - "children": { - "Subnet": { - "id": "Subnet", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet2/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Environmentenvironmentvpc02635CAD" - }, - "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": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet2/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet2/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Environmentenvironmentvpc02635CAD" - }, - "tags": [ - { - "key": "Name", - "value": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet2/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "EnvironmentenvironmentvpcPublicSubnet2RouteTableCC311A3A" - }, - "subnetId": { - "Ref": "EnvironmentenvironmentvpcPublicSubnet2Subnet80565813" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet2/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "EnvironmentenvironmentvpcPublicSubnet2RouteTableCC311A3A" - }, - "destinationCidrBlock": "0.0.0.0/0", - "gatewayId": { - "Ref": "EnvironmentenvironmentvpcIGWD3352EF8" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - }, - "EIP": { - "id": "EIP", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet2/EIP", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::EIP", - "aws:cdk:cloudformation:props": { - "domain": "vpc", - "tags": [ - { - "key": "Name", - "value": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - }, - "NATGateway": { - "id": "NATGateway", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet2/NATGateway", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", - "aws:cdk:cloudformation:props": { - "subnetId": { - "Ref": "EnvironmentenvironmentvpcPublicSubnet2Subnet80565813" - }, - "allocationId": { - "Fn::GetAtt": [ - "EnvironmentenvironmentvpcPublicSubnet2EIP54A162E2", - "AllocationId" - ] - }, - "tags": [ - { - "key": "Name", - "value": "imported-environment-integ/Resources/Environment-environment-vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "PrivateSubnet1": { - "id": "PrivateSubnet1", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/PrivateSubnet1", - "children": { - "Subnet": { - "id": "Subnet", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/PrivateSubnet1/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Environmentenvironmentvpc02635CAD" - }, - "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": "imported-environment-integ/Resources/Environment-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/PrivateSubnet1/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/PrivateSubnet1/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Environmentenvironmentvpc02635CAD" - }, - "tags": [ - { - "key": "Name", - "value": "imported-environment-integ/Resources/Environment-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/PrivateSubnet1/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "EnvironmentenvironmentvpcPrivateSubnet1RouteTable2FAF7412" - }, - "subnetId": { - "Ref": "EnvironmentenvironmentvpcPrivateSubnet1SubnetE66B59C1" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/PrivateSubnet1/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "EnvironmentenvironmentvpcPrivateSubnet1RouteTable2FAF7412" - }, - "destinationCidrBlock": "0.0.0.0/0", - "natGatewayId": { - "Ref": "EnvironmentenvironmentvpcPublicSubnet1NATGateway65E8E64D" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "PrivateSubnet2": { - "id": "PrivateSubnet2", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/PrivateSubnet2", - "children": { - "Subnet": { - "id": "Subnet", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/PrivateSubnet2/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Environmentenvironmentvpc02635CAD" - }, - "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": "imported-environment-integ/Resources/Environment-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/PrivateSubnet2/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/PrivateSubnet2/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Environmentenvironmentvpc02635CAD" - }, - "tags": [ - { - "key": "Name", - "value": "imported-environment-integ/Resources/Environment-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/PrivateSubnet2/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "EnvironmentenvironmentvpcPrivateSubnet2RouteTable244FED3F" - }, - "subnetId": { - "Ref": "EnvironmentenvironmentvpcPrivateSubnet2SubnetD38DAD67" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/PrivateSubnet2/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "EnvironmentenvironmentvpcPrivateSubnet2RouteTable244FED3F" - }, - "destinationCidrBlock": "0.0.0.0/0", - "natGatewayId": { - "Ref": "EnvironmentenvironmentvpcPublicSubnet2NATGatewayEDDF81A3" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "IGW": { - "id": "IGW", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/IGW", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::InternetGateway", - "aws:cdk:cloudformation:props": { - "tags": [ - { - "key": "Name", - "value": "imported-environment-integ/Resources/Environment-environment-vpc" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - }, - "VPCGW": { - "id": "VPCGW", - "path": "imported-environment-integ/Resources/Environment-environment-vpc/VPCGW", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Environmentenvironmentvpc02635CAD" - }, - "internetGatewayId": { - "Ref": "EnvironmentenvironmentvpcIGWD3352EF8" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "Environment-environment-cluster": { - "id": "Environment-environment-cluster", - "path": "imported-environment-integ/Resources/Environment-environment-cluster", - "children": { - "Resource": { - "id": "Resource", - "path": "imported-environment-integ/Resources/Environment-environment-cluster/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ECS::Cluster", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "importedenvironmentintegResourcesEnvironmentenvironmentvpcPublicSubnet1Subnet0D15D382Ref": { - "id": "importedenvironmentintegResourcesEnvironmentenvironmentvpcPublicSubnet1Subnet0D15D382Ref", - "path": "imported-environment-integ/Resources/importedenvironmentintegResourcesEnvironmentenvironmentvpcPublicSubnet1Subnet0D15D382Ref", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnOutput", - "version": "0.0.0" - } - }, - "importedenvironmentintegResourcesEnvironmentenvironmentvpcPublicSubnet2Subnet68645ACARef": { - "id": "importedenvironmentintegResourcesEnvironmentenvironmentvpcPublicSubnet2Subnet68645ACARef", - "path": "imported-environment-integ/Resources/importedenvironmentintegResourcesEnvironmentenvironmentvpcPublicSubnet2Subnet68645ACARef", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnOutput", - "version": "0.0.0" - } - }, - "importedenvironmentintegResourcesEnvironmentenvironmentvpcDC34D4D3Ref": { - "id": "importedenvironmentintegResourcesEnvironmentenvironmentvpcDC34D4D3Ref", - "path": "imported-environment-integ/Resources/importedenvironmentintegResourcesEnvironmentenvironmentvpcDC34D4D3Ref", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnOutput", - "version": "0.0.0" - } - }, - "importedenvironmentintegResourcesEnvironmentenvironmentcluster594A3DCARef": { - "id": "importedenvironmentintegResourcesEnvironmentenvironmentcluster594A3DCARef", - "path": "imported-environment-integ/Resources/importedenvironmentintegResourcesEnvironmentenvironmentcluster594A3DCARef", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnOutput", - "version": "0.0.0" - } - }, - "importedenvironmentintegResourcesEnvironmentenvironmentvpcPrivateSubnet1Subnet7309E967Ref": { - "id": "importedenvironmentintegResourcesEnvironmentenvironmentvpcPrivateSubnet1Subnet7309E967Ref", - "path": "imported-environment-integ/Resources/importedenvironmentintegResourcesEnvironmentenvironmentvpcPrivateSubnet1Subnet7309E967Ref", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnOutput", - "version": "0.0.0" - } - }, - "importedenvironmentintegResourcesEnvironmentenvironmentvpcPrivateSubnet2Subnet55014443Ref": { - "id": "importedenvironmentintegResourcesEnvironmentenvironmentvpcPrivateSubnet2Subnet55014443Ref", - "path": "imported-environment-integ/Resources/importedenvironmentintegResourcesEnvironmentenvironmentvpcPrivateSubnet2Subnet55014443Ref", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnOutput", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.NestedStack", - "version": "0.0.0" - } - }, - "Resources.NestedStack": { - "id": "Resources.NestedStack", - "path": "imported-environment-integ/Resources.NestedStack", - "children": { - "Resources.NestedStackResource": { - "id": "Resources.NestedStackResource", - "path": "imported-environment-integ/Resources.NestedStack/Resources.NestedStackResource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CloudFormation::Stack", - "aws:cdk:cloudformation:props": { - "templateUrl": { - "Fn::Join": [ - "", - [ - "https://s3.", - { - "Ref": "AWS::Region" - }, - ".", - { - "Ref": "AWS::URLSuffix" - }, - "/", - { - "Ref": "AssetParameters78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01S3Bucket64585C1B" - }, - "/", - { - "Fn::Select": [ - 0, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameters78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01S3VersionKey41670582" - } - ] - } - ] - }, - { - "Fn::Select": [ - 1, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameters78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01S3VersionKey41670582" - } - ] - } - ] - } - ] - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnStack", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.0.9" - } - }, - "Vpc": { - "id": "Vpc", - "path": "imported-environment-integ/Vpc", - "children": { - "PublicSubnet1": { - "id": "PublicSubnet1", - "path": "imported-environment-integ/Vpc/PublicSubnet1", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "PublicSubnet2": { - "id": "PublicSubnet2", - "path": "imported-environment-integ/Vpc/PublicSubnet2", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "PrivateSubnet1": { - "id": "PrivateSubnet1", - "path": "imported-environment-integ/Vpc/PrivateSubnet1", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "PrivateSubnet2": { - "id": "PrivateSubnet2", - "path": "imported-environment-integ/Vpc/PrivateSubnet2", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "Cluster": { - "id": "Cluster", - "path": "imported-environment-integ/Cluster", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "Environment": { - "id": "Environment", - "path": "imported-environment-integ/Environment", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.0.9" - } - }, - "Service": { - "id": "Service", - "path": "imported-environment-integ/Service", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.0.9" - } - }, - "Service-load-balancer": { - "id": "Service-load-balancer", - "path": "imported-environment-integ/Service-load-balancer", - "children": { - "Resource": { - "id": "Resource", - "path": "imported-environment-integ/Service-load-balancer/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ElasticLoadBalancingV2::LoadBalancer", - "aws:cdk:cloudformation:props": { - "loadBalancerAttributes": [ - { - "key": "deletion_protection.enabled", - "value": "false" - } - ], - "scheme": "internet-facing", - "securityGroups": [ - { - "Fn::GetAtt": [ - "ServiceloadbalancerSecurityGroup2DA3E8D6", - "GroupId" - ] - } - ], - "subnets": [ - { - "Fn::GetAtt": [ - "ResourcesNestedStackResourcesNestedStackResourceCDA26E60", - "Outputs.importedenvironmentintegResourcesEnvironmentenvironmentvpcPublicSubnet1Subnet0D15D382Ref" - ] - }, - { - "Fn::GetAtt": [ - "ResourcesNestedStackResourcesNestedStackResourceCDA26E60", - "Outputs.importedenvironmentintegResourcesEnvironmentenvironmentvpcPublicSubnet2Subnet68645ACARef" - ] - } - ], - "type": "application" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - }, - "SecurityGroup": { - "id": "SecurityGroup", - "path": "imported-environment-integ/Service-load-balancer/SecurityGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "imported-environment-integ/Service-load-balancer/SecurityGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", - "aws:cdk:cloudformation:props": { - "groupDescription": "Automatically created Security Group for ELB importedenvironmentintegServiceloadbalancerFAE8A5FA", - "securityGroupIngress": [ - { - "cidrIp": "0.0.0.0/0", - "ipProtocol": "tcp", - "fromPort": 80, - "toPort": 80, - "description": "Allow from anyone on port 80" - } - ], - "vpcId": { - "Fn::GetAtt": [ - "ResourcesNestedStackResourcesNestedStackResourceCDA26E60", - "Outputs.importedenvironmentintegResourcesEnvironmentenvironmentvpcDC34D4D3Ref" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - }, - "to importedenvironmentintegServiceserviceSecurityGroup2BE90F74:80": { - "id": "to importedenvironmentintegServiceserviceSecurityGroup2BE90F74:80", - "path": "imported-environment-integ/Service-load-balancer/SecurityGroup/to importedenvironmentintegServiceserviceSecurityGroup2BE90F74:80", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroupEgress", - "aws:cdk:cloudformation:props": { - "groupId": { - "Fn::GetAtt": [ - "ServiceloadbalancerSecurityGroup2DA3E8D6", - "GroupId" - ] - }, - "ipProtocol": "tcp", - "description": "Load balancer to target", - "destinationSecurityGroupId": { - "Fn::GetAtt": [ - "ServiceserviceSecurityGroup1915660F", - "GroupId" - ] - }, - "fromPort": 80, - "toPort": 80 - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "Service-listener": { - "id": "Service-listener", - "path": "imported-environment-integ/Service-load-balancer/Service-listener", - "children": { - "Resource": { - "id": "Resource", - "path": "imported-environment-integ/Service-load-balancer/Service-listener/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ElasticLoadBalancingV2::Listener", - "aws:cdk:cloudformation:props": { - "defaultActions": [ - { - "type": "forward", - "targetGroupArn": { - "Ref": "ServiceloadbalancerServicelistenerServiceGroup844B51E6" - } - } - ], - "loadBalancerArn": { - "Ref": "ServiceloadbalancerD5D60894" - }, - "port": 80, - "protocol": "HTTP" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - }, - "ServiceGroup": { - "id": "ServiceGroup", - "path": "imported-environment-integ/Service-load-balancer/Service-listener/ServiceGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "imported-environment-integ/Service-load-balancer/Service-listener/ServiceGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ElasticLoadBalancingV2::TargetGroup", - "aws:cdk:cloudformation:props": { - "port": 80, - "protocol": "HTTP", - "targetGroupAttributes": [ - { - "key": "deregistration_delay.timeout_seconds", - "value": "10" - }, - { - "key": "stickiness.enabled", - "value": "false" - } - ], - "targetType": "ip", - "vpcId": { - "Fn::GetAtt": [ - "ResourcesNestedStackResourcesNestedStackResourceCDA26E60", - "Outputs.importedenvironmentintegResourcesEnvironmentenvironmentvpcDC34D4D3Ref" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.0.9" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "Service-load-balancer-dns-output": { - "id": "Service-load-balancer-dns-output", - "path": "imported-environment-integ/Service-load-balancer-dns-output", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnOutput", - "version": "0.0.0" - } - }, - "Service-task-definition": { - "id": "Service-task-definition", - "path": "imported-environment-integ/Service-task-definition", - "children": { - "TaskRole": { - "id": "TaskRole", - "path": "imported-environment-integ/Service-task-definition/TaskRole", - "children": { - "Resource": { - "id": "Resource", - "path": "imported-environment-integ/Service-task-definition/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/aws-iam.CfnRole", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "imported-environment-integ/Service-task-definition/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ECS::TaskDefinition", - "aws:cdk:cloudformation:props": { - "containerDefinitions": [ - { - "cpu": 256, - "essential": true, - "image": "nathanpeck/name", - "memory": 512, - "name": "app", - "portMappings": [ - { - "containerPort": 80, - "protocol": "tcp" - } - ], - "ulimits": [ - { - "name": "nofile", - "softLimit": 1024000, - "hardLimit": 1024000 - } - ], - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-group": { - "Ref": "Servicelogs9F4E1F70" - }, - "awslogs-stream-prefix": "Service", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "environment": [ - { - "name": "PORT", - "value": "80" - } - ] - } - ], - "cpu": "256", - "executionRoleArn": { - "Fn::GetAtt": [ - "ServicetaskdefinitionExecutionRoleD09F4578", - "Arn" - ] - }, - "family": "importedenvironmentintegServicetaskdefinition63936B87", - "memory": "512", - "networkMode": "awsvpc", - "requiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "taskRoleArn": { - "Fn::GetAtt": [ - "ServicetaskdefinitionTaskRole5B4B60A4", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - }, - "app": { - "id": "app", - "path": "imported-environment-integ/Service-task-definition/app", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.0.9" - } - }, - "ExecutionRole": { - "id": "ExecutionRole", - "path": "imported-environment-integ/Service-task-definition/ExecutionRole", - "children": { - "Resource": { - "id": "Resource", - "path": "imported-environment-integ/Service-task-definition/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/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "imported-environment-integ/Service-task-definition/ExecutionRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "imported-environment-integ/Service-task-definition/ExecutionRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "Servicelogs9F4E1F70", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "ServicetaskdefinitionExecutionRoleDefaultPolicy25CEAFC5", - "roles": [ - { - "Ref": "ServicetaskdefinitionExecutionRoleD09F4578" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "Service-logs": { - "id": "Service-logs", - "path": "imported-environment-integ/Service-logs", - "children": { - "Resource": { - "id": "Resource", - "path": "imported-environment-integ/Service-logs/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", - "aws:cdk:cloudformation:props": { - "logGroupName": "Service-logs", - "retentionInDays": 30 - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - }, - "ExecutionRole": { - "id": "ExecutionRole", - "path": "imported-environment-integ/Service-task-definition/ExecutionRole", - "children": { - "Resource": { - "id": "Resource", - "path": "imported-environment-integ/Service-task-definition/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/core.CfnResource", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "imported-environment-integ/Service-task-definition/ExecutionRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "imported-environment-integ/Service-task-definition/ExecutionRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "Servicelogs9F4E1F70", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "ServicetaskdefinitionExecutionRoleDefaultPolicy25CEAFC5", - "roles": [ - { - "Ref": "ServicetaskdefinitionExecutionRoleD09F4578" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "Service-logs": { - "id": "Service-logs", - "path": "imported-environment-integ/Service-logs", - "children": { - "Resource": { - "id": "Resource", - "path": "imported-environment-integ/Service-logs/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", - "aws:cdk:cloudformation:props": { - "logGroupName": "Service-logs", - "retentionInDays": 30 - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "Service-service": { - "id": "Service-service", - "path": "imported-environment-integ/Service-service", - "children": { - "Service": { - "id": "Service", - "path": "imported-environment-integ/Service-service/Service", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ECS::Service", - "aws:cdk:cloudformation:props": { - "cluster": { - "Fn::GetAtt": [ - "ResourcesNestedStackResourcesNestedStackResourceCDA26E60", - "Outputs.importedenvironmentintegResourcesEnvironmentenvironmentcluster594A3DCARef" - ] - }, - "deploymentConfiguration": { - "maximumPercent": 200, - "minimumHealthyPercent": 100 - }, - "desiredCount": 1, - "enableEcsManagedTags": false, - "healthCheckGracePeriodSeconds": 60, - "launchType": "FARGATE", - "loadBalancers": [ - { - "targetGroupArn": { - "Ref": "ServiceloadbalancerServicelistenerServiceGroup844B51E6" - }, - "containerName": "app", - "containerPort": 80 - } - ], - "networkConfiguration": { - "awsvpcConfiguration": { - "assignPublicIp": "DISABLED", - "subnets": [ - { - "Fn::GetAtt": [ - "ResourcesNestedStackResourcesNestedStackResourceCDA26E60", - "Outputs.importedenvironmentintegResourcesEnvironmentenvironmentvpcPrivateSubnet1Subnet7309E967Ref" - ] - }, - { - "Fn::GetAtt": [ - "ResourcesNestedStackResourcesNestedStackResourceCDA26E60", - "Outputs.importedenvironmentintegResourcesEnvironmentenvironmentvpcPrivateSubnet2Subnet55014443Ref" - ] - } - ], - "securityGroups": [ - { - "Fn::GetAtt": [ - "ServiceserviceSecurityGroup1915660F", - "GroupId" - ] - } - ] - } - }, - "taskDefinition": { - "Ref": "Servicetaskdefinition0CEAD834" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - }, - "SecurityGroup": { - "id": "SecurityGroup", - "path": "imported-environment-integ/Service-service/SecurityGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "imported-environment-integ/Service-service/SecurityGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", - "aws:cdk:cloudformation:props": { - "groupDescription": "imported-environment-integ/Service-service/SecurityGroup", - "securityGroupEgress": [ - { - "cidrIp": "0.0.0.0/0", - "description": "Allow all outbound traffic by default", - "ipProtocol": "-1" - } - ], - "vpcId": { - "Fn::GetAtt": [ - "ResourcesNestedStackResourcesNestedStackResourceCDA26E60", - "Outputs.importedenvironmentintegResourcesEnvironmentenvironmentvpcDC34D4D3Ref" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - }, - "from importedenvironmentintegServiceloadbalancerSecurityGroup68EE533C:80": { - "id": "from importedenvironmentintegServiceloadbalancerSecurityGroup68EE533C:80", - "path": "imported-environment-integ/Service-service/SecurityGroup/from importedenvironmentintegServiceloadbalancerSecurityGroup68EE533C:80", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroupIngress", - "aws:cdk:cloudformation:props": { - "ipProtocol": "tcp", - "description": "Load balancer to target", - "fromPort": 80, - "groupId": { - "Fn::GetAtt": [ - "ServiceserviceSecurityGroup1915660F", - "GroupId" - ] - }, - "sourceSecurityGroupId": { - "Fn::GetAtt": [ - "ServiceloadbalancerSecurityGroup2DA3E8D6", - "GroupId" - ] - }, - "toPort": 80 - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "AssetParameters": { - "id": "AssetParameters", - "path": "imported-environment-integ/AssetParameters", - "children": { - "78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01": { - "id": "78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01", - "path": "imported-environment-integ/AssetParameters/78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01", - "children": { - "S3Bucket": { - "id": "S3Bucket", - "path": "imported-environment-integ/AssetParameters/78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01/S3Bucket", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnParameter", - "version": "0.0.0" - } - }, - "S3VersionKey": { - "id": "S3VersionKey", - "path": "imported-environment-integ/AssetParameters/78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01/S3VersionKey", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnParameter", - "version": "0.0.0" - } - }, - "ArtifactHash": { - "id": "ArtifactHash", - "path": "imported-environment-integ/AssetParameters/78cd13b88474241c9844c0c939b6fca0f485ffbba32f35718002319e7ab73a01/ArtifactHash", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnParameter", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.0.9" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.0.9" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Stack", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.App", - "version": "0.0.0" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/injecter.test.ts b/packages/@aws-cdk-containers/ecs-service-extensions/test/injecter.test.ts deleted file mode 100644 index e52c498f17455..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/injecter.test.ts +++ /dev/null @@ -1,114 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as sns from '@aws-cdk/aws-sns'; -import * as cdk from '@aws-cdk/core'; -import { Container, Environment, InjecterExtension, InjectableTopic, Service, ServiceDescription } from '../lib'; - -describe('injecter', () => { - test('correctly sets publish permissions for given topics', () => { - // GIVEN - const stack = new cdk.Stack(); - - const environment = new Environment(stack, 'production'); - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - environment: { - PORT: '80', - }, - })); - - // WHEN - const topic1 = new InjectableTopic({ - topic: new sns.Topic(stack, 'topic1'), - }); - - const topic2 = new InjectableTopic({ - topic: new sns.Topic(stack, 'topic2'), - }); - - serviceDescription.add(new InjecterExtension({ - injectables: [topic1, topic2], - })); - - new Service(stack, 'my-service', { - environment, - serviceDescription, - }); - - // THEN - // Ensure creation of provided topics - Template.fromStack(stack).resourceCountIs('AWS::SNS::Topic', 2); - - // Ensure the task role is given permissions to publish events to topics - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: 'sns:Publish', - Effect: 'Allow', - Resource: { - Ref: 'topic152D84A37', - }, - }, - { - Action: 'sns:Publish', - Effect: 'Allow', - Resource: { - Ref: 'topic2A4FB547F', - }, - }, - ], - Version: '2012-10-17', - }, - }); - - // Ensure that the topic ARNs have been correctly appended to the environment variables - Template.fromStack(stack).hasResourceProperties('AWS::ECS::TaskDefinition', { - ContainerDefinitions: [ - { - Cpu: 256, - Environment: [ - { - Name: 'PORT', - Value: '80', - }, - { - Name: 'TOPIC1_TOPIC_ARN', - Value: { - Ref: 'topic152D84A37', - }, - }, - { - Name: 'TOPIC2_TOPIC_ARN', - Value: { - Ref: 'topic2A4FB547F', - }, - }, - ], - Image: 'nathanpeck/name', - Essential: true, - Memory: 512, - Name: 'app', - PortMappings: [ - { - ContainerPort: 80, - Protocol: 'tcp', - }, - ], - Ulimits: [ - { - HardLimit: 1024000, - Name: 'nofile', - SoftLimit: 1024000, - }, - ], - }, - ], - }); - }); -}); \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.all-service-addons.expected.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.all-service-addons.expected.json deleted file mode 100644 index 4f51a31f422dd..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.all-service-addons.expected.json +++ /dev/null @@ -1,3455 +0,0 @@ -{ - "Resources": { - "mymeshEA67EDEF": { - "Type": "AWS::AppMesh::Mesh", - "Properties": { - "MeshName": "awsecsintegmymeshFCC0D554", - "Spec": {} - } - }, - "productionenvironmentvpcAEB47DF7": { - "Type": "AWS::EC2::VPC", - "Properties": { - "CidrBlock": "10.0.0.0/16", - "EnableDnsHostnames": true, - "EnableDnsSupport": true, - "InstanceTenancy": "default", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1Subnet8D92C089": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.0.0/19", - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "AvailabilityZone": "test-region-1a", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1RouteTableAssociationA8117374": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - } - } - }, - "productionenvironmentvpcPublicSubnet1DefaultRoute524C894D": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - }, - "DependsOn": [ - "productionenvironmentvpcVPCGW1B428D07" - ] - }, - "productionenvironmentvpcPublicSubnet1EIP54BA88DB": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1NATGateway6075E4CA": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - }, - "AllocationId": { - "Fn::GetAtt": [ - "productionenvironmentvpcPublicSubnet1EIP54BA88DB", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet2Subnet298E6C31": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.32.0/19", - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "AvailabilityZone": "test-region-1b", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet2RouteTable842A68D7": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet2RouteTableAssociation0A7549F3": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet2RouteTable842A68D7" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - } - } - }, - "productionenvironmentvpcPublicSubnet2DefaultRoute92CD697D": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet2RouteTable842A68D7" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - }, - "DependsOn": [ - "productionenvironmentvpcVPCGW1B428D07" - ] - }, - "productionenvironmentvpcPublicSubnet2EIP14CA46AA": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet2NATGatewayE1850FCC": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - }, - "AllocationId": { - "Fn::GetAtt": [ - "productionenvironmentvpcPublicSubnet2EIP14CA46AA", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet3SubnetC7B5665D": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.64.0/19", - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "AvailabilityZone": "test-region-1c", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet3" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet3RouteTable00E3BF60": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet3" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet3RouteTableAssociationFA34D6E7": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet3RouteTable00E3BF60" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet3SubnetC7B5665D" - } - } - }, - "productionenvironmentvpcPublicSubnet3DefaultRouteE1ADEA6C": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet3RouteTable00E3BF60" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - }, - "DependsOn": [ - "productionenvironmentvpcVPCGW1B428D07" - ] - }, - "productionenvironmentvpcPublicSubnet3EIP53405AED": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet3" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet3NATGateway94604057": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet3SubnetC7B5665D" - }, - "AllocationId": { - "Fn::GetAtt": [ - "productionenvironmentvpcPublicSubnet3EIP53405AED", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet3" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet1Subnet53F632E6": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.96.0/19", - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "AvailabilityZone": "test-region-1a", - "MapPublicIpOnLaunch": false, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Private" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Private" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet1RouteTableAssociation8BA32463": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - } - } - }, - "productionenvironmentvpcPrivateSubnet1DefaultRouteFBB3DE6C": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "productionenvironmentvpcPublicSubnet1NATGateway6075E4CA" - } - } - }, - "productionenvironmentvpcPrivateSubnet2Subnet756FB93C": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.128.0/19", - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "AvailabilityZone": "test-region-1b", - "MapPublicIpOnLaunch": false, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Private" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Private" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet2RouteTableAssociation09188261": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - } - }, - "productionenvironmentvpcPrivateSubnet2DefaultRoute5F9AB6C1": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "productionenvironmentvpcPublicSubnet2NATGatewayE1850FCC" - } - } - }, - "productionenvironmentvpcPrivateSubnet3Subnet3BD4064E": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.160.0/19", - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "AvailabilityZone": "test-region-1c", - "MapPublicIpOnLaunch": false, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Private" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Private" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet3" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet3RouteTable1A244D34": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet3" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet3RouteTableAssociation65F18B9C": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet3RouteTable1A244D34" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPrivateSubnet3Subnet3BD4064E" - } - } - }, - "productionenvironmentvpcPrivateSubnet3DefaultRoute2438918B": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet3RouteTable1A244D34" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "productionenvironmentvpcPublicSubnet3NATGateway94604057" - } - } - }, - "productionenvironmentvpcIGWE7C39890": { - "Type": "AWS::EC2::InternetGateway", - "Properties": { - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc" - } - ] - } - }, - "productionenvironmentvpcVPCGW1B428D07": { - "Type": "AWS::EC2::VPCGatewayAttachment", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "InternetGatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - } - }, - "productionenvironmentclusterC6599D2D": { - "Type": "AWS::ECS::Cluster" - }, - "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D": { - "Type": "AWS::ServiceDiscovery::PrivateDnsNamespace", - "Properties": { - "Name": "production", - "Vpc": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "namelogsF4B17D31": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "name-logs", - "RetentionInDays": 7 - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "nametaskdefinitionTaskRole50FE844E": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/AWSXRayDaemonWriteAccess" - ] - ] - } - ] - } - }, - "nametaskdefinitionTaskRoleDefaultPolicyE66EDC68": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:DescribeLogStreams", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "nametaskdefinitionTaskRoleDefaultPolicyE66EDC68", - "Roles": [ - { - "Ref": "nametaskdefinitionTaskRole50FE844E" - } - ] - } - }, - "nametaskdefinition690762BB": { - "Type": "AWS::ECS::TaskDefinition", - "Properties": { - "ContainerDefinitions": [ - { - "Cpu": 1024, - "DependsOn": [ - { - "Condition": "START", - "ContainerName": "firelens" - }, - { - "Condition": "HEALTHY", - "ContainerName": "envoy" - }, - { - "Condition": "START", - "ContainerName": "cloudwatch-agent" - }, - { - "Condition": "HEALTHY", - "ContainerName": "xray" - } - ], - "Environment": [ - { - "Name": "PORT", - "Value": "80" - } - ], - "Essential": true, - "Image": "nathanpeck/name", - "LogConfiguration": { - "LogDriver": "awsfirelens", - "Options": { - "Name": "cloudwatch", - "region": { - "Ref": "AWS::Region" - }, - "log_group_name": { - "Ref": "namelogsF4B17D31" - }, - "log_stream_prefix": "name/" - } - }, - "Memory": 2048, - "Name": "app", - "PortMappings": [ - { - "ContainerPort": 80, - "Protocol": "tcp" - } - ], - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ] - }, - { - "Environment": [ - { - "Name": "APPMESH_VIRTUAL_NODE_NAME", - "Value": { - "Fn::Join": [ - "", - [ - "mesh/", - { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "/virtualNode/name" - ] - ] - } - }, - { - "Name": "AWS_REGION", - "Value": { - "Ref": "AWS::Region" - } - }, - { - "Name": "ENABLE_ENVOY_STATS_TAGS", - "Value": "1" - }, - { - "Name": "ENABLE_ENVOY_DOG_STATSD", - "Value": "1" - } - ], - "Essential": true, - "HealthCheck": { - "Command": [ - "CMD-SHELL", - "curl -s http://localhost:9901/server_info | grep state | grep -q LIVE" - ], - "Interval": 5, - "Retries": 3, - "StartPeriod": 10, - "Timeout": 2 - }, - "Image": { - "Fn::Join": [ - "", - [ - { - "Fn::FindInMap": [ - "nameenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ".dkr.ecr.", - { - "Ref": "AWS::Region" - }, - ".", - { - "Ref": "AWS::URLSuffix" - }, - "/aws-appmesh-envoy:v1.15.1.0-prod" - ] - ] - }, - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "nametaskdefinitionenvoyLogGroup258B673B" - }, - "awslogs-stream-prefix": "envoy", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "MemoryReservation": 128, - "Name": "envoy", - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ], - "User": "1337" - }, - { - "DependsOn": [ - { - "Condition": "HEALTHY", - "ContainerName": "envoy" - } - ], - "Essential": true, - "FirelensConfiguration": { - "Type": "fluentbit" - }, - "Image": { - "Ref": "SsmParameterValueawsserviceawsforfluentbitlatestC96584B6F00A464EAD1953AFF4B05118Parameter" - }, - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "nametaskdefinitionfirelensLogGroup80DDA60F" - }, - "awslogs-stream-prefix": "firelens", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "MemoryReservation": 50, - "Name": "firelens", - "User": "0:1338" - }, - { - "DependsOn": [ - { - "Condition": "HEALTHY", - "ContainerName": "envoy" - } - ], - "Environment": [ - { - "Name": "AWS_REGION", - "Value": { - "Ref": "AWS::Region" - } - } - ], - "Essential": true, - "HealthCheck": { - "Command": [ - "CMD-SHELL", - "curl -s http://localhost:2000" - ], - "Interval": 5, - "Retries": 3, - "StartPeriod": 10, - "Timeout": 2 - }, - "Image": "amazon/aws-xray-daemon:latest", - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "nametaskdefinitionxrayLogGroup4AF4CA37" - }, - "awslogs-stream-prefix": "xray", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "MemoryReservation": 256, - "Name": "xray", - "User": "1337" - }, - { - "DependsOn": [ - { - "Condition": "HEALTHY", - "ContainerName": "envoy" - } - ], - "Environment": [ - { - "Name": "CW_CONFIG_CONTENT", - "Value": "{\"logs\":{\"metrics_collected\":{\"emf\":{}}},\"metrics\":{\"metrics_collected\":{\"statsd\":{}}}}" - } - ], - "Essential": true, - "Image": "amazon/cloudwatch-agent:latest", - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "nametaskdefinitioncloudwatchagentLogGroup78DDC685" - }, - "awslogs-stream-prefix": "cloudwatch-agent", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "MemoryReservation": 50, - "Name": "cloudwatch-agent", - "User": "0:1338" - } - ], - "Cpu": "1024", - "ExecutionRoleArn": { - "Fn::GetAtt": [ - "nametaskdefinitionExecutionRole45AC5C9A", - "Arn" - ] - }, - "Family": "awsecsintegnametaskdefinition0EA6A1A0", - "Memory": "2048", - "NetworkMode": "awsvpc", - "ProxyConfiguration": { - "ContainerName": "envoy", - "ProxyConfigurationProperties": [ - { - "Name": "AppPorts", - "Value": "80" - }, - { - "Name": "ProxyEgressPort", - "Value": "15001" - }, - { - "Name": "ProxyIngressPort", - "Value": "15000" - }, - { - "Name": "IgnoredUID", - "Value": "1337" - }, - { - "Name": "IgnoredGID", - "Value": "1338" - }, - { - "Name": "EgressIgnoredIPs", - "Value": "169.254.170.2,169.254.169.254" - } - ], - "Type": "APPMESH" - }, - "RequiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "TaskRoleArn": { - "Fn::GetAtt": [ - "nametaskdefinitionTaskRole50FE844E", - "Arn" - ] - } - } - }, - "nametaskdefinitionenvoyLogGroup258B673B": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "nametaskdefinitionExecutionRole45AC5C9A": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "nametaskdefinitionExecutionRoleDefaultPolicyF7942D20": { - "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" - }, - ":", - { - "Fn::FindInMap": [ - "nameenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ":repository/aws-appmesh-envoy" - ] - ] - } - }, - { - "Action": [ - "ecr:BatchCheckLayerAvailability", - "ecr:BatchGetImage", - "ecr:GetAuthorizationToken", - "ecr:GetDownloadUrlForLayer" - ], - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "nametaskdefinitioncloudwatchagentLogGroup78DDC685", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "nametaskdefinitionenvoyLogGroup258B673B", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "nametaskdefinitionfirelensLogGroup80DDA60F", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "nametaskdefinitionxrayLogGroup4AF4CA37", - "Arn" - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "nametaskdefinitionExecutionRoleDefaultPolicyF7942D20", - "Roles": [ - { - "Ref": "nametaskdefinitionExecutionRole45AC5C9A" - } - ] - } - }, - "nametaskdefinitionfirelensLogGroup80DDA60F": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "nametaskdefinitionxrayLogGroup4AF4CA37": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "nametaskdefinitioncloudwatchagentLogGroup78DDC685": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "nameenvoytoappmesh2767D3E6": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "appmesh:StreamAggregatedResources", - "Effect": "Allow", - "Resource": { - "Ref": "mymeshEA67EDEF" - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "nameenvoytoappmesh2767D3E6", - "Roles": [ - { - "Ref": "nametaskdefinitionTaskRole50FE844E" - } - ] - } - }, - "namepublishmetricsF329C7AE": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "cloudwatch:PutMetricData", - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "namepublishmetricsF329C7AE", - "Roles": [ - { - "Ref": "nametaskdefinitionTaskRole50FE844E" - } - ] - } - }, - "nameserviceService8015C8D6": { - "Type": "AWS::ECS::Service", - "Properties": { - "Cluster": { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "DeploymentConfiguration": { - "MaximumPercent": 150, - "MinimumHealthyPercent": 100 - }, - "DesiredCount": 2, - "EnableECSManagedTags": false, - "LaunchType": "FARGATE", - "NetworkConfiguration": { - "AwsvpcConfiguration": { - "AssignPublicIp": "DISABLED", - "SecurityGroups": [ - { - "Fn::GetAtt": [ - "nameserviceSecurityGroup33F4662C", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - }, - { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - }, - { - "Ref": "productionenvironmentvpcPrivateSubnet3Subnet3BD4064E" - } - ] - } - }, - "ServiceRegistries": [ - { - "RegistryArn": { - "Fn::GetAtt": [ - "nameserviceCloudmapService3D5B0548", - "Arn" - ] - } - } - ], - "TaskDefinition": { - "Ref": "nametaskdefinition690762BB" - } - } - }, - "nameserviceCloudmapService3D5B0548": { - "Type": "AWS::ServiceDiscovery::Service", - "Properties": { - "DnsConfig": { - "DnsRecords": [ - { - "TTL": 10, - "Type": "A" - } - ], - "NamespaceId": { - "Fn::GetAtt": [ - "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D", - "Id" - ] - }, - "RoutingPolicy": "MULTIVALUE" - }, - "HealthCheckCustomConfig": { - "FailureThreshold": 2 - }, - "Name": "name", - "NamespaceId": { - "Fn::GetAtt": [ - "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D", - "Id" - ] - } - } - }, - "nameserviceSecurityGroup33F4662C": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "aws-ecs-integ/name-service/SecurityGroup", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "nameserviceSecurityGroupfromawsecsinteggreeterserviceSecurityGroup055DC23B8048057EFF": { - "Type": "AWS::EC2::SecurityGroupIngress", - "Properties": { - "IpProtocol": "tcp", - "Description": "Accept inbound traffic from greeter", - "FromPort": 80, - "GroupId": { - "Fn::GetAtt": [ - "nameserviceSecurityGroup33F4662C", - "GroupId" - ] - }, - "SourceSecurityGroupId": { - "Fn::GetAtt": [ - "greeterserviceSecurityGroupDB4AC3A9", - "GroupId" - ] - }, - "ToPort": 80 - } - }, - "nameserviceTaskCountTarget366C2B3A": { - "Type": "AWS::ApplicationAutoScaling::ScalableTarget", - "Properties": { - "MaxCapacity": 8, - "MinCapacity": 2, - "ResourceId": { - "Fn::Join": [ - "", - [ - "service/", - { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "/", - { - "Fn::GetAtt": [ - "nameserviceService8015C8D6", - "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" - } - }, - "nameserviceTaskCountTargetnametargetcpuutilization5018B16243": { - "Type": "AWS::ApplicationAutoScaling::ScalingPolicy", - "Properties": { - "PolicyName": "awsecsintegnameserviceTaskCountTargetnametargetcpuutilization50CAB59E05", - "PolicyType": "TargetTrackingScaling", - "ScalingTargetId": { - "Ref": "nameserviceTaskCountTarget366C2B3A" - }, - "TargetTrackingScalingPolicyConfiguration": { - "PredefinedMetricSpecification": { - "PredefinedMetricType": "ECSServiceAverageCPUUtilization" - }, - "ScaleInCooldown": 60, - "ScaleOutCooldown": 60, - "TargetValue": 50 - } - } - }, - "namevirtualnode6C99CB14": { - "Type": "AWS::AppMesh::VirtualNode", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "Spec": { - "Listeners": [ - { - "PortMapping": { - "Port": 80, - "Protocol": "http" - } - } - ], - "ServiceDiscovery": { - "AWSCloudMap": { - "NamespaceName": "production", - "ServiceName": { - "Fn::GetAtt": [ - "nameserviceCloudmapService3D5B0548", - "Name" - ] - } - } - } - }, - "VirtualNodeName": "name" - } - }, - "namevirtualrouterC00E1ACE": { - "Type": "AWS::AppMesh::VirtualRouter", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "Spec": { - "Listeners": [ - { - "PortMapping": { - "Port": 80, - "Protocol": "http" - } - } - ] - }, - "VirtualRouterName": "name" - } - }, - "namevirtualrouternamerouteDCDF3715": { - "Type": "AWS::AppMesh::Route", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "Spec": { - "HttpRoute": { - "Action": { - "WeightedTargets": [ - { - "VirtualNode": { - "Fn::GetAtt": [ - "namevirtualnode6C99CB14", - "VirtualNodeName" - ] - }, - "Weight": 1 - } - ] - }, - "Match": { - "Prefix": "/" - } - } - }, - "VirtualRouterName": { - "Fn::GetAtt": [ - "namevirtualrouterC00E1ACE", - "VirtualRouterName" - ] - }, - "RouteName": "name-route" - } - }, - "namevirtualservice3DDDDF1E": { - "Type": "AWS::AppMesh::VirtualService", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "Spec": { - "Provider": { - "VirtualRouter": { - "VirtualRouterName": { - "Fn::GetAtt": [ - "namevirtualrouterC00E1ACE", - "VirtualRouterName" - ] - } - } - } - }, - "VirtualServiceName": "name.production" - } - }, - "greetinglogsCC360934": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "greeting-logs", - "RetentionInDays": 7 - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "greetingtaskdefinitionTaskRole9179DA4A": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/AWSXRayDaemonWriteAccess" - ] - ] - } - ] - } - }, - "greetingtaskdefinitionTaskRoleDefaultPolicy5DB4510A": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:DescribeLogStreams", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "greetingtaskdefinitionTaskRoleDefaultPolicy5DB4510A", - "Roles": [ - { - "Ref": "greetingtaskdefinitionTaskRole9179DA4A" - } - ] - } - }, - "greetingtaskdefinition31690093": { - "Type": "AWS::ECS::TaskDefinition", - "Properties": { - "ContainerDefinitions": [ - { - "Cpu": 1024, - "DependsOn": [ - { - "Condition": "START", - "ContainerName": "firelens" - }, - { - "Condition": "HEALTHY", - "ContainerName": "envoy" - }, - { - "Condition": "START", - "ContainerName": "cloudwatch-agent" - }, - { - "Condition": "HEALTHY", - "ContainerName": "xray" - } - ], - "Environment": [ - { - "Name": "PORT", - "Value": "80" - } - ], - "Essential": true, - "Image": "nathanpeck/greeting", - "LogConfiguration": { - "LogDriver": "awsfirelens", - "Options": { - "Name": "cloudwatch", - "region": { - "Ref": "AWS::Region" - }, - "log_group_name": { - "Ref": "greetinglogsCC360934" - }, - "log_stream_prefix": "greeting/" - } - }, - "Memory": 2048, - "Name": "app", - "PortMappings": [ - { - "ContainerPort": 80, - "Protocol": "tcp" - } - ], - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ] - }, - { - "Environment": [ - { - "Name": "APPMESH_VIRTUAL_NODE_NAME", - "Value": { - "Fn::Join": [ - "", - [ - "mesh/", - { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "/virtualNode/greeting" - ] - ] - } - }, - { - "Name": "AWS_REGION", - "Value": { - "Ref": "AWS::Region" - } - }, - { - "Name": "ENABLE_ENVOY_STATS_TAGS", - "Value": "1" - }, - { - "Name": "ENABLE_ENVOY_DOG_STATSD", - "Value": "1" - } - ], - "Essential": true, - "HealthCheck": { - "Command": [ - "CMD-SHELL", - "curl -s http://localhost:9901/server_info | grep state | grep -q LIVE" - ], - "Interval": 5, - "Retries": 3, - "StartPeriod": 10, - "Timeout": 2 - }, - "Image": { - "Fn::Join": [ - "", - [ - { - "Fn::FindInMap": [ - "greetingenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ".dkr.ecr.", - { - "Ref": "AWS::Region" - }, - ".", - { - "Ref": "AWS::URLSuffix" - }, - "/aws-appmesh-envoy:v1.15.1.0-prod" - ] - ] - }, - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "greetingtaskdefinitionenvoyLogGroup6556AC35" - }, - "awslogs-stream-prefix": "envoy", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "MemoryReservation": 128, - "Name": "envoy", - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ], - "User": "1337" - }, - { - "DependsOn": [ - { - "Condition": "HEALTHY", - "ContainerName": "envoy" - } - ], - "Essential": true, - "FirelensConfiguration": { - "Type": "fluentbit" - }, - "Image": { - "Ref": "SsmParameterValueawsserviceawsforfluentbitlatestC96584B6F00A464EAD1953AFF4B05118Parameter" - }, - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "greetingtaskdefinitionfirelensLogGroupD7A398A7" - }, - "awslogs-stream-prefix": "firelens", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "MemoryReservation": 50, - "Name": "firelens", - "User": "0:1338" - }, - { - "DependsOn": [ - { - "Condition": "HEALTHY", - "ContainerName": "envoy" - } - ], - "Environment": [ - { - "Name": "AWS_REGION", - "Value": { - "Ref": "AWS::Region" - } - } - ], - "Essential": true, - "HealthCheck": { - "Command": [ - "CMD-SHELL", - "curl -s http://localhost:2000" - ], - "Interval": 5, - "Retries": 3, - "StartPeriod": 10, - "Timeout": 2 - }, - "Image": "amazon/aws-xray-daemon:latest", - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "greetingtaskdefinitionxrayLogGroupD25C072D" - }, - "awslogs-stream-prefix": "xray", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "MemoryReservation": 256, - "Name": "xray", - "User": "1337" - }, - { - "DependsOn": [ - { - "Condition": "HEALTHY", - "ContainerName": "envoy" - } - ], - "Environment": [ - { - "Name": "CW_CONFIG_CONTENT", - "Value": "{\"logs\":{\"metrics_collected\":{\"emf\":{}}},\"metrics\":{\"metrics_collected\":{\"statsd\":{}}}}" - } - ], - "Essential": true, - "Image": "amazon/cloudwatch-agent:latest", - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "greetingtaskdefinitioncloudwatchagentLogGroupCEF72742" - }, - "awslogs-stream-prefix": "cloudwatch-agent", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "MemoryReservation": 50, - "Name": "cloudwatch-agent", - "User": "0:1338" - } - ], - "Cpu": "1024", - "ExecutionRoleArn": { - "Fn::GetAtt": [ - "greetingtaskdefinitionExecutionRole9E3A7CF3", - "Arn" - ] - }, - "Family": "awsecsinteggreetingtaskdefinitionA6E8A57B", - "Memory": "2048", - "NetworkMode": "awsvpc", - "ProxyConfiguration": { - "ContainerName": "envoy", - "ProxyConfigurationProperties": [ - { - "Name": "AppPorts", - "Value": "80" - }, - { - "Name": "ProxyEgressPort", - "Value": "15001" - }, - { - "Name": "ProxyIngressPort", - "Value": "15000" - }, - { - "Name": "IgnoredUID", - "Value": "1337" - }, - { - "Name": "IgnoredGID", - "Value": "1338" - }, - { - "Name": "EgressIgnoredIPs", - "Value": "169.254.170.2,169.254.169.254" - } - ], - "Type": "APPMESH" - }, - "RequiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "TaskRoleArn": { - "Fn::GetAtt": [ - "greetingtaskdefinitionTaskRole9179DA4A", - "Arn" - ] - } - } - }, - "greetingtaskdefinitionenvoyLogGroup6556AC35": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "greetingtaskdefinitionExecutionRole9E3A7CF3": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "greetingtaskdefinitionExecutionRoleDefaultPolicy31B93022": { - "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" - }, - ":", - { - "Fn::FindInMap": [ - "greetingenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ":repository/aws-appmesh-envoy" - ] - ] - } - }, - { - "Action": [ - "ecr:BatchCheckLayerAvailability", - "ecr:BatchGetImage", - "ecr:GetAuthorizationToken", - "ecr:GetDownloadUrlForLayer" - ], - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "greetingtaskdefinitioncloudwatchagentLogGroupCEF72742", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "greetingtaskdefinitionenvoyLogGroup6556AC35", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "greetingtaskdefinitionfirelensLogGroupD7A398A7", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "greetingtaskdefinitionxrayLogGroupD25C072D", - "Arn" - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "greetingtaskdefinitionExecutionRoleDefaultPolicy31B93022", - "Roles": [ - { - "Ref": "greetingtaskdefinitionExecutionRole9E3A7CF3" - } - ] - } - }, - "greetingtaskdefinitionfirelensLogGroupD7A398A7": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "greetingtaskdefinitionxrayLogGroupD25C072D": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "greetingtaskdefinitioncloudwatchagentLogGroupCEF72742": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "greetingenvoytoappmesh97051B23": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "appmesh:StreamAggregatedResources", - "Effect": "Allow", - "Resource": { - "Ref": "mymeshEA67EDEF" - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "greetingenvoytoappmesh97051B23", - "Roles": [ - { - "Ref": "greetingtaskdefinitionTaskRole9179DA4A" - } - ] - } - }, - "greetingpublishmetricsF17124EF": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "cloudwatch:PutMetricData", - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "greetingpublishmetricsF17124EF", - "Roles": [ - { - "Ref": "greetingtaskdefinitionTaskRole9179DA4A" - } - ] - } - }, - "greetingserviceService8DA58640": { - "Type": "AWS::ECS::Service", - "Properties": { - "Cluster": { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "DeploymentConfiguration": { - "MaximumPercent": 150, - "MinimumHealthyPercent": 100 - }, - "DesiredCount": 2, - "EnableECSManagedTags": false, - "LaunchType": "FARGATE", - "NetworkConfiguration": { - "AwsvpcConfiguration": { - "AssignPublicIp": "DISABLED", - "SecurityGroups": [ - { - "Fn::GetAtt": [ - "greetingserviceSecurityGroupE9BE665B", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - }, - { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - }, - { - "Ref": "productionenvironmentvpcPrivateSubnet3Subnet3BD4064E" - } - ] - } - }, - "ServiceRegistries": [ - { - "RegistryArn": { - "Fn::GetAtt": [ - "greetingserviceCloudmapService0A2D7385", - "Arn" - ] - } - } - ], - "TaskDefinition": { - "Ref": "greetingtaskdefinition31690093" - } - } - }, - "greetingserviceCloudmapService0A2D7385": { - "Type": "AWS::ServiceDiscovery::Service", - "Properties": { - "DnsConfig": { - "DnsRecords": [ - { - "TTL": 10, - "Type": "A" - } - ], - "NamespaceId": { - "Fn::GetAtt": [ - "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D", - "Id" - ] - }, - "RoutingPolicy": "MULTIVALUE" - }, - "HealthCheckCustomConfig": { - "FailureThreshold": 2 - }, - "Name": "greeting", - "NamespaceId": { - "Fn::GetAtt": [ - "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D", - "Id" - ] - } - } - }, - "greetingserviceSecurityGroupE9BE665B": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "aws-ecs-integ/greeting-service/SecurityGroup", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "greetingserviceSecurityGroupfromawsecsinteggreeterserviceSecurityGroup055DC23B807B9C4357": { - "Type": "AWS::EC2::SecurityGroupIngress", - "Properties": { - "IpProtocol": "tcp", - "Description": "Accept inbound traffic from greeter", - "FromPort": 80, - "GroupId": { - "Fn::GetAtt": [ - "greetingserviceSecurityGroupE9BE665B", - "GroupId" - ] - }, - "SourceSecurityGroupId": { - "Fn::GetAtt": [ - "greeterserviceSecurityGroupDB4AC3A9", - "GroupId" - ] - }, - "ToPort": 80 - } - }, - "greetingserviceTaskCountTargetA036048C": { - "Type": "AWS::ApplicationAutoScaling::ScalableTarget", - "Properties": { - "MaxCapacity": 8, - "MinCapacity": 2, - "ResourceId": { - "Fn::Join": [ - "", - [ - "service/", - { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "/", - { - "Fn::GetAtt": [ - "greetingserviceService8DA58640", - "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" - } - }, - "greetingserviceTaskCountTargetgreetingtargetcpuutilization50FEAF6434": { - "Type": "AWS::ApplicationAutoScaling::ScalingPolicy", - "Properties": { - "PolicyName": "awsecsinteggreetingserviceTaskCountTargetgreetingtargetcpuutilization504C76B1F4", - "PolicyType": "TargetTrackingScaling", - "ScalingTargetId": { - "Ref": "greetingserviceTaskCountTargetA036048C" - }, - "TargetTrackingScalingPolicyConfiguration": { - "PredefinedMetricSpecification": { - "PredefinedMetricType": "ECSServiceAverageCPUUtilization" - }, - "ScaleInCooldown": 60, - "ScaleOutCooldown": 60, - "TargetValue": 50 - } - } - }, - "greetingvirtualnodeC4A2C517": { - "Type": "AWS::AppMesh::VirtualNode", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "Spec": { - "Listeners": [ - { - "PortMapping": { - "Port": 80, - "Protocol": "http" - } - } - ], - "ServiceDiscovery": { - "AWSCloudMap": { - "NamespaceName": "production", - "ServiceName": { - "Fn::GetAtt": [ - "greetingserviceCloudmapService0A2D7385", - "Name" - ] - } - } - } - }, - "VirtualNodeName": "greeting" - } - }, - "greetingvirtualrouter0F898D1A": { - "Type": "AWS::AppMesh::VirtualRouter", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "Spec": { - "Listeners": [ - { - "PortMapping": { - "Port": 80, - "Protocol": "http" - } - } - ] - }, - "VirtualRouterName": "greeting" - } - }, - "greetingvirtualroutergreetingroute46305F50": { - "Type": "AWS::AppMesh::Route", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "Spec": { - "HttpRoute": { - "Action": { - "WeightedTargets": [ - { - "VirtualNode": { - "Fn::GetAtt": [ - "greetingvirtualnodeC4A2C517", - "VirtualNodeName" - ] - }, - "Weight": 1 - } - ] - }, - "Match": { - "Prefix": "/" - } - } - }, - "VirtualRouterName": { - "Fn::GetAtt": [ - "greetingvirtualrouter0F898D1A", - "VirtualRouterName" - ] - }, - "RouteName": "greeting-route" - } - }, - "greetingvirtualservice60AD3AD9": { - "Type": "AWS::AppMesh::VirtualService", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "Spec": { - "Provider": { - "VirtualRouter": { - "VirtualRouterName": { - "Fn::GetAtt": [ - "greetingvirtualrouter0F898D1A", - "VirtualRouterName" - ] - } - } - } - }, - "VirtualServiceName": "greeting.production" - } - }, - "greeterlogsCCD2F8B2": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "greeter-logs", - "RetentionInDays": 7 - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "greeterloadbalancer85256741": { - "Type": "AWS::ElasticLoadBalancingV2::LoadBalancer", - "Properties": { - "LoadBalancerAttributes": [ - { - "Key": "deletion_protection.enabled", - "Value": "false" - } - ], - "Scheme": "internet-facing", - "SecurityGroups": [ - { - "Fn::GetAtt": [ - "greeterloadbalancerSecurityGroupEE1B20F3", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Ref": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - }, - { - "Ref": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - }, - { - "Ref": "productionenvironmentvpcPublicSubnet3SubnetC7B5665D" - } - ], - "Type": "application" - }, - "DependsOn": [ - "productionenvironmentvpcPublicSubnet1DefaultRoute524C894D", - "productionenvironmentvpcPublicSubnet2DefaultRoute92CD697D", - "productionenvironmentvpcPublicSubnet3DefaultRouteE1ADEA6C" - ] - }, - "greeterloadbalancerSecurityGroupEE1B20F3": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "Automatically created Security Group for ELB awsecsinteggreeterloadbalancer147D1D5C", - "SecurityGroupIngress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow from anyone on port 80", - "FromPort": 80, - "IpProtocol": "tcp", - "ToPort": 80 - } - ], - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "greeterloadbalancerSecurityGrouptoawsecsinteggreeterserviceSecurityGroup055DC23B803EEF3320": { - "Type": "AWS::EC2::SecurityGroupEgress", - "Properties": { - "GroupId": { - "Fn::GetAtt": [ - "greeterloadbalancerSecurityGroupEE1B20F3", - "GroupId" - ] - }, - "IpProtocol": "tcp", - "Description": "Load balancer to target", - "DestinationSecurityGroupId": { - "Fn::GetAtt": [ - "greeterserviceSecurityGroupDB4AC3A9", - "GroupId" - ] - }, - "FromPort": 80, - "ToPort": 80 - } - }, - "greeterloadbalancergreeterlistener952E028B": { - "Type": "AWS::ElasticLoadBalancingV2::Listener", - "Properties": { - "DefaultActions": [ - { - "TargetGroupArn": { - "Ref": "greeterloadbalancergreeterlistenergreeterGroupFFBFF0C2" - }, - "Type": "forward" - } - ], - "LoadBalancerArn": { - "Ref": "greeterloadbalancer85256741" - }, - "Port": 80, - "Protocol": "HTTP" - } - }, - "greeterloadbalancergreeterlistenergreeterGroupFFBFF0C2": { - "Type": "AWS::ElasticLoadBalancingV2::TargetGroup", - "Properties": { - "Port": 80, - "Protocol": "HTTP", - "TargetGroupAttributes": [ - { - "Key": "deregistration_delay.timeout_seconds", - "Value": "10" - }, - { - "Key": "stickiness.enabled", - "Value": "false" - } - ], - "TargetType": "ip", - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "greetertaskdefinitionTaskRole2A098ACC": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/AWSXRayDaemonWriteAccess" - ] - ] - } - ] - } - }, - "greetertaskdefinitionTaskRoleDefaultPolicyD0F53B1C": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:DescribeLogStreams", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "greetertaskdefinitionTaskRoleDefaultPolicyD0F53B1C", - "Roles": [ - { - "Ref": "greetertaskdefinitionTaskRole2A098ACC" - } - ] - } - }, - "greetertaskdefinitionE956EEA2": { - "Type": "AWS::ECS::TaskDefinition", - "Properties": { - "ContainerDefinitions": [ - { - "Cpu": 1024, - "DependsOn": [ - { - "Condition": "START", - "ContainerName": "firelens" - }, - { - "Condition": "HEALTHY", - "ContainerName": "envoy" - }, - { - "Condition": "START", - "ContainerName": "cloudwatch-agent" - }, - { - "Condition": "HEALTHY", - "ContainerName": "xray" - } - ], - "Environment": [ - { - "Name": "PORT", - "Value": "80" - }, - { - "Name": "GREETING_URL", - "Value": "http://greeting.production" - }, - { - "Name": "NAME_URL", - "Value": "http://name.production" - } - ], - "Essential": true, - "Image": "nathanpeck/greeter", - "LogConfiguration": { - "LogDriver": "awsfirelens", - "Options": { - "Name": "cloudwatch", - "region": { - "Ref": "AWS::Region" - }, - "log_group_name": { - "Ref": "greeterlogsCCD2F8B2" - }, - "log_stream_prefix": "greeter/" - } - }, - "Memory": 2048, - "Name": "app", - "PortMappings": [ - { - "ContainerPort": 80, - "Protocol": "tcp" - } - ], - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ] - }, - { - "Environment": [ - { - "Name": "APPMESH_VIRTUAL_NODE_NAME", - "Value": { - "Fn::Join": [ - "", - [ - "mesh/", - { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "/virtualNode/greeter" - ] - ] - } - }, - { - "Name": "AWS_REGION", - "Value": { - "Ref": "AWS::Region" - } - }, - { - "Name": "ENABLE_ENVOY_STATS_TAGS", - "Value": "1" - }, - { - "Name": "ENABLE_ENVOY_DOG_STATSD", - "Value": "1" - } - ], - "Essential": true, - "HealthCheck": { - "Command": [ - "CMD-SHELL", - "curl -s http://localhost:9901/server_info | grep state | grep -q LIVE" - ], - "Interval": 5, - "Retries": 3, - "StartPeriod": 10, - "Timeout": 2 - }, - "Image": { - "Fn::Join": [ - "", - [ - { - "Fn::FindInMap": [ - "greeterenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ".dkr.ecr.", - { - "Ref": "AWS::Region" - }, - ".", - { - "Ref": "AWS::URLSuffix" - }, - "/aws-appmesh-envoy:v1.15.1.0-prod" - ] - ] - }, - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "greetertaskdefinitionenvoyLogGroup6E10B93E" - }, - "awslogs-stream-prefix": "envoy", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "MemoryReservation": 128, - "Name": "envoy", - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ], - "User": "1337" - }, - { - "DependsOn": [ - { - "Condition": "HEALTHY", - "ContainerName": "envoy" - } - ], - "Essential": true, - "FirelensConfiguration": { - "Type": "fluentbit" - }, - "Image": { - "Ref": "SsmParameterValueawsserviceawsforfluentbitlatestC96584B6F00A464EAD1953AFF4B05118Parameter" - }, - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "greetertaskdefinitionfirelensLogGroupD5BAAC35" - }, - "awslogs-stream-prefix": "firelens", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "MemoryReservation": 50, - "Name": "firelens", - "User": "0:1338" - }, - { - "DependsOn": [ - { - "Condition": "HEALTHY", - "ContainerName": "envoy" - } - ], - "Environment": [ - { - "Name": "AWS_REGION", - "Value": { - "Ref": "AWS::Region" - } - } - ], - "Essential": true, - "HealthCheck": { - "Command": [ - "CMD-SHELL", - "curl -s http://localhost:2000" - ], - "Interval": 5, - "Retries": 3, - "StartPeriod": 10, - "Timeout": 2 - }, - "Image": "amazon/aws-xray-daemon:latest", - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "greetertaskdefinitionxrayLogGroupBC1558B6" - }, - "awslogs-stream-prefix": "xray", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "MemoryReservation": 256, - "Name": "xray", - "User": "1337" - }, - { - "DependsOn": [ - { - "Condition": "HEALTHY", - "ContainerName": "envoy" - } - ], - "Environment": [ - { - "Name": "CW_CONFIG_CONTENT", - "Value": "{\"logs\":{\"metrics_collected\":{\"emf\":{}}},\"metrics\":{\"metrics_collected\":{\"statsd\":{}}}}" - } - ], - "Essential": true, - "Image": "amazon/cloudwatch-agent:latest", - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "greetertaskdefinitioncloudwatchagentLogGroupE7EAF327" - }, - "awslogs-stream-prefix": "cloudwatch-agent", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "MemoryReservation": 50, - "Name": "cloudwatch-agent", - "User": "0:1338" - } - ], - "Cpu": "1024", - "ExecutionRoleArn": { - "Fn::GetAtt": [ - "greetertaskdefinitionExecutionRoleAED0EC79", - "Arn" - ] - }, - "Family": "awsecsinteggreetertaskdefinitionB95239FB", - "Memory": "2048", - "NetworkMode": "awsvpc", - "ProxyConfiguration": { - "ContainerName": "envoy", - "ProxyConfigurationProperties": [ - { - "Name": "AppPorts", - "Value": "80" - }, - { - "Name": "ProxyEgressPort", - "Value": "15001" - }, - { - "Name": "ProxyIngressPort", - "Value": "15000" - }, - { - "Name": "IgnoredUID", - "Value": "1337" - }, - { - "Name": "IgnoredGID", - "Value": "1338" - }, - { - "Name": "EgressIgnoredIPs", - "Value": "169.254.170.2,169.254.169.254" - } - ], - "Type": "APPMESH" - }, - "RequiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "TaskRoleArn": { - "Fn::GetAtt": [ - "greetertaskdefinitionTaskRole2A098ACC", - "Arn" - ] - } - } - }, - "greetertaskdefinitionenvoyLogGroup6E10B93E": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "greetertaskdefinitionExecutionRoleAED0EC79": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "greetertaskdefinitionExecutionRoleDefaultPolicy0D8E9106": { - "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" - }, - ":", - { - "Fn::FindInMap": [ - "greeterenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ":repository/aws-appmesh-envoy" - ] - ] - } - }, - { - "Action": [ - "ecr:BatchCheckLayerAvailability", - "ecr:BatchGetImage", - "ecr:GetAuthorizationToken", - "ecr:GetDownloadUrlForLayer" - ], - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "greetertaskdefinitioncloudwatchagentLogGroupE7EAF327", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "greetertaskdefinitionenvoyLogGroup6E10B93E", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "greetertaskdefinitionfirelensLogGroupD5BAAC35", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "greetertaskdefinitionxrayLogGroupBC1558B6", - "Arn" - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "greetertaskdefinitionExecutionRoleDefaultPolicy0D8E9106", - "Roles": [ - { - "Ref": "greetertaskdefinitionExecutionRoleAED0EC79" - } - ] - } - }, - "greetertaskdefinitionfirelensLogGroupD5BAAC35": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "greetertaskdefinitionxrayLogGroupBC1558B6": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "greetertaskdefinitioncloudwatchagentLogGroupE7EAF327": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "greeterenvoytoappmesh1A94938B": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "appmesh:StreamAggregatedResources", - "Effect": "Allow", - "Resource": { - "Ref": "mymeshEA67EDEF" - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "greeterenvoytoappmesh1A94938B", - "Roles": [ - { - "Ref": "greetertaskdefinitionTaskRole2A098ACC" - } - ] - } - }, - "greeterpublishmetrics0CCA359A": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "cloudwatch:PutMetricData", - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "greeterpublishmetrics0CCA359A", - "Roles": [ - { - "Ref": "greetertaskdefinitionTaskRole2A098ACC" - } - ] - } - }, - "greeterserviceService8EDD3244": { - "Type": "AWS::ECS::Service", - "Properties": { - "Cluster": { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "DeploymentConfiguration": { - "MaximumPercent": 150, - "MinimumHealthyPercent": 100 - }, - "DesiredCount": 2, - "EnableECSManagedTags": false, - "HealthCheckGracePeriodSeconds": 60, - "LaunchType": "FARGATE", - "LoadBalancers": [ - { - "ContainerName": "app", - "ContainerPort": 80, - "TargetGroupArn": { - "Ref": "greeterloadbalancergreeterlistenergreeterGroupFFBFF0C2" - } - } - ], - "NetworkConfiguration": { - "AwsvpcConfiguration": { - "AssignPublicIp": "DISABLED", - "SecurityGroups": [ - { - "Fn::GetAtt": [ - "greeterserviceSecurityGroupDB4AC3A9", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - }, - { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - }, - { - "Ref": "productionenvironmentvpcPrivateSubnet3Subnet3BD4064E" - } - ] - } - }, - "ServiceRegistries": [ - { - "RegistryArn": { - "Fn::GetAtt": [ - "greeterserviceCloudmapServiceEE292978", - "Arn" - ] - } - } - ], - "TaskDefinition": { - "Ref": "greetertaskdefinitionE956EEA2" - } - }, - "DependsOn": [ - "greeterloadbalancergreeterlistenergreeterGroupFFBFF0C2", - "greeterloadbalancergreeterlistener952E028B" - ] - }, - "greeterserviceCloudmapServiceEE292978": { - "Type": "AWS::ServiceDiscovery::Service", - "Properties": { - "DnsConfig": { - "DnsRecords": [ - { - "TTL": 10, - "Type": "A" - } - ], - "NamespaceId": { - "Fn::GetAtt": [ - "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D", - "Id" - ] - }, - "RoutingPolicy": "MULTIVALUE" - }, - "HealthCheckCustomConfig": { - "FailureThreshold": 2 - }, - "Name": "greeter", - "NamespaceId": { - "Fn::GetAtt": [ - "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D", - "Id" - ] - } - } - }, - "greeterserviceSecurityGroupDB4AC3A9": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "aws-ecs-integ/greeter-service/SecurityGroup", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "greeterserviceSecurityGroupfromawsecsinteggreeterloadbalancerSecurityGroupF791FA838037FDF8F5": { - "Type": "AWS::EC2::SecurityGroupIngress", - "Properties": { - "IpProtocol": "tcp", - "Description": "Load balancer to target", - "FromPort": 80, - "GroupId": { - "Fn::GetAtt": [ - "greeterserviceSecurityGroupDB4AC3A9", - "GroupId" - ] - }, - "SourceSecurityGroupId": { - "Fn::GetAtt": [ - "greeterloadbalancerSecurityGroupEE1B20F3", - "GroupId" - ] - }, - "ToPort": 80 - } - }, - "greeterserviceTaskCountTargetAB95B3D0": { - "Type": "AWS::ApplicationAutoScaling::ScalableTarget", - "Properties": { - "MaxCapacity": 8, - "MinCapacity": 2, - "ResourceId": { - "Fn::Join": [ - "", - [ - "service/", - { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "/", - { - "Fn::GetAtt": [ - "greeterserviceService8EDD3244", - "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" - } - }, - "greeterserviceTaskCountTargetgreetertargetcpuutilization50299508D1": { - "Type": "AWS::ApplicationAutoScaling::ScalingPolicy", - "Properties": { - "PolicyName": "awsecsinteggreeterserviceTaskCountTargetgreetertargetcpuutilization50A75D0C0D", - "PolicyType": "TargetTrackingScaling", - "ScalingTargetId": { - "Ref": "greeterserviceTaskCountTargetAB95B3D0" - }, - "TargetTrackingScalingPolicyConfiguration": { - "PredefinedMetricSpecification": { - "PredefinedMetricType": "ECSServiceAverageCPUUtilization" - }, - "ScaleInCooldown": 60, - "ScaleOutCooldown": 60, - "TargetValue": 50 - } - } - }, - "greetervirtualnode21EA7CC9": { - "Type": "AWS::AppMesh::VirtualNode", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "Spec": { - "Backends": [ - { - "VirtualService": { - "VirtualServiceName": "name.production" - } - }, - { - "VirtualService": { - "VirtualServiceName": "greeting.production" - } - } - ], - "Listeners": [ - { - "PortMapping": { - "Port": 80, - "Protocol": "http" - } - } - ], - "ServiceDiscovery": { - "AWSCloudMap": { - "NamespaceName": "production", - "ServiceName": { - "Fn::GetAtt": [ - "greeterserviceCloudmapServiceEE292978", - "Name" - ] - } - } - } - }, - "VirtualNodeName": "greeter" - } - }, - "greetervirtualrouter193840BB": { - "Type": "AWS::AppMesh::VirtualRouter", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "Spec": { - "Listeners": [ - { - "PortMapping": { - "Port": 80, - "Protocol": "http" - } - } - ] - }, - "VirtualRouterName": "greeter" - } - }, - "greetervirtualroutergreeterroute3EC6ACB0": { - "Type": "AWS::AppMesh::Route", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "Spec": { - "HttpRoute": { - "Action": { - "WeightedTargets": [ - { - "VirtualNode": { - "Fn::GetAtt": [ - "greetervirtualnode21EA7CC9", - "VirtualNodeName" - ] - }, - "Weight": 1 - } - ] - }, - "Match": { - "Prefix": "/" - } - } - }, - "VirtualRouterName": { - "Fn::GetAtt": [ - "greetervirtualrouter193840BB", - "VirtualRouterName" - ] - }, - "RouteName": "greeter-route" - } - }, - "greetervirtualservice6559950C": { - "Type": "AWS::AppMesh::VirtualService", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "mymeshEA67EDEF", - "MeshName" - ] - }, - "Spec": { - "Provider": { - "VirtualRouter": { - "VirtualRouterName": { - "Fn::GetAtt": [ - "greetervirtualrouter193840BB", - "VirtualRouterName" - ] - } - } - } - }, - "VirtualServiceName": "greeter.production" - } - } - }, - "Mappings": { - "nameenvoyimageaccountmapping": { - "ap-northeast-1": { - "ecrRepo": "840364872350" - }, - "ap-northeast-2": { - "ecrRepo": "840364872350" - }, - "ap-south-1": { - "ecrRepo": "840364872350" - }, - "ap-southeast-1": { - "ecrRepo": "840364872350" - }, - "ap-southeast-2": { - "ecrRepo": "840364872350" - }, - "ca-central-1": { - "ecrRepo": "840364872350" - }, - "cn-north-1": { - "ecrRepo": "919366029133" - }, - "cn-northwest-1": { - "ecrRepo": "919830735681" - }, - "eu-central-1": { - "ecrRepo": "840364872350" - }, - "eu-north-1": { - "ecrRepo": "840364872350" - }, - "eu-south-1": { - "ecrRepo": "422531588944" - }, - "eu-west-1": { - "ecrRepo": "840364872350" - }, - "eu-west-2": { - "ecrRepo": "840364872350" - }, - "eu-west-3": { - "ecrRepo": "840364872350" - }, - "sa-east-1": { - "ecrRepo": "840364872350" - }, - "us-east-1": { - "ecrRepo": "840364872350" - }, - "us-east-2": { - "ecrRepo": "840364872350" - }, - "us-west-1": { - "ecrRepo": "840364872350" - }, - "us-west-2": { - "ecrRepo": "840364872350" - }, - "me-south-1": { - "ecrRepo": "772975370895" - }, - "ap-east-1": { - "ecrRepo": "856666278305" - }, - "af-south-1": { - "ecrRepo": "924023996002" - } - }, - "greetingenvoyimageaccountmapping": { - "ap-northeast-1": { - "ecrRepo": "840364872350" - }, - "ap-northeast-2": { - "ecrRepo": "840364872350" - }, - "ap-south-1": { - "ecrRepo": "840364872350" - }, - "ap-southeast-1": { - "ecrRepo": "840364872350" - }, - "ap-southeast-2": { - "ecrRepo": "840364872350" - }, - "ca-central-1": { - "ecrRepo": "840364872350" - }, - "cn-north-1": { - "ecrRepo": "919366029133" - }, - "cn-northwest-1": { - "ecrRepo": "919830735681" - }, - "eu-central-1": { - "ecrRepo": "840364872350" - }, - "eu-north-1": { - "ecrRepo": "840364872350" - }, - "eu-south-1": { - "ecrRepo": "422531588944" - }, - "eu-west-1": { - "ecrRepo": "840364872350" - }, - "eu-west-2": { - "ecrRepo": "840364872350" - }, - "eu-west-3": { - "ecrRepo": "840364872350" - }, - "sa-east-1": { - "ecrRepo": "840364872350" - }, - "us-east-1": { - "ecrRepo": "840364872350" - }, - "us-east-2": { - "ecrRepo": "840364872350" - }, - "us-west-1": { - "ecrRepo": "840364872350" - }, - "us-west-2": { - "ecrRepo": "840364872350" - }, - "me-south-1": { - "ecrRepo": "772975370895" - }, - "ap-east-1": { - "ecrRepo": "856666278305" - }, - "af-south-1": { - "ecrRepo": "924023996002" - } - }, - "greeterenvoyimageaccountmapping": { - "ap-northeast-1": { - "ecrRepo": "840364872350" - }, - "ap-northeast-2": { - "ecrRepo": "840364872350" - }, - "ap-south-1": { - "ecrRepo": "840364872350" - }, - "ap-southeast-1": { - "ecrRepo": "840364872350" - }, - "ap-southeast-2": { - "ecrRepo": "840364872350" - }, - "ca-central-1": { - "ecrRepo": "840364872350" - }, - "cn-north-1": { - "ecrRepo": "919366029133" - }, - "cn-northwest-1": { - "ecrRepo": "919830735681" - }, - "eu-central-1": { - "ecrRepo": "840364872350" - }, - "eu-north-1": { - "ecrRepo": "840364872350" - }, - "eu-south-1": { - "ecrRepo": "422531588944" - }, - "eu-west-1": { - "ecrRepo": "840364872350" - }, - "eu-west-2": { - "ecrRepo": "840364872350" - }, - "eu-west-3": { - "ecrRepo": "840364872350" - }, - "sa-east-1": { - "ecrRepo": "840364872350" - }, - "us-east-1": { - "ecrRepo": "840364872350" - }, - "us-east-2": { - "ecrRepo": "840364872350" - }, - "us-west-1": { - "ecrRepo": "840364872350" - }, - "us-west-2": { - "ecrRepo": "840364872350" - }, - "me-south-1": { - "ecrRepo": "772975370895" - }, - "ap-east-1": { - "ecrRepo": "856666278305" - }, - "af-south-1": { - "ecrRepo": "924023996002" - } - } - }, - "Parameters": { - "SsmParameterValueawsserviceawsforfluentbitlatestC96584B6F00A464EAD1953AFF4B05118Parameter": { - "Type": "AWS::SSM::Parameter::Value", - "Default": "/aws/service/aws-for-fluent-bit/latest" - } - }, - "Outputs": { - "greeterloadbalancerdnsoutput": { - "Value": { - "Fn::GetAtt": [ - "greeterloadbalancer85256741", - "DNSName" - ] - } - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.all-service-addons.ts b/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.all-service-addons.ts deleted file mode 100644 index 7241ff0dd8ef1..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.all-service-addons.ts +++ /dev/null @@ -1,100 +0,0 @@ -import { Mesh } from '@aws-cdk/aws-appmesh'; -import { ContainerImage } from '@aws-cdk/aws-ecs'; -import { App, Stack } from '@aws-cdk/core'; -import { AppMeshExtension, CloudwatchAgentExtension, Container, Environment, FireLensExtension, HttpLoadBalancerExtension, ScaleOnCpuUtilization, Service, ServiceDescription, XRayExtension } from '../lib'; - -const app = new App(); -const stack = new Stack(app, 'aws-ecs-integ'); - -const mesh = new Mesh(stack, 'my-mesh'); -const environment = new Environment(stack, 'production'); - -/** Name service */ -const nameDescription = new ServiceDescription(); -nameDescription.add(new Container({ - cpu: 1024, - memoryMiB: 2048, - trafficPort: 80, - image: ContainerImage.fromRegistry('nathanpeck/name'), - environment: { - PORT: '80', - }, -})); -nameDescription.add(new AppMeshExtension({ mesh })); -nameDescription.add(new FireLensExtension()); -nameDescription.add(new XRayExtension()); -nameDescription.add(new CloudwatchAgentExtension()); -nameDescription.add(new ScaleOnCpuUtilization({ - initialTaskCount: 2, - minTaskCount: 2, -})); - -const nameService = new Service(stack, 'name', { - environment: environment, - serviceDescription: nameDescription, -}); - -/** Greeting service */ -const greetingDescription = new ServiceDescription(); -greetingDescription.add(new Container({ - cpu: 1024, - memoryMiB: 2048, - trafficPort: 80, - image: ContainerImage.fromRegistry('nathanpeck/greeting'), - environment: { - PORT: '80', - }, -})); -greetingDescription.add(new AppMeshExtension({ mesh })); -greetingDescription.add(new FireLensExtension()); -greetingDescription.add(new XRayExtension()); -greetingDescription.add(new CloudwatchAgentExtension()); -greetingDescription.add(new ScaleOnCpuUtilization({ - initialTaskCount: 2, - minTaskCount: 2, -})); - -const greetingService = new Service(stack, 'greeting', { - environment: environment, - serviceDescription: greetingDescription, -}); - -/** Greeter service */ -const greeterDescription = new ServiceDescription(); -greeterDescription.add(new Container({ - cpu: 1024, - memoryMiB: 2048, - trafficPort: 80, - image: ContainerImage.fromRegistry('nathanpeck/greeter'), - environment: { - PORT: '80', - GREETING_URL: 'http://greeting.production', - NAME_URL: 'http://name.production', - }, -})); -greeterDescription.add(new AppMeshExtension({ mesh })); -greeterDescription.add(new FireLensExtension()); -greeterDescription.add(new XRayExtension()); -greeterDescription.add(new CloudwatchAgentExtension()); -greeterDescription.add(new HttpLoadBalancerExtension()); -greeterDescription.add(new ScaleOnCpuUtilization({ - initialTaskCount: 2, - minTaskCount: 2, -})); - -const greeterService = new Service(stack, 'greeter', { - environment: environment, - serviceDescription: greeterDescription, -}); - -greeterService.connectTo(nameService); -greeterService.connectTo(greetingService); - -/** - * Expectations are that you should see an output - * of the load balancer URL for the greeter service, make - * a request to it and see a greeting phrase constructed out - * of a random greeting and a random name from the two underlying - * services. The other addons enable tracing and logging which must - * be verified separately. - */ \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.assign-public-ip.expected.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.assign-public-ip.expected.json deleted file mode 100644 index 3b3093ff42fdb..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.assign-public-ip.expected.json +++ /dev/null @@ -1,1400 +0,0 @@ -{ - "Resources": { - "vpcA2121C38": { - "Type": "AWS::EC2::VPC", - "Properties": { - "CidrBlock": "10.0.0.0/16", - "EnableDnsHostnames": true, - "EnableDnsSupport": true, - "InstanceTenancy": "default", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/vpc" - } - ] - } - }, - "vpcpublicSubnet1SubnetA635257E": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.0.0/24", - "VpcId": { - "Ref": "vpcA2121C38" - }, - "AvailabilityZone": "test-region-1a", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/vpc/publicSubnet1" - } - ] - } - }, - "vpcpublicSubnet1RouteTableA38152FE": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "vpcA2121C38" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/vpc/publicSubnet1" - } - ] - } - }, - "vpcpublicSubnet1RouteTableAssociationB46101B8": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "vpcpublicSubnet1RouteTableA38152FE" - }, - "SubnetId": { - "Ref": "vpcpublicSubnet1SubnetA635257E" - } - } - }, - "vpcpublicSubnet1DefaultRouteF0973989": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "vpcpublicSubnet1RouteTableA38152FE" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "vpcIGWE57CBDCA" - } - }, - "DependsOn": [ - "vpcVPCGW7984C166" - ] - }, - "vpcpublicSubnet2Subnet027D165B": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.1.0/24", - "VpcId": { - "Ref": "vpcA2121C38" - }, - "AvailabilityZone": "test-region-1b", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/vpc/publicSubnet2" - } - ] - } - }, - "vpcpublicSubnet2RouteTableA6135437": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "vpcA2121C38" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/vpc/publicSubnet2" - } - ] - } - }, - "vpcpublicSubnet2RouteTableAssociation73F6478A": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "vpcpublicSubnet2RouteTableA6135437" - }, - "SubnetId": { - "Ref": "vpcpublicSubnet2Subnet027D165B" - } - } - }, - "vpcpublicSubnet2DefaultRoute13685A07": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "vpcpublicSubnet2RouteTableA6135437" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "vpcIGWE57CBDCA" - } - }, - "DependsOn": [ - "vpcVPCGW7984C166" - ] - }, - "vpcpublicSubnet3Subnet3B90E684": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.2.0/24", - "VpcId": { - "Ref": "vpcA2121C38" - }, - "AvailabilityZone": "test-region-1c", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/vpc/publicSubnet3" - } - ] - } - }, - "vpcpublicSubnet3RouteTable901FAA39": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "vpcA2121C38" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/vpc/publicSubnet3" - } - ] - } - }, - "vpcpublicSubnet3RouteTableAssociationF6210B68": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "vpcpublicSubnet3RouteTable901FAA39" - }, - "SubnetId": { - "Ref": "vpcpublicSubnet3Subnet3B90E684" - } - } - }, - "vpcpublicSubnet3DefaultRoute02D8E508": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "vpcpublicSubnet3RouteTable901FAA39" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "vpcIGWE57CBDCA" - } - }, - "DependsOn": [ - "vpcVPCGW7984C166" - ] - }, - "vpcIGWE57CBDCA": { - "Type": "AWS::EC2::InternetGateway", - "Properties": { - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/vpc" - } - ] - } - }, - "vpcVPCGW7984C166": { - "Type": "AWS::EC2::VPCGatewayAttachment", - "Properties": { - "VpcId": { - "Ref": "vpcA2121C38" - }, - "InternetGatewayId": { - "Ref": "vpcIGWE57CBDCA" - } - } - }, - "zoneEB40FF1E": { - "Type": "AWS::Route53::HostedZone", - "Properties": { - "Name": "myexample.com." - } - }, - "laterRecordD393EDE6": { - "Type": "AWS::Route53::RecordSet", - "Properties": { - "Name": "u-record.myexample.com.", - "Type": "CNAME", - "HostedZoneId": { - "Ref": "zoneEB40FF1E" - }, - "ResourceRecords": [ - "console.aws.amazon.com" - ], - "TTL": "1800" - } - }, - "productionenvironmentclusterC6599D2D": { - "Type": "AWS::ECS::Cluster" - }, - "nametaskdefinitionTaskRole50FE844E": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - }, - "DependsOn": [ - "nameserviceTaskRecordManagerCleanupE19F1043", - "nameserviceTaskRecordManagerRuleRunningCD85F46F", - "nameserviceTaskRecordManagerRuleStopped66D08B70" - ] - }, - "nametaskdefinition690762BB": { - "Type": "AWS::ECS::TaskDefinition", - "Properties": { - "ContainerDefinitions": [ - { - "Cpu": 256, - "Environment": [ - { - "Name": "PORT", - "Value": "80" - } - ], - "Essential": true, - "Image": "nathanpeck/name", - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "namelogsF4B17D31" - }, - "awslogs-stream-prefix": "name", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "Memory": 512, - "Name": "app", - "PortMappings": [ - { - "ContainerPort": 80, - "Protocol": "tcp" - } - ], - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ] - } - ], - "Cpu": "256", - "ExecutionRoleArn": { - "Fn::GetAtt": [ - "nametaskdefinitionExecutionRole45AC5C9A", - "Arn" - ] - }, - "Family": "awsecsintegnametaskdefinition0EA6A1A0", - "Memory": "512", - "NetworkMode": "awsvpc", - "RequiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "TaskRoleArn": { - "Fn::GetAtt": [ - "nametaskdefinitionTaskRole50FE844E", - "Arn" - ] - } - }, - "DependsOn": [ - "nameserviceTaskRecordManagerCleanupE19F1043", - "nameserviceTaskRecordManagerRuleRunningCD85F46F", - "nameserviceTaskRecordManagerRuleStopped66D08B70" - ] - }, - "nametaskdefinitionExecutionRole45AC5C9A": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - }, - "DependsOn": [ - "nameserviceTaskRecordManagerCleanupE19F1043", - "nameserviceTaskRecordManagerRuleRunningCD85F46F", - "nameserviceTaskRecordManagerRuleStopped66D08B70" - ] - }, - "nametaskdefinitionExecutionRoleDefaultPolicyF7942D20": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "namelogsF4B17D31", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "nametaskdefinitionExecutionRoleDefaultPolicyF7942D20", - "Roles": [ - { - "Ref": "nametaskdefinitionExecutionRole45AC5C9A" - } - ] - }, - "DependsOn": [ - "nameserviceTaskRecordManagerCleanupE19F1043", - "nameserviceTaskRecordManagerRuleRunningCD85F46F", - "nameserviceTaskRecordManagerRuleStopped66D08B70" - ] - }, - "namelogsF4B17D31": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "name-logs", - "RetentionInDays": 30 - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "nameserviceService8015C8D6": { - "Type": "AWS::ECS::Service", - "Properties": { - "Cluster": { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "DeploymentConfiguration": { - "MaximumPercent": 200, - "MinimumHealthyPercent": 100 - }, - "DesiredCount": 1, - "EnableECSManagedTags": false, - "LaunchType": "FARGATE", - "NetworkConfiguration": { - "AwsvpcConfiguration": { - "AssignPublicIp": "ENABLED", - "SecurityGroups": [ - { - "Fn::GetAtt": [ - "nameserviceSecurityGroup33F4662C", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Ref": "vpcpublicSubnet1SubnetA635257E" - }, - { - "Ref": "vpcpublicSubnet2Subnet027D165B" - }, - { - "Ref": "vpcpublicSubnet3Subnet3B90E684" - } - ] - } - }, - "TaskDefinition": { - "Ref": "nametaskdefinition690762BB" - } - } - }, - "nameserviceSecurityGroup33F4662C": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "aws-ecs-integ/name-service/SecurityGroup", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "SecurityGroupIngress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Accept inbound traffic on traffic port from anywhere", - "FromPort": 80, - "IpProtocol": "tcp", - "ToPort": 80 - } - ], - "VpcId": { - "Ref": "vpcA2121C38" - } - } - }, - "nameserviceTaskRecordManagerEventsDLB8F13E1E": { - "Type": "AWS::SQS::Queue", - "Properties": { - "MessageRetentionPeriod": 1209600 - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "nameserviceTaskRecordManagerEventsQueueF805A6C1": { - "Type": "AWS::SQS::Queue", - "Properties": { - "RedrivePolicy": { - "deadLetterTargetArn": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerEventsDLB8F13E1E", - "Arn" - ] - }, - "maxReceiveCount": 500 - }, - "VisibilityTimeout": 30 - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "nameserviceTaskRecordManagerEventsQueuePolicy65CC6F9E": { - "Type": "AWS::SQS::QueuePolicy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "sqs:GetQueueAttributes", - "sqs:GetQueueUrl", - "sqs:SendMessage" - ], - "Condition": { - "ArnEquals": { - "aws:SourceArn": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerRuleRunningCD85F46F", - "Arn" - ] - } - } - }, - "Effect": "Allow", - "Principal": { - "Service": "events.amazonaws.com" - }, - "Resource": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerEventsQueueF805A6C1", - "Arn" - ] - } - }, - { - "Action": [ - "sqs:GetQueueAttributes", - "sqs:GetQueueUrl", - "sqs:SendMessage" - ], - "Condition": { - "ArnEquals": { - "aws:SourceArn": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerRuleStopped66D08B70", - "Arn" - ] - } - } - }, - "Effect": "Allow", - "Principal": { - "Service": "events.amazonaws.com" - }, - "Resource": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerEventsQueueF805A6C1", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "Queues": [ - { - "Ref": "nameserviceTaskRecordManagerEventsQueueF805A6C1" - } - ] - } - }, - "nameserviceTaskRecordManagerRecordsA4648C6E": { - "Type": "AWS::DynamoDB::Table", - "Properties": { - "KeySchema": [ - { - "AttributeName": "cluster_service", - "KeyType": "HASH" - } - ], - "AttributeDefinitions": [ - { - "AttributeName": "cluster_service", - "AttributeType": "S" - } - ], - "BillingMode": "PAY_PER_REQUEST" - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "nameserviceTaskRecordManagerRuleRunningCD85F46F": { - "Type": "AWS::Events::Rule", - "Properties": { - "EventPattern": { - "source": [ - "aws.ecs" - ], - "detail-type": [ - "ECS Task State Change" - ], - "detail": { - "clusterArn": [ - { - "Fn::GetAtt": [ - "productionenvironmentclusterC6599D2D", - "Arn" - ] - } - ], - "lastStatus": [ - "RUNNING" - ], - "desiredStatus": [ - "RUNNING" - ] - } - }, - "State": "ENABLED", - "Targets": [ - { - "Arn": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerEventsQueueF805A6C1", - "Arn" - ] - }, - "Id": "Target0" - } - ] - } - }, - "nameserviceTaskRecordManagerRuleStopped66D08B70": { - "Type": "AWS::Events::Rule", - "Properties": { - "EventPattern": { - "source": [ - "aws.ecs" - ], - "detail-type": [ - "ECS Task State Change" - ], - "detail": { - "clusterArn": [ - { - "Fn::GetAtt": [ - "productionenvironmentclusterC6599D2D", - "Arn" - ] - } - ], - "lastStatus": [ - "STOPPED" - ], - "desiredStatus": [ - "STOPPED" - ] - } - }, - "State": "ENABLED", - "Targets": [ - { - "Arn": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerEventsQueueF805A6C1", - "Arn" - ] - }, - "Id": "Target0" - } - ] - } - }, - "nameserviceTaskRecordManagerEventHandlerServiceRoleE66EE52A": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - ] - ] - } - ] - } - }, - "nameserviceTaskRecordManagerEventHandlerServiceRoleDefaultPolicy96DD8140": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "ec2:DescribeNetworkInterfaces", - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": [ - "route53:ChangeResourceRecordSets", - "route53:ListResourceRecordSets" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":route53:::hostedzone/", - { - "Ref": "zoneEB40FF1E" - } - ] - ] - } - }, - { - "Action": [ - "sqs:ChangeMessageVisibility", - "sqs:DeleteMessage", - "sqs:GetQueueAttributes", - "sqs:GetQueueUrl", - "sqs:ReceiveMessage" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerEventsQueueF805A6C1", - "Arn" - ] - } - }, - { - "Action": [ - "dynamodb:BatchGetItem", - "dynamodb:BatchWriteItem", - "dynamodb:ConditionCheckItem", - "dynamodb:DeleteItem", - "dynamodb:DescribeTable", - "dynamodb:GetItem", - "dynamodb:GetRecords", - "dynamodb:GetShardIterator", - "dynamodb:PutItem", - "dynamodb:Query", - "dynamodb:Scan", - "dynamodb:UpdateItem" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerRecordsA4648C6E", - "Arn" - ] - }, - { - "Ref": "AWS::NoValue" - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "nameserviceTaskRecordManagerEventHandlerServiceRoleDefaultPolicy96DD8140", - "Roles": [ - { - "Ref": "nameserviceTaskRecordManagerEventHandlerServiceRoleE66EE52A" - } - ] - } - }, - "nameserviceTaskRecordManagerEventHandler4B8C6905": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Ref": "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dS3Bucket1E7F92B6" - }, - "S3Key": { - "Fn::Join": [ - "", - [ - { - "Fn::Select": [ - 0, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dS3VersionKey86FCA825" - } - ] - } - ] - }, - { - "Fn::Select": [ - 1, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dS3VersionKey86FCA825" - } - ] - } - ] - } - ] - ] - } - }, - "Role": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerEventHandlerServiceRoleE66EE52A", - "Arn" - ] - }, - "Environment": { - "Variables": { - "HOSTED_ZONE_ID": { - "Ref": "zoneEB40FF1E" - }, - "RECORD_NAME": "test-record.myexample.com", - "RECORDS_TABLE": { - "Ref": "nameserviceTaskRecordManagerRecordsA4648C6E" - }, - "CLUSTER_ARN": { - "Fn::GetAtt": [ - "productionenvironmentclusterC6599D2D", - "Arn" - ] - }, - "SERVICE_NAME": { - "Fn::GetAtt": [ - "nameserviceService8015C8D6", - "Name" - ] - } - } - }, - "Handler": "index.queue_handler", - "ReservedConcurrentExecutions": 1, - "Runtime": "python3.8", - "Timeout": 30 - }, - "DependsOn": [ - "nameserviceTaskRecordManagerEventHandlerServiceRoleDefaultPolicy96DD8140", - "nameserviceTaskRecordManagerEventHandlerServiceRoleE66EE52A" - ] - }, - "nameserviceTaskRecordManagerEventHandlerSqsEventSourceawsecsintegnameserviceTaskRecordManagerEventsQueueC5EE9A869F1EB155": { - "Type": "AWS::Lambda::EventSourceMapping", - "Properties": { - "FunctionName": { - "Ref": "nameserviceTaskRecordManagerEventHandler4B8C6905" - }, - "EventSourceArn": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerEventsQueueF805A6C1", - "Arn" - ] - } - } - }, - "nameserviceTaskRecordManagerCleanupResourceProviderHandlerServiceRoleCCA462F0": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - ] - ] - } - ] - } - }, - "nameserviceTaskRecordManagerCleanupResourceProviderHandlerServiceRoleDefaultPolicy7D095576": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "route53:ChangeResourceRecordSets", - "route53:ListResourceRecordSets" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":route53:::hostedzone/", - { - "Ref": "zoneEB40FF1E" - } - ] - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "nameserviceTaskRecordManagerCleanupResourceProviderHandlerServiceRoleDefaultPolicy7D095576", - "Roles": [ - { - "Ref": "nameserviceTaskRecordManagerCleanupResourceProviderHandlerServiceRoleCCA462F0" - } - ] - } - }, - "nameserviceTaskRecordManagerCleanupResourceProviderHandler08068F99": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Ref": "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dS3Bucket1E7F92B6" - }, - "S3Key": { - "Fn::Join": [ - "", - [ - { - "Fn::Select": [ - 0, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dS3VersionKey86FCA825" - } - ] - } - ] - }, - { - "Fn::Select": [ - 1, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dS3VersionKey86FCA825" - } - ] - } - ] - } - ] - ] - } - }, - "Role": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerCleanupResourceProviderHandlerServiceRoleCCA462F0", - "Arn" - ] - }, - "Handler": "index.cleanup_resource_handler", - "Runtime": "python3.8", - "Timeout": 300 - }, - "DependsOn": [ - "nameserviceTaskRecordManagerCleanupResourceProviderHandlerServiceRoleDefaultPolicy7D095576", - "nameserviceTaskRecordManagerCleanupResourceProviderHandlerServiceRoleCCA462F0" - ] - }, - "nameserviceTaskRecordManagerCleanupResourceProviderframeworkonEventServiceRoleF0570BD0": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - ] - ] - } - ] - } - }, - "nameserviceTaskRecordManagerCleanupResourceProviderframeworkonEventServiceRoleDefaultPolicy350D6FAC": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "lambda:InvokeFunction", - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerCleanupResourceProviderHandler08068F99", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerCleanupResourceProviderHandler08068F99", - "Arn" - ] - }, - ":*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "nameserviceTaskRecordManagerCleanupResourceProviderframeworkonEventServiceRoleDefaultPolicy350D6FAC", - "Roles": [ - { - "Ref": "nameserviceTaskRecordManagerCleanupResourceProviderframeworkonEventServiceRoleF0570BD0" - } - ] - } - }, - "nameserviceTaskRecordManagerCleanupResourceProviderframeworkonEvent9B27C899": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Ref": "AssetParameters5b47c8e4cbbce7e4a8085f1aa83ed9c4691b7f65927ba092d6620bbba925f391S3BucketB4102E9A" - }, - "S3Key": { - "Fn::Join": [ - "", - [ - { - "Fn::Select": [ - 0, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameters5b47c8e4cbbce7e4a8085f1aa83ed9c4691b7f65927ba092d6620bbba925f391S3VersionKeyC1EC3ED6" - } - ] - } - ] - }, - { - "Fn::Select": [ - 1, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameters5b47c8e4cbbce7e4a8085f1aa83ed9c4691b7f65927ba092d6620bbba925f391S3VersionKeyC1EC3ED6" - } - ] - } - ] - } - ] - ] - } - }, - "Role": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerCleanupResourceProviderframeworkonEventServiceRoleF0570BD0", - "Arn" - ] - }, - "Description": "AWS CDK resource provider framework - onEvent (aws-ecs-integ/name-service/TaskRecordManager/CleanupResourceProvider)", - "Environment": { - "Variables": { - "USER_ON_EVENT_FUNCTION_ARN": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerCleanupResourceProviderHandler08068F99", - "Arn" - ] - } - } - }, - "Handler": "framework.onEvent", - "Runtime": "nodejs14.x", - "Timeout": 900 - }, - "DependsOn": [ - "nameserviceTaskRecordManagerCleanupResourceProviderframeworkonEventServiceRoleDefaultPolicy350D6FAC", - "nameserviceTaskRecordManagerCleanupResourceProviderframeworkonEventServiceRoleF0570BD0" - ] - }, - "nameserviceTaskRecordManagerCleanupE19F1043": { - "Type": "AWS::CloudFormation::CustomResource", - "Properties": { - "ServiceToken": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerCleanupResourceProviderframeworkonEvent9B27C899", - "Arn" - ] - }, - "HostedZoneId": { - "Ref": "zoneEB40FF1E" - }, - "RecordName": "test-record.myexample.com" - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "nameserviceTaskRecordManagerPrimingCallCustomResourcePolicy376F02F0": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "sqs:SendMessage", - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "nameserviceTaskRecordManagerEventsQueueF805A6C1", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "nameserviceTaskRecordManagerPrimingCallCustomResourcePolicy376F02F0", - "Roles": [ - { - "Ref": "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2" - } - ] - }, - "DependsOn": [ - "nameserviceTaskRecordManagerEventHandler4B8C6905", - "nameserviceTaskRecordManagerEventHandlerServiceRoleDefaultPolicy96DD8140", - "nameserviceTaskRecordManagerEventHandlerServiceRoleE66EE52A", - "nameserviceTaskRecordManagerEventHandlerSqsEventSourceawsecsintegnameserviceTaskRecordManagerEventsQueueC5EE9A869F1EB155" - ] - }, - "nameserviceTaskRecordManagerPrimingCallE6113369": { - "Type": "Custom::AWS", - "Properties": { - "ServiceToken": { - "Fn::GetAtt": [ - "AWS679f53fac002430cb0da5b7982bd22872D164C4C", - "Arn" - ] - }, - "Create": { - "Fn::Join": [ - "", - [ - "{\"service\":\"SQS\",\"action\":\"sendMessage\",\"parameters\":{\"QueueUrl\":\"", - { - "Ref": "nameserviceTaskRecordManagerEventsQueueF805A6C1" - }, - "\",\"DelaySeconds\":10,\"MessageBody\":\"{ \\\"prime\\\": true }\",\"MessageAttributes\":{\"HostedZoneId\":{\"DataType\":\"String\",\"StringValue\":\"", - { - "Ref": "zoneEB40FF1E" - }, - "\"},\"RecordName\":{\"DataType\":\"String\",\"StringValue\":\"test-record\"}}},\"physicalResourceId\":{\"responsePath\":\"MessageId\"}}" - ] - ] - }, - "Update": { - "Fn::Join": [ - "", - [ - "{\"service\":\"SQS\",\"action\":\"sendMessage\",\"parameters\":{\"QueueUrl\":\"", - { - "Ref": "nameserviceTaskRecordManagerEventsQueueF805A6C1" - }, - "\",\"DelaySeconds\":10,\"MessageBody\":\"{ \\\"prime\\\": true }\",\"MessageAttributes\":{\"HostedZoneId\":{\"DataType\":\"String\",\"StringValue\":\"", - { - "Ref": "zoneEB40FF1E" - }, - "\"},\"RecordName\":{\"DataType\":\"String\",\"StringValue\":\"test-record\"}}},\"physicalResourceId\":{\"responsePath\":\"MessageId\"}}" - ] - ] - }, - "InstallLatestAwsSdk": true - }, - "DependsOn": [ - "nameserviceTaskRecordManagerEventHandler4B8C6905", - "nameserviceTaskRecordManagerEventHandlerServiceRoleDefaultPolicy96DD8140", - "nameserviceTaskRecordManagerEventHandlerServiceRoleE66EE52A", - "nameserviceTaskRecordManagerEventHandlerSqsEventSourceawsecsintegnameserviceTaskRecordManagerEventsQueueC5EE9A869F1EB155", - "nameserviceTaskRecordManagerPrimingCallCustomResourcePolicy376F02F0" - ], - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - ] - ] - } - ] - } - }, - "AWS679f53fac002430cb0da5b7982bd22872D164C4C": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Ref": "AssetParameters3744fa896361f81b76b1efde632ac07b1920ce09a4ca1ff15ab486f262a19b87S3Bucket36F31A16" - }, - "S3Key": { - "Fn::Join": [ - "", - [ - { - "Fn::Select": [ - 0, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameters3744fa896361f81b76b1efde632ac07b1920ce09a4ca1ff15ab486f262a19b87S3VersionKeyF80D542B" - } - ] - } - ] - }, - { - "Fn::Select": [ - 1, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameters3744fa896361f81b76b1efde632ac07b1920ce09a4ca1ff15ab486f262a19b87S3VersionKeyF80D542B" - } - ] - } - ] - } - ] - ] - } - }, - "Role": { - "Fn::GetAtt": [ - "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2", - "Arn" - ] - }, - "Handler": "index.handler", - "Runtime": "nodejs14.x", - "Timeout": 120 - }, - "DependsOn": [ - "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2" - ] - } - }, - "Parameters": { - "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dS3Bucket1E7F92B6": { - "Type": "String", - "Description": "S3 bucket for asset \"8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d\"" - }, - "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dS3VersionKey86FCA825": { - "Type": "String", - "Description": "S3 key for asset version \"8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d\"" - }, - "AssetParameters8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725dArtifactHash0F81F2AB": { - "Type": "String", - "Description": "Artifact hash for asset \"8f06a3db22794ebc7ff89b4745fd706afd46e17816fe46da72e5125cabae725d\"" - }, - "AssetParameters5b47c8e4cbbce7e4a8085f1aa83ed9c4691b7f65927ba092d6620bbba925f391S3BucketB4102E9A": { - "Type": "String", - "Description": "S3 bucket for asset \"5b47c8e4cbbce7e4a8085f1aa83ed9c4691b7f65927ba092d6620bbba925f391\"" - }, - "AssetParameters5b47c8e4cbbce7e4a8085f1aa83ed9c4691b7f65927ba092d6620bbba925f391S3VersionKeyC1EC3ED6": { - "Type": "String", - "Description": "S3 key for asset version \"5b47c8e4cbbce7e4a8085f1aa83ed9c4691b7f65927ba092d6620bbba925f391\"" - }, - "AssetParameters5b47c8e4cbbce7e4a8085f1aa83ed9c4691b7f65927ba092d6620bbba925f391ArtifactHashA391D940": { - "Type": "String", - "Description": "Artifact hash for asset \"5b47c8e4cbbce7e4a8085f1aa83ed9c4691b7f65927ba092d6620bbba925f391\"" - }, - "AssetParameters3744fa896361f81b76b1efde632ac07b1920ce09a4ca1ff15ab486f262a19b87S3Bucket36F31A16": { - "Type": "String", - "Description": "S3 bucket for asset \"3744fa896361f81b76b1efde632ac07b1920ce09a4ca1ff15ab486f262a19b87\"" - }, - "AssetParameters3744fa896361f81b76b1efde632ac07b1920ce09a4ca1ff15ab486f262a19b87S3VersionKeyF80D542B": { - "Type": "String", - "Description": "S3 key for asset version \"3744fa896361f81b76b1efde632ac07b1920ce09a4ca1ff15ab486f262a19b87\"" - }, - "AssetParameters3744fa896361f81b76b1efde632ac07b1920ce09a4ca1ff15ab486f262a19b87ArtifactHash40DDF5EE": { - "Type": "String", - "Description": "Artifact hash for asset \"3744fa896361f81b76b1efde632ac07b1920ce09a4ca1ff15ab486f262a19b87\"" - } - }, - "Outputs": { - "DnsName": { - "Value": "test-record.myexample.com" - }, - "DnsServer": { - "Value": { - "Fn::Select": [ - 0, - { - "Fn::GetAtt": [ - "zoneEB40FF1E", - "NameServers" - ] - } - ] - } - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.assign-public-ip.ts b/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.assign-public-ip.ts deleted file mode 100644 index c7464cd28b671..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.assign-public-ip.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { SubnetType, Vpc } from '@aws-cdk/aws-ec2'; -import { ContainerImage } from '@aws-cdk/aws-ecs'; -import { CnameRecord, PublicHostedZone } from '@aws-cdk/aws-route53'; -import { App, CfnOutput, Fn, Stack } from '@aws-cdk/core'; -import { AssignPublicIpExtension, Container, Environment, Service, ServiceDescription } from '../lib'; - -// Record name. You can change this and redeploy this integration test to see -// what happens when the record name changes. -const RECORD_NAME = 'test-record'; - -const app = new App(); -const stack = new Stack(app, 'aws-ecs-integ'); - -const vpc = new Vpc(stack, 'vpc', { - subnetConfiguration: [ - { - cidrMask: 24, - name: 'public', - subnetType: SubnetType.PUBLIC, - }, - ], -}); - -const dnsZone = new PublicHostedZone(stack, 'zone', { - zoneName: 'myexample.com', -}); - -// A record in the zone that is lexicographically later than 'test-record' -// to try to trip up the record set locator. -new CnameRecord(stack, 'laterRecord', { - recordName: 'u-record', - zone: dnsZone, - domainName: 'console.aws.amazon.com', -}); - -const environment = new Environment(stack, 'production', { vpc }); - -const nameDescription = new ServiceDescription(); - -nameDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ContainerImage.fromRegistry('nathanpeck/name'), - environment: { - PORT: '80', - }, -})); - -nameDescription.add(new AssignPublicIpExtension({ - dns: { - zone: dnsZone, - recordName: RECORD_NAME, - }, -})); - -new Service(stack, 'name', { - environment: environment, - serviceDescription: nameDescription, -}); - -new CfnOutput(stack, 'DnsName', { - value: Fn.join('.', [RECORD_NAME, dnsZone.zoneName]), -}); - -new CfnOutput(stack, 'DnsServer', { - value: Fn.select(0, dnsZone.hostedZoneNameServers!), -}); - -/** - * Expect this stack to deploy. The stack outputs include a DNS name and a - * nameserver. A short time after the services have settled, you may query the - * nameserver for the record. If an IP address is shown, then this test has - * succeeded. - * - * Example: - * - * ``` - * $ cdk --app 'node ./integ.assign-public-ip.js' deploy - * ... - * Outputs: - * aws-ecs-integ.DnsName = test-record.myexample.com - * aws-ecs-integ.DnsServer = ns-1836.awsdns-37.co.uk - * ... - * - * $ host test-record.myexample.com ns-1836.awsdns-37.co.uk - * Using domain server: - * Name: ns-1836.awsdns-37.co.uk - * Address: 2600:9000:5307:2c00::1#53 - * Aliases: - * - * test-record.myexample.com has address 52.60.53.62 - * ``` - */ diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.custom-service-extension.expected.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.custom-service-extension.expected.json deleted file mode 100644 index af4f8829a1501..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.custom-service-extension.expected.json +++ /dev/null @@ -1,777 +0,0 @@ -{ - "Resources": { - "productionenvironmentvpcAEB47DF7": { - "Type": "AWS::EC2::VPC", - "Properties": { - "CidrBlock": "10.0.0.0/16", - "EnableDnsHostnames": true, - "EnableDnsSupport": true, - "InstanceTenancy": "default", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1Subnet8D92C089": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.0.0/19", - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "AvailabilityZone": "test-region-1a", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1RouteTableAssociationA8117374": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - } - } - }, - "productionenvironmentvpcPublicSubnet1DefaultRoute524C894D": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - }, - "DependsOn": [ - "productionenvironmentvpcVPCGW1B428D07" - ] - }, - "productionenvironmentvpcPublicSubnet1EIP54BA88DB": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1NATGateway6075E4CA": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - }, - "AllocationId": { - "Fn::GetAtt": [ - "productionenvironmentvpcPublicSubnet1EIP54BA88DB", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet2Subnet298E6C31": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.32.0/19", - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "AvailabilityZone": "test-region-1b", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet2RouteTable842A68D7": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet2RouteTableAssociation0A7549F3": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet2RouteTable842A68D7" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - } - } - }, - "productionenvironmentvpcPublicSubnet2DefaultRoute92CD697D": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet2RouteTable842A68D7" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - }, - "DependsOn": [ - "productionenvironmentvpcVPCGW1B428D07" - ] - }, - "productionenvironmentvpcPublicSubnet2EIP14CA46AA": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet2NATGatewayE1850FCC": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - }, - "AllocationId": { - "Fn::GetAtt": [ - "productionenvironmentvpcPublicSubnet2EIP14CA46AA", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet3SubnetC7B5665D": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.64.0/19", - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "AvailabilityZone": "test-region-1c", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet3" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet3RouteTable00E3BF60": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet3" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet3RouteTableAssociationFA34D6E7": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet3RouteTable00E3BF60" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet3SubnetC7B5665D" - } - } - }, - "productionenvironmentvpcPublicSubnet3DefaultRouteE1ADEA6C": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet3RouteTable00E3BF60" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - }, - "DependsOn": [ - "productionenvironmentvpcVPCGW1B428D07" - ] - }, - "productionenvironmentvpcPublicSubnet3EIP53405AED": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet3" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet3NATGateway94604057": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet3SubnetC7B5665D" - }, - "AllocationId": { - "Fn::GetAtt": [ - "productionenvironmentvpcPublicSubnet3EIP53405AED", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet3" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet1Subnet53F632E6": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.96.0/19", - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "AvailabilityZone": "test-region-1a", - "MapPublicIpOnLaunch": false, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Private" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Private" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet1RouteTableAssociation8BA32463": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - } - } - }, - "productionenvironmentvpcPrivateSubnet1DefaultRouteFBB3DE6C": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "productionenvironmentvpcPublicSubnet1NATGateway6075E4CA" - } - } - }, - "productionenvironmentvpcPrivateSubnet2Subnet756FB93C": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.128.0/19", - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "AvailabilityZone": "test-region-1b", - "MapPublicIpOnLaunch": false, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Private" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Private" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet2RouteTableAssociation09188261": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - } - }, - "productionenvironmentvpcPrivateSubnet2DefaultRoute5F9AB6C1": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "productionenvironmentvpcPublicSubnet2NATGatewayE1850FCC" - } - } - }, - "productionenvironmentvpcPrivateSubnet3Subnet3BD4064E": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.160.0/19", - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "AvailabilityZone": "test-region-1c", - "MapPublicIpOnLaunch": false, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Private" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Private" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet3" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet3RouteTable1A244D34": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet3" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet3RouteTableAssociation65F18B9C": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet3RouteTable1A244D34" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPrivateSubnet3Subnet3BD4064E" - } - } - }, - "productionenvironmentvpcPrivateSubnet3DefaultRoute2438918B": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet3RouteTable1A244D34" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "productionenvironmentvpcPublicSubnet3NATGateway94604057" - } - } - }, - "productionenvironmentvpcIGWE7C39890": { - "Type": "AWS::EC2::InternetGateway", - "Properties": { - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc" - } - ] - } - }, - "productionenvironmentvpcVPCGW1B428D07": { - "Type": "AWS::EC2::VPCGatewayAttachment", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "InternetGatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - } - }, - "productionenvironmentclusterC6599D2D": { - "Type": "AWS::ECS::Cluster" - }, - "nametaskdefinitionTaskRole50FE844E": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "nametaskdefinition690762BB": { - "Type": "AWS::ECS::TaskDefinition", - "Properties": { - "ContainerDefinitions": [ - { - "Cpu": 1024, - "Environment": [ - { - "Name": "PORT", - "Value": "80" - } - ], - "Essential": true, - "Image": "nathanpeck/name", - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "namelogsF4B17D31" - }, - "awslogs-stream-prefix": "name", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "Memory": 2048, - "Name": "app", - "PortMappings": [ - { - "ContainerPort": 80, - "Protocol": "tcp" - } - ], - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ] - } - ], - "Cpu": "1024", - "ExecutionRoleArn": { - "Fn::GetAtt": [ - "nametaskdefinitionExecutionRole45AC5C9A", - "Arn" - ] - }, - "Family": "awsecsintegnametaskdefinition0EA6A1A0", - "Memory": "2048", - "NetworkMode": "awsvpc", - "RequiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "TaskRoleArn": { - "Fn::GetAtt": [ - "nametaskdefinitionTaskRole50FE844E", - "Arn" - ] - } - } - }, - "nametaskdefinitionExecutionRole45AC5C9A": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "nametaskdefinitionExecutionRoleDefaultPolicyF7942D20": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "namelogsF4B17D31", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "nametaskdefinitionExecutionRoleDefaultPolicyF7942D20", - "Roles": [ - { - "Ref": "nametaskdefinitionExecutionRole45AC5C9A" - } - ] - } - }, - "namelogsF4B17D31": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "name-logs", - "RetentionInDays": 30 - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "nameserviceService8015C8D6": { - "Type": "AWS::ECS::Service", - "Properties": { - "Cluster": { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "DeploymentConfiguration": { - "MaximumPercent": 200, - "MinimumHealthyPercent": 100 - }, - "DesiredCount": 10, - "EnableECSManagedTags": false, - "LaunchType": "FARGATE", - "NetworkConfiguration": { - "AwsvpcConfiguration": { - "AssignPublicIp": "DISABLED", - "SecurityGroups": [ - { - "Fn::GetAtt": [ - "nameserviceSecurityGroup33F4662C", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - }, - { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - }, - { - "Ref": "productionenvironmentvpcPrivateSubnet3Subnet3BD4064E" - } - ] - } - }, - "TaskDefinition": { - "Ref": "nametaskdefinition690762BB" - } - } - }, - "nameserviceSecurityGroup33F4662C": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "aws-ecs-integ/name-service/SecurityGroup", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "nameserviceTaskCountTarget366C2B3A": { - "Type": "AWS::ApplicationAutoScaling::ScalableTarget", - "Properties": { - "MaxCapacity": 20, - "MinCapacity": 5, - "ResourceId": { - "Fn::Join": [ - "", - [ - "service/", - { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "/", - { - "Fn::GetAtt": [ - "nameserviceService8015C8D6", - "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" - } - }, - "nameserviceTaskCountTargetTargetCpuUtilization50E2840097": { - "Type": "AWS::ApplicationAutoScaling::ScalingPolicy", - "Properties": { - "PolicyName": "awsecsintegnameserviceTaskCountTargetTargetCpuUtilization508522EB56", - "PolicyType": "TargetTrackingScaling", - "ScalingTargetId": { - "Ref": "nameserviceTaskCountTarget366C2B3A" - }, - "TargetTrackingScalingPolicyConfiguration": { - "PredefinedMetricSpecification": { - "PredefinedMetricType": "ECSServiceAverageCPUUtilization" - }, - "ScaleInCooldown": 60, - "ScaleOutCooldown": 60, - "TargetValue": 50 - } - } - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.custom-service-extension.ts b/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.custom-service-extension.ts deleted file mode 100644 index a33e066841034..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.custom-service-extension.ts +++ /dev/null @@ -1,65 +0,0 @@ -import * as ecs from '@aws-cdk/aws-ecs'; -import * as cdk from '@aws-cdk/core'; -import { Container, Environment, Service, ServiceBuild, ServiceDescription, ServiceExtension } from '../lib'; - -class MyCustomAutoscaling extends ServiceExtension { - constructor() { - super('my-custom-autoscaling'); - } - - // This service modifies properties of the service prior - // to construct creation. - public modifyServiceProps(props: ServiceBuild) { - return { - ...props, - - // Initially launch 10 copies of the service - desiredCount: 10, - } as ServiceBuild; - } - - // This hook utilizes the resulting service construct - // once it is created - public useService(service: ecs.Ec2Service | ecs.FargateService) { - const scalingTarget = service.autoScaleTaskCount({ - minCapacity: 5, // Min 5 tasks - maxCapacity: 20, // Max 20 tasks - }); - - scalingTarget.scaleOnCpuUtilization('TargetCpuUtilization50', { - targetUtilizationPercent: 50, - scaleInCooldown: cdk.Duration.seconds(60), - scaleOutCooldown: cdk.Duration.seconds(60), - }); - } -} - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-ecs-integ'); - -const environment = new Environment(stack, 'production'); - -/** Name service */ -const nameDescription = new ServiceDescription(); -nameDescription.add(new Container({ - cpu: 1024, - memoryMiB: 2048, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - environment: { - PORT: '80', - }, -})); -nameDescription.add(new MyCustomAutoscaling()); - -new Service(stack, 'name', { - environment: environment, - serviceDescription: nameDescription, -}); - -/** - * Expectation is that the user is able to implement their own extension - * using the abstract class, and that it will function. This will help - * catch breaking changes to extensions. (Might need to make this example - * custom extension more complex eventually) - */ \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.imported-environment.expected.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.imported-environment.expected.json deleted file mode 100644 index 48775db8f3c84..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.imported-environment.expected.json +++ /dev/null @@ -1,451 +0,0 @@ -{ - "Resources": { - "ResourcesNestedStackResourcesNestedStackResourceCDA26E60": { - "Type": "AWS::CloudFormation::Stack", - "Properties": { - "TemplateURL": { - "Fn::Join": [ - "", - [ - "https://s3.", - { - "Ref": "AWS::Region" - }, - ".", - { - "Ref": "AWS::URLSuffix" - }, - "/", - { - "Ref": "AssetParameterse2fc78c01b63f40b6bbcc8ce3c0eaccd3bf8f0aa6196b65f8ee87fb97e343886S3Bucket85F9E22A" - }, - "/", - { - "Fn::Select": [ - 0, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameterse2fc78c01b63f40b6bbcc8ce3c0eaccd3bf8f0aa6196b65f8ee87fb97e343886S3VersionKey8103F967" - } - ] - } - ] - }, - { - "Fn::Select": [ - 1, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParameterse2fc78c01b63f40b6bbcc8ce3c0eaccd3bf8f0aa6196b65f8ee87fb97e343886S3VersionKey8103F967" - } - ] - } - ] - } - ] - ] - } - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "ServiceloadbalancerD5D60894": { - "Type": "AWS::ElasticLoadBalancingV2::LoadBalancer", - "Properties": { - "LoadBalancerAttributes": [ - { - "Key": "deletion_protection.enabled", - "Value": "false" - } - ], - "Scheme": "internet-facing", - "SecurityGroups": [ - { - "Fn::GetAtt": [ - "ServiceloadbalancerSecurityGroup2DA3E8D6", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Fn::GetAtt": [ - "ResourcesNestedStackResourcesNestedStackResourceCDA26E60", - "Outputs.importedenvironmentintegResourcesEnvironmentenvironmentvpcPublicSubnet1Subnet0D15D382Ref" - ] - }, - { - "Fn::GetAtt": [ - "ResourcesNestedStackResourcesNestedStackResourceCDA26E60", - "Outputs.importedenvironmentintegResourcesEnvironmentenvironmentvpcPublicSubnet2Subnet68645ACARef" - ] - }, - { - "Fn::GetAtt": [ - "ResourcesNestedStackResourcesNestedStackResourceCDA26E60", - "Outputs.importedenvironmentintegResourcesEnvironmentenvironmentvpcPublicSubnet3Subnet408F449FRef" - ] - } - ], - "Type": "application" - } - }, - "ServiceloadbalancerSecurityGroup2DA3E8D6": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "Automatically created Security Group for ELB importedenvironmentintegServiceloadbalancerFAE8A5FA", - "SecurityGroupIngress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow from anyone on port 80", - "FromPort": 80, - "IpProtocol": "tcp", - "ToPort": 80 - } - ], - "VpcId": { - "Fn::GetAtt": [ - "ResourcesNestedStackResourcesNestedStackResourceCDA26E60", - "Outputs.importedenvironmentintegResourcesEnvironmentenvironmentvpcDC34D4D3Ref" - ] - } - } - }, - "ServiceloadbalancerSecurityGrouptoimportedenvironmentintegServiceserviceSecurityGroup2BE90F7480B17EB7CA": { - "Type": "AWS::EC2::SecurityGroupEgress", - "Properties": { - "GroupId": { - "Fn::GetAtt": [ - "ServiceloadbalancerSecurityGroup2DA3E8D6", - "GroupId" - ] - }, - "IpProtocol": "tcp", - "Description": "Load balancer to target", - "DestinationSecurityGroupId": { - "Fn::GetAtt": [ - "ServiceserviceSecurityGroup1915660F", - "GroupId" - ] - }, - "FromPort": 80, - "ToPort": 80 - } - }, - "ServiceloadbalancerServicelistenerC862F722": { - "Type": "AWS::ElasticLoadBalancingV2::Listener", - "Properties": { - "DefaultActions": [ - { - "TargetGroupArn": { - "Ref": "ServiceloadbalancerServicelistenerServiceGroup844B51E6" - }, - "Type": "forward" - } - ], - "LoadBalancerArn": { - "Ref": "ServiceloadbalancerD5D60894" - }, - "Port": 80, - "Protocol": "HTTP" - } - }, - "ServiceloadbalancerServicelistenerServiceGroup844B51E6": { - "Type": "AWS::ElasticLoadBalancingV2::TargetGroup", - "Properties": { - "Port": 80, - "Protocol": "HTTP", - "TargetGroupAttributes": [ - { - "Key": "deregistration_delay.timeout_seconds", - "Value": "10" - }, - { - "Key": "stickiness.enabled", - "Value": "false" - } - ], - "TargetType": "ip", - "VpcId": { - "Fn::GetAtt": [ - "ResourcesNestedStackResourcesNestedStackResourceCDA26E60", - "Outputs.importedenvironmentintegResourcesEnvironmentenvironmentvpcDC34D4D3Ref" - ] - } - } - }, - "ServicetaskdefinitionTaskRole5B4B60A4": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "Servicetaskdefinition0CEAD834": { - "Type": "AWS::ECS::TaskDefinition", - "Properties": { - "ContainerDefinitions": [ - { - "Cpu": 256, - "Environment": [ - { - "Name": "PORT", - "Value": "80" - } - ], - "Essential": true, - "Image": "nathanpeck/name", - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "Servicelogs9F4E1F70" - }, - "awslogs-stream-prefix": "Service", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "Memory": 512, - "Name": "app", - "PortMappings": [ - { - "ContainerPort": 80, - "Protocol": "tcp" - } - ], - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ] - } - ], - "Cpu": "256", - "ExecutionRoleArn": { - "Fn::GetAtt": [ - "ServicetaskdefinitionExecutionRoleD09F4578", - "Arn" - ] - }, - "Family": "importedenvironmentintegServicetaskdefinition63936B87", - "Memory": "512", - "NetworkMode": "awsvpc", - "RequiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "TaskRoleArn": { - "Fn::GetAtt": [ - "ServicetaskdefinitionTaskRole5B4B60A4", - "Arn" - ] - } - } - }, - "ServicetaskdefinitionExecutionRoleD09F4578": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "ServicetaskdefinitionExecutionRoleDefaultPolicy25CEAFC5": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "Servicelogs9F4E1F70", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "ServicetaskdefinitionExecutionRoleDefaultPolicy25CEAFC5", - "Roles": [ - { - "Ref": "ServicetaskdefinitionExecutionRoleD09F4578" - } - ] - } - }, - "Servicelogs9F4E1F70": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "Service-logs", - "RetentionInDays": 30 - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "ServiceserviceService6A153CB8": { - "Type": "AWS::ECS::Service", - "Properties": { - "Cluster": { - "Fn::GetAtt": [ - "ResourcesNestedStackResourcesNestedStackResourceCDA26E60", - "Outputs.importedenvironmentintegResourcesEnvironmentenvironmentcluster594A3DCARef" - ] - }, - "DeploymentConfiguration": { - "MaximumPercent": 200, - "MinimumHealthyPercent": 100 - }, - "DesiredCount": 1, - "EnableECSManagedTags": false, - "HealthCheckGracePeriodSeconds": 60, - "LaunchType": "FARGATE", - "LoadBalancers": [ - { - "ContainerName": "app", - "ContainerPort": 80, - "TargetGroupArn": { - "Ref": "ServiceloadbalancerServicelistenerServiceGroup844B51E6" - } - } - ], - "NetworkConfiguration": { - "AwsvpcConfiguration": { - "AssignPublicIp": "DISABLED", - "SecurityGroups": [ - { - "Fn::GetAtt": [ - "ServiceserviceSecurityGroup1915660F", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Fn::GetAtt": [ - "ResourcesNestedStackResourcesNestedStackResourceCDA26E60", - "Outputs.importedenvironmentintegResourcesEnvironmentenvironmentvpcPrivateSubnet1Subnet7309E967Ref" - ] - }, - { - "Fn::GetAtt": [ - "ResourcesNestedStackResourcesNestedStackResourceCDA26E60", - "Outputs.importedenvironmentintegResourcesEnvironmentenvironmentvpcPrivateSubnet2Subnet55014443Ref" - ] - }, - { - "Fn::GetAtt": [ - "ResourcesNestedStackResourcesNestedStackResourceCDA26E60", - "Outputs.importedenvironmentintegResourcesEnvironmentenvironmentvpcPrivateSubnet3Subnet6CF08327Ref" - ] - } - ] - } - }, - "TaskDefinition": { - "Ref": "Servicetaskdefinition0CEAD834" - } - }, - "DependsOn": [ - "ServiceloadbalancerServicelistenerC862F722", - "ServiceloadbalancerServicelistenerServiceGroup844B51E6" - ] - }, - "ServiceserviceSecurityGroup1915660F": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "imported-environment-integ/Service-service/SecurityGroup", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "VpcId": { - "Fn::GetAtt": [ - "ResourcesNestedStackResourcesNestedStackResourceCDA26E60", - "Outputs.importedenvironmentintegResourcesEnvironmentenvironmentvpcDC34D4D3Ref" - ] - } - } - }, - "ServiceserviceSecurityGroupfromimportedenvironmentintegServiceloadbalancerSecurityGroup68EE533C8070FCF629": { - "Type": "AWS::EC2::SecurityGroupIngress", - "Properties": { - "IpProtocol": "tcp", - "Description": "Load balancer to target", - "FromPort": 80, - "GroupId": { - "Fn::GetAtt": [ - "ServiceserviceSecurityGroup1915660F", - "GroupId" - ] - }, - "SourceSecurityGroupId": { - "Fn::GetAtt": [ - "ServiceloadbalancerSecurityGroup2DA3E8D6", - "GroupId" - ] - }, - "ToPort": 80 - } - } - }, - "Outputs": { - "Serviceloadbalancerdnsoutput": { - "Value": { - "Fn::GetAtt": [ - "ServiceloadbalancerD5D60894", - "DNSName" - ] - } - } - }, - "Parameters": { - "AssetParameterse2fc78c01b63f40b6bbcc8ce3c0eaccd3bf8f0aa6196b65f8ee87fb97e343886S3Bucket85F9E22A": { - "Type": "String", - "Description": "S3 bucket for asset \"e2fc78c01b63f40b6bbcc8ce3c0eaccd3bf8f0aa6196b65f8ee87fb97e343886\"" - }, - "AssetParameterse2fc78c01b63f40b6bbcc8ce3c0eaccd3bf8f0aa6196b65f8ee87fb97e343886S3VersionKey8103F967": { - "Type": "String", - "Description": "S3 key for asset version \"e2fc78c01b63f40b6bbcc8ce3c0eaccd3bf8f0aa6196b65f8ee87fb97e343886\"" - }, - "AssetParameterse2fc78c01b63f40b6bbcc8ce3c0eaccd3bf8f0aa6196b65f8ee87fb97e343886ArtifactHash6FA4ABA8": { - "Type": "String", - "Description": "Artifact hash for asset \"e2fc78c01b63f40b6bbcc8ce3c0eaccd3bf8f0aa6196b65f8ee87fb97e343886\"" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.imported-environment.ts b/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.imported-environment.ts deleted file mode 100644 index 899d9e4a4f7c4..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.imported-environment.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { Vpc } from '@aws-cdk/aws-ec2'; -import { Cluster, ContainerImage } from '@aws-cdk/aws-ecs'; -import { App, NestedStack, Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { - Container, - Environment, - EnvironmentCapacityType, - HttpLoadBalancerExtension, - Service, - ServiceDescription, -} from '../lib'; - -class ResourceStack extends NestedStack { - public readonly clusterName: string; - public readonly vpcId: string; - public readonly publicSubnetIds: string[]; - public readonly privateSubnetIds: string[]; - - constructor(scope: Construct, id: string) { - super(scope, id); - - const environment = new Environment(this, 'Environment'); - - this.clusterName = environment.cluster.clusterName; - this.vpcId = environment.vpc.vpcId; - this.privateSubnetIds = environment.vpc.privateSubnets.map(m => m.subnetId); - this.publicSubnetIds = environment.vpc.publicSubnets.map(m => m.subnetId); - } -} - -class TestStack extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - // Create a nested stack with the shared resources - const resourceStack = new ResourceStack(this, 'Resources'); - - // Import the vpc from the nested stack - const vpc = Vpc.fromVpcAttributes(this, 'Vpc', { - availabilityZones: resourceStack.availabilityZones, - vpcId: resourceStack.vpcId, - privateSubnetIds: resourceStack.privateSubnetIds, - publicSubnetIds: resourceStack.publicSubnetIds, - }); - - // Import the cluster from the nested stack - const cluster = Cluster.fromClusterAttributes(this, 'Cluster', { - clusterName: resourceStack.clusterName, - securityGroups: [], - vpc: vpc, - }); - - // Create the environment from attributes. - const environment = Environment.fromEnvironmentAttributes(this, 'Environment', { - cluster, - capacityType: EnvironmentCapacityType.FARGATE, - }); - - // Add a workload. - const serviceDescription = new ServiceDescription(); - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ContainerImage.fromRegistry('nathanpeck/name'), - environment: { - PORT: '80', - }, - })); - serviceDescription.add(new HttpLoadBalancerExtension()); - - new Service(this, 'Service', { - environment, - serviceDescription, - }); - } -} - -const app = new App(); -new TestStack(app, 'imported-environment-integ'); - -/** - * Expect this stack to deploy and show a load balancer DNS address. When you - * request the address with curl, you should see the name container's output. - * The load balancer may response 503 Service Temporarily Unavailable for a - * short while, before you can see the container output. - * - * Example: - * ``` - * $ cdk --app 'node integ.imported-environment.js' deploy - * ... - * Outputs: - * shared-cluster-integ.Serviceloadbalancerdnsoutput = share-Servi-6JALU1FDE36L-2093347098.us-east-1.elb.amazonaws.com - * ... - * - * $ curl share-Servi-6JALU1FDE36L-2093347098.us-east-1.elb.amazonaws.com - * Keira (ip-10-0-153-44.ec2.internal) - * ``` - */ diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.multiple-environments.expected.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.multiple-environments.expected.json deleted file mode 100644 index ecee47c85b2a4..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.multiple-environments.expected.json +++ /dev/null @@ -1,2322 +0,0 @@ -{ - "Resources": { - "productionenvironmentvpcAEB47DF7": { - "Type": "AWS::EC2::VPC", - "Properties": { - "CidrBlock": "10.0.0.0/16", - "EnableDnsHostnames": true, - "EnableDnsSupport": true, - "InstanceTenancy": "default", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1Subnet8D92C089": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.0.0/19", - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "AvailabilityZone": "test-region-1a", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1RouteTableAssociationA8117374": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - } - } - }, - "productionenvironmentvpcPublicSubnet1DefaultRoute524C894D": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - }, - "DependsOn": [ - "productionenvironmentvpcVPCGW1B428D07" - ] - }, - "productionenvironmentvpcPublicSubnet1EIP54BA88DB": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1NATGateway6075E4CA": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - }, - "AllocationId": { - "Fn::GetAtt": [ - "productionenvironmentvpcPublicSubnet1EIP54BA88DB", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet2Subnet298E6C31": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.32.0/19", - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "AvailabilityZone": "test-region-1b", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet2RouteTable842A68D7": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet2RouteTableAssociation0A7549F3": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet2RouteTable842A68D7" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - } - } - }, - "productionenvironmentvpcPublicSubnet2DefaultRoute92CD697D": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet2RouteTable842A68D7" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - }, - "DependsOn": [ - "productionenvironmentvpcVPCGW1B428D07" - ] - }, - "productionenvironmentvpcPublicSubnet2EIP14CA46AA": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet2NATGatewayE1850FCC": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - }, - "AllocationId": { - "Fn::GetAtt": [ - "productionenvironmentvpcPublicSubnet2EIP14CA46AA", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet3SubnetC7B5665D": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.64.0/19", - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "AvailabilityZone": "test-region-1c", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet3" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet3RouteTable00E3BF60": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet3" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet3RouteTableAssociationFA34D6E7": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet3RouteTable00E3BF60" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet3SubnetC7B5665D" - } - } - }, - "productionenvironmentvpcPublicSubnet3DefaultRouteE1ADEA6C": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet3RouteTable00E3BF60" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - }, - "DependsOn": [ - "productionenvironmentvpcVPCGW1B428D07" - ] - }, - "productionenvironmentvpcPublicSubnet3EIP53405AED": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet3" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet3NATGateway94604057": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet3SubnetC7B5665D" - }, - "AllocationId": { - "Fn::GetAtt": [ - "productionenvironmentvpcPublicSubnet3EIP53405AED", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet3" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet1Subnet53F632E6": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.96.0/19", - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "AvailabilityZone": "test-region-1a", - "MapPublicIpOnLaunch": false, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Private" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Private" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet1RouteTableAssociation8BA32463": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - } - } - }, - "productionenvironmentvpcPrivateSubnet1DefaultRouteFBB3DE6C": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "productionenvironmentvpcPublicSubnet1NATGateway6075E4CA" - } - } - }, - "productionenvironmentvpcPrivateSubnet2Subnet756FB93C": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.128.0/19", - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "AvailabilityZone": "test-region-1b", - "MapPublicIpOnLaunch": false, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Private" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Private" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet2RouteTableAssociation09188261": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - } - }, - "productionenvironmentvpcPrivateSubnet2DefaultRoute5F9AB6C1": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "productionenvironmentvpcPublicSubnet2NATGatewayE1850FCC" - } - } - }, - "productionenvironmentvpcPrivateSubnet3Subnet3BD4064E": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.160.0/19", - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "AvailabilityZone": "test-region-1c", - "MapPublicIpOnLaunch": false, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Private" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Private" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet3" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet3RouteTable1A244D34": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet3" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet3RouteTableAssociation65F18B9C": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet3RouteTable1A244D34" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPrivateSubnet3Subnet3BD4064E" - } - } - }, - "productionenvironmentvpcPrivateSubnet3DefaultRoute2438918B": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet3RouteTable1A244D34" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "productionenvironmentvpcPublicSubnet3NATGateway94604057" - } - } - }, - "productionenvironmentvpcIGWE7C39890": { - "Type": "AWS::EC2::InternetGateway", - "Properties": { - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc" - } - ] - } - }, - "productionenvironmentvpcVPCGW1B428D07": { - "Type": "AWS::EC2::VPCGatewayAttachment", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "InternetGatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - } - }, - "productionenvironmentclusterC6599D2D": { - "Type": "AWS::ECS::Cluster" - }, - "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D": { - "Type": "AWS::ServiceDiscovery::PrivateDnsNamespace", - "Properties": { - "Name": "production", - "Vpc": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "developmentenvironmentvpcCB4216A4": { - "Type": "AWS::EC2::VPC", - "Properties": { - "CidrBlock": "10.0.0.0/16", - "EnableDnsHostnames": true, - "EnableDnsSupport": true, - "InstanceTenancy": "default", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc" - } - ] - } - }, - "developmentenvironmentvpcPublicSubnet1Subnet0D18046B": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.0.0/19", - "VpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "AvailabilityZone": "test-region-1a", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc/PublicSubnet1" - } - ] - } - }, - "developmentenvironmentvpcPublicSubnet1RouteTable8FC58983": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc/PublicSubnet1" - } - ] - } - }, - "developmentenvironmentvpcPublicSubnet1RouteTableAssociation8F257A0C": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "developmentenvironmentvpcPublicSubnet1RouteTable8FC58983" - }, - "SubnetId": { - "Ref": "developmentenvironmentvpcPublicSubnet1Subnet0D18046B" - } - } - }, - "developmentenvironmentvpcPublicSubnet1DefaultRoute2BAA794D": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "developmentenvironmentvpcPublicSubnet1RouteTable8FC58983" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "developmentenvironmentvpcIGW2B4E91B1" - } - }, - "DependsOn": [ - "developmentenvironmentvpcVPCGW702C2C38" - ] - }, - "developmentenvironmentvpcPublicSubnet1EIPE8B9F4D4": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc/PublicSubnet1" - } - ] - } - }, - "developmentenvironmentvpcPublicSubnet1NATGateway6B01CC4E": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "developmentenvironmentvpcPublicSubnet1Subnet0D18046B" - }, - "AllocationId": { - "Fn::GetAtt": [ - "developmentenvironmentvpcPublicSubnet1EIPE8B9F4D4", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc/PublicSubnet1" - } - ] - } - }, - "developmentenvironmentvpcPublicSubnet2SubnetC2026CD3": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.32.0/19", - "VpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "AvailabilityZone": "test-region-1b", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc/PublicSubnet2" - } - ] - } - }, - "developmentenvironmentvpcPublicSubnet2RouteTable803A92C2": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc/PublicSubnet2" - } - ] - } - }, - "developmentenvironmentvpcPublicSubnet2RouteTableAssociation6630985C": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "developmentenvironmentvpcPublicSubnet2RouteTable803A92C2" - }, - "SubnetId": { - "Ref": "developmentenvironmentvpcPublicSubnet2SubnetC2026CD3" - } - } - }, - "developmentenvironmentvpcPublicSubnet2DefaultRoute2C5118B5": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "developmentenvironmentvpcPublicSubnet2RouteTable803A92C2" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "developmentenvironmentvpcIGW2B4E91B1" - } - }, - "DependsOn": [ - "developmentenvironmentvpcVPCGW702C2C38" - ] - }, - "developmentenvironmentvpcPublicSubnet2EIP560C2BBA": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc/PublicSubnet2" - } - ] - } - }, - "developmentenvironmentvpcPublicSubnet2NATGateway15A9C252": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "developmentenvironmentvpcPublicSubnet2SubnetC2026CD3" - }, - "AllocationId": { - "Fn::GetAtt": [ - "developmentenvironmentvpcPublicSubnet2EIP560C2BBA", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc/PublicSubnet2" - } - ] - } - }, - "developmentenvironmentvpcPublicSubnet3Subnet00B8A77C": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.64.0/19", - "VpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "AvailabilityZone": "test-region-1c", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc/PublicSubnet3" - } - ] - } - }, - "developmentenvironmentvpcPublicSubnet3RouteTableAEB3B528": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc/PublicSubnet3" - } - ] - } - }, - "developmentenvironmentvpcPublicSubnet3RouteTableAssociationF90257AE": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "developmentenvironmentvpcPublicSubnet3RouteTableAEB3B528" - }, - "SubnetId": { - "Ref": "developmentenvironmentvpcPublicSubnet3Subnet00B8A77C" - } - } - }, - "developmentenvironmentvpcPublicSubnet3DefaultRoute11687292": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "developmentenvironmentvpcPublicSubnet3RouteTableAEB3B528" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "developmentenvironmentvpcIGW2B4E91B1" - } - }, - "DependsOn": [ - "developmentenvironmentvpcVPCGW702C2C38" - ] - }, - "developmentenvironmentvpcPublicSubnet3EIPE2E366D3": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc/PublicSubnet3" - } - ] - } - }, - "developmentenvironmentvpcPublicSubnet3NATGatewayAD65DE0B": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "developmentenvironmentvpcPublicSubnet3Subnet00B8A77C" - }, - "AllocationId": { - "Fn::GetAtt": [ - "developmentenvironmentvpcPublicSubnet3EIPE2E366D3", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc/PublicSubnet3" - } - ] - } - }, - "developmentenvironmentvpcPrivateSubnet1SubnetAAECD171": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.96.0/19", - "VpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "AvailabilityZone": "test-region-1a", - "MapPublicIpOnLaunch": false, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Private" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Private" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "developmentenvironmentvpcPrivateSubnet1RouteTable29CEB1DB": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "developmentenvironmentvpcPrivateSubnet1RouteTableAssociation95EE92E6": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "developmentenvironmentvpcPrivateSubnet1RouteTable29CEB1DB" - }, - "SubnetId": { - "Ref": "developmentenvironmentvpcPrivateSubnet1SubnetAAECD171" - } - } - }, - "developmentenvironmentvpcPrivateSubnet1DefaultRoute1813B5F3": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "developmentenvironmentvpcPrivateSubnet1RouteTable29CEB1DB" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "developmentenvironmentvpcPublicSubnet1NATGateway6B01CC4E" - } - } - }, - "developmentenvironmentvpcPrivateSubnet2Subnet20C1C37D": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.128.0/19", - "VpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "AvailabilityZone": "test-region-1b", - "MapPublicIpOnLaunch": false, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Private" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Private" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "developmentenvironmentvpcPrivateSubnet2RouteTable687AB03B": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "developmentenvironmentvpcPrivateSubnet2RouteTableAssociation1C336DAE": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "developmentenvironmentvpcPrivateSubnet2RouteTable687AB03B" - }, - "SubnetId": { - "Ref": "developmentenvironmentvpcPrivateSubnet2Subnet20C1C37D" - } - } - }, - "developmentenvironmentvpcPrivateSubnet2DefaultRoute1B4A6D0D": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "developmentenvironmentvpcPrivateSubnet2RouteTable687AB03B" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "developmentenvironmentvpcPublicSubnet2NATGateway15A9C252" - } - } - }, - "developmentenvironmentvpcPrivateSubnet3SubnetAE84C610": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.160.0/19", - "VpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "AvailabilityZone": "test-region-1c", - "MapPublicIpOnLaunch": false, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Private" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Private" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc/PrivateSubnet3" - } - ] - } - }, - "developmentenvironmentvpcPrivateSubnet3RouteTableBD7C810A": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc/PrivateSubnet3" - } - ] - } - }, - "developmentenvironmentvpcPrivateSubnet3RouteTableAssociation08099995": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "developmentenvironmentvpcPrivateSubnet3RouteTableBD7C810A" - }, - "SubnetId": { - "Ref": "developmentenvironmentvpcPrivateSubnet3SubnetAE84C610" - } - } - }, - "developmentenvironmentvpcPrivateSubnet3DefaultRoute93B77208": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "developmentenvironmentvpcPrivateSubnet3RouteTableBD7C810A" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "developmentenvironmentvpcPublicSubnet3NATGatewayAD65DE0B" - } - } - }, - "developmentenvironmentvpcIGW2B4E91B1": { - "Type": "AWS::EC2::InternetGateway", - "Properties": { - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc" - } - ] - } - }, - "developmentenvironmentvpcVPCGW702C2C38": { - "Type": "AWS::EC2::VPCGatewayAttachment", - "Properties": { - "VpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "InternetGatewayId": { - "Ref": "developmentenvironmentvpcIGW2B4E91B1" - } - } - }, - "developmentenvironmentcluster1B64BE8B": { - "Type": "AWS::ECS::Cluster" - }, - "developmentenvironmentclusterDefaultServiceDiscoveryNamespace0F234767": { - "Type": "AWS::ServiceDiscovery::PrivateDnsNamespace", - "Properties": { - "Name": "development", - "Vpc": { - "Ref": "developmentenvironmentvpcCB4216A4" - } - } - }, - "productionmeshB6E81744": { - "Type": "AWS::AppMesh::Mesh", - "Properties": { - "MeshName": "awsecsintegproductionmesh1A4ED585", - "Spec": {} - } - }, - "developmentmeshCEC28AFE": { - "Type": "AWS::AppMesh::Mesh", - "Properties": { - "MeshName": "awsecsintegdevelopmentmeshEFC35179", - "Spec": {} - } - }, - "nameproductiontaskdefinitionTaskRole93E922EB": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "nameproductiontaskdefinition33A5D5E0": { - "Type": "AWS::ECS::TaskDefinition", - "Properties": { - "ContainerDefinitions": [ - { - "Cpu": 1024, - "DependsOn": [ - { - "Condition": "HEALTHY", - "ContainerName": "envoy" - } - ], - "Environment": [ - { - "Name": "PORT", - "Value": "80" - } - ], - "Essential": true, - "Image": "nathanpeck/name", - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "nameproductionlogsD0BFFE8C" - }, - "awslogs-stream-prefix": "name-production", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "Memory": 2048, - "Name": "app", - "PortMappings": [ - { - "ContainerPort": 80, - "Protocol": "tcp" - } - ], - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ] - }, - { - "Environment": [ - { - "Name": "APPMESH_VIRTUAL_NODE_NAME", - "Value": { - "Fn::Join": [ - "", - [ - "mesh/", - { - "Fn::GetAtt": [ - "productionmeshB6E81744", - "MeshName" - ] - }, - "/virtualNode/name-production" - ] - ] - } - }, - { - "Name": "AWS_REGION", - "Value": { - "Ref": "AWS::Region" - } - }, - { - "Name": "ENABLE_ENVOY_STATS_TAGS", - "Value": "1" - }, - { - "Name": "ENABLE_ENVOY_DOG_STATSD", - "Value": "1" - } - ], - "Essential": true, - "HealthCheck": { - "Command": [ - "CMD-SHELL", - "curl -s http://localhost:9901/server_info | grep state | grep -q LIVE" - ], - "Interval": 5, - "Retries": 3, - "StartPeriod": 10, - "Timeout": 2 - }, - "Image": { - "Fn::Join": [ - "", - [ - { - "Fn::FindInMap": [ - "nameproductionenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ".dkr.ecr.", - { - "Ref": "AWS::Region" - }, - ".", - { - "Ref": "AWS::URLSuffix" - }, - "/aws-appmesh-envoy:v1.15.1.0-prod" - ] - ] - }, - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "nameproductiontaskdefinitionenvoyLogGroupF79A2732" - }, - "awslogs-stream-prefix": "envoy", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "MemoryReservation": 128, - "Name": "envoy", - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ], - "User": "1337" - } - ], - "Cpu": "1024", - "ExecutionRoleArn": { - "Fn::GetAtt": [ - "nameproductiontaskdefinitionExecutionRoleB72DD86B", - "Arn" - ] - }, - "Family": "awsecsintegnameproductiontaskdefinition9E1C363B", - "Memory": "2048", - "NetworkMode": "awsvpc", - "ProxyConfiguration": { - "ContainerName": "envoy", - "ProxyConfigurationProperties": [ - { - "Name": "AppPorts", - "Value": "80" - }, - { - "Name": "ProxyEgressPort", - "Value": "15001" - }, - { - "Name": "ProxyIngressPort", - "Value": "15000" - }, - { - "Name": "IgnoredUID", - "Value": "1337" - }, - { - "Name": "IgnoredGID", - "Value": "1338" - }, - { - "Name": "EgressIgnoredIPs", - "Value": "169.254.170.2,169.254.169.254" - } - ], - "Type": "APPMESH" - }, - "RequiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "TaskRoleArn": { - "Fn::GetAtt": [ - "nameproductiontaskdefinitionTaskRole93E922EB", - "Arn" - ] - } - } - }, - "nameproductiontaskdefinitionExecutionRoleB72DD86B": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "nameproductiontaskdefinitionExecutionRoleDefaultPolicyB66C67BE": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "nameproductionlogsD0BFFE8C", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "nameproductiontaskdefinitionenvoyLogGroupF79A2732", - "Arn" - ] - } - ] - }, - { - "Action": [ - "ecr:BatchCheckLayerAvailability", - "ecr:BatchGetImage", - "ecr:GetDownloadUrlForLayer" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ecr:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Fn::FindInMap": [ - "nameproductionenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ":repository/aws-appmesh-envoy" - ] - ] - } - }, - { - "Action": "ecr:GetAuthorizationToken", - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "nameproductiontaskdefinitionExecutionRoleDefaultPolicyB66C67BE", - "Roles": [ - { - "Ref": "nameproductiontaskdefinitionExecutionRoleB72DD86B" - } - ] - } - }, - "nameproductiontaskdefinitionenvoyLogGroupF79A2732": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "nameproductionlogsD0BFFE8C": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "name-production-logs", - "RetentionInDays": 30 - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "nameproductionenvoytoappmesh1B44B04A": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "appmesh:StreamAggregatedResources", - "Effect": "Allow", - "Resource": { - "Ref": "productionmeshB6E81744" - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "nameproductionenvoytoappmesh1B44B04A", - "Roles": [ - { - "Ref": "nameproductiontaskdefinitionTaskRole93E922EB" - } - ] - } - }, - "nameproductionserviceServiceB2D31516": { - "Type": "AWS::ECS::Service", - "Properties": { - "Cluster": { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "DeploymentConfiguration": { - "MaximumPercent": 200, - "MinimumHealthyPercent": 100 - }, - "DesiredCount": 1, - "EnableECSManagedTags": false, - "LaunchType": "FARGATE", - "NetworkConfiguration": { - "AwsvpcConfiguration": { - "AssignPublicIp": "DISABLED", - "SecurityGroups": [ - { - "Fn::GetAtt": [ - "nameproductionserviceSecurityGroupF496E439", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - }, - { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - }, - { - "Ref": "productionenvironmentvpcPrivateSubnet3Subnet3BD4064E" - } - ] - } - }, - "ServiceRegistries": [ - { - "RegistryArn": { - "Fn::GetAtt": [ - "nameproductionserviceCloudmapService60E3273A", - "Arn" - ] - } - } - ], - "TaskDefinition": { - "Ref": "nameproductiontaskdefinition33A5D5E0" - } - } - }, - "nameproductionserviceCloudmapService60E3273A": { - "Type": "AWS::ServiceDiscovery::Service", - "Properties": { - "DnsConfig": { - "DnsRecords": [ - { - "TTL": 10, - "Type": "A" - } - ], - "NamespaceId": { - "Fn::GetAtt": [ - "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D", - "Id" - ] - }, - "RoutingPolicy": "MULTIVALUE" - }, - "HealthCheckCustomConfig": { - "FailureThreshold": 2 - }, - "Name": "name-production", - "NamespaceId": { - "Fn::GetAtt": [ - "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D", - "Id" - ] - } - } - }, - "nameproductionserviceSecurityGroupF496E439": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "aws-ecs-integ/name-production-service/SecurityGroup", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "nameproductionvirtualnodeC78443D9": { - "Type": "AWS::AppMesh::VirtualNode", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "productionmeshB6E81744", - "MeshName" - ] - }, - "Spec": { - "Listeners": [ - { - "PortMapping": { - "Port": 80, - "Protocol": "http" - } - } - ], - "ServiceDiscovery": { - "AWSCloudMap": { - "NamespaceName": "production", - "ServiceName": { - "Fn::GetAtt": [ - "nameproductionserviceCloudmapService60E3273A", - "Name" - ] - } - } - } - }, - "VirtualNodeName": "name-production" - } - }, - "nameproductionvirtualrouter00E3366D": { - "Type": "AWS::AppMesh::VirtualRouter", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "productionmeshB6E81744", - "MeshName" - ] - }, - "Spec": { - "Listeners": [ - { - "PortMapping": { - "Port": 80, - "Protocol": "http" - } - } - ] - }, - "VirtualRouterName": "name-production" - } - }, - "nameproductionvirtualrouternameproductionrouteE886BEFD": { - "Type": "AWS::AppMesh::Route", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "productionmeshB6E81744", - "MeshName" - ] - }, - "Spec": { - "HttpRoute": { - "Action": { - "WeightedTargets": [ - { - "VirtualNode": { - "Fn::GetAtt": [ - "nameproductionvirtualnodeC78443D9", - "VirtualNodeName" - ] - }, - "Weight": 1 - } - ] - }, - "Match": { - "Prefix": "/" - } - } - }, - "VirtualRouterName": { - "Fn::GetAtt": [ - "nameproductionvirtualrouter00E3366D", - "VirtualRouterName" - ] - }, - "RouteName": "name-production-route" - } - }, - "nameproductionvirtualservice4D49D5F6": { - "Type": "AWS::AppMesh::VirtualService", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "productionmeshB6E81744", - "MeshName" - ] - }, - "Spec": { - "Provider": { - "VirtualRouter": { - "VirtualRouterName": { - "Fn::GetAtt": [ - "nameproductionvirtualrouter00E3366D", - "VirtualRouterName" - ] - } - } - } - }, - "VirtualServiceName": "name-production.production" - } - }, - "namedevelopmenttaskdefinitionTaskRole66A85BBB": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "namedevelopmenttaskdefinition0468FBFF": { - "Type": "AWS::ECS::TaskDefinition", - "Properties": { - "ContainerDefinitions": [ - { - "Cpu": 1024, - "DependsOn": [ - { - "Condition": "HEALTHY", - "ContainerName": "envoy" - } - ], - "Environment": [ - { - "Name": "PORT", - "Value": "80" - } - ], - "Essential": true, - "Image": "nathanpeck/name", - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "namedevelopmentlogs108670CC" - }, - "awslogs-stream-prefix": "name-development", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "Memory": 2048, - "Name": "app", - "PortMappings": [ - { - "ContainerPort": 80, - "Protocol": "tcp" - } - ], - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ] - }, - { - "Environment": [ - { - "Name": "APPMESH_VIRTUAL_NODE_NAME", - "Value": { - "Fn::Join": [ - "", - [ - "mesh/", - { - "Fn::GetAtt": [ - "developmentmeshCEC28AFE", - "MeshName" - ] - }, - "/virtualNode/name-development" - ] - ] - } - }, - { - "Name": "AWS_REGION", - "Value": { - "Ref": "AWS::Region" - } - }, - { - "Name": "ENABLE_ENVOY_STATS_TAGS", - "Value": "1" - }, - { - "Name": "ENABLE_ENVOY_DOG_STATSD", - "Value": "1" - } - ], - "Essential": true, - "HealthCheck": { - "Command": [ - "CMD-SHELL", - "curl -s http://localhost:9901/server_info | grep state | grep -q LIVE" - ], - "Interval": 5, - "Retries": 3, - "StartPeriod": 10, - "Timeout": 2 - }, - "Image": { - "Fn::Join": [ - "", - [ - { - "Fn::FindInMap": [ - "namedevelopmentenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ".dkr.ecr.", - { - "Ref": "AWS::Region" - }, - ".", - { - "Ref": "AWS::URLSuffix" - }, - "/aws-appmesh-envoy:v1.15.1.0-prod" - ] - ] - }, - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "namedevelopmenttaskdefinitionenvoyLogGroupF8FCAFD6" - }, - "awslogs-stream-prefix": "envoy", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "MemoryReservation": 128, - "Name": "envoy", - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ], - "User": "1337" - } - ], - "Cpu": "1024", - "ExecutionRoleArn": { - "Fn::GetAtt": [ - "namedevelopmenttaskdefinitionExecutionRole48B53E4E", - "Arn" - ] - }, - "Family": "awsecsintegnamedevelopmenttaskdefinitionC3797E10", - "Memory": "2048", - "NetworkMode": "awsvpc", - "ProxyConfiguration": { - "ContainerName": "envoy", - "ProxyConfigurationProperties": [ - { - "Name": "AppPorts", - "Value": "80" - }, - { - "Name": "ProxyEgressPort", - "Value": "15001" - }, - { - "Name": "ProxyIngressPort", - "Value": "15000" - }, - { - "Name": "IgnoredUID", - "Value": "1337" - }, - { - "Name": "IgnoredGID", - "Value": "1338" - }, - { - "Name": "EgressIgnoredIPs", - "Value": "169.254.170.2,169.254.169.254" - } - ], - "Type": "APPMESH" - }, - "RequiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "TaskRoleArn": { - "Fn::GetAtt": [ - "namedevelopmenttaskdefinitionTaskRole66A85BBB", - "Arn" - ] - } - } - }, - "namedevelopmenttaskdefinitionExecutionRole48B53E4E": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "namedevelopmenttaskdefinitionExecutionRoleDefaultPolicy34EAA008": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "namedevelopmentlogs108670CC", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "namedevelopmenttaskdefinitionenvoyLogGroupF8FCAFD6", - "Arn" - ] - } - ] - }, - { - "Action": [ - "ecr:BatchCheckLayerAvailability", - "ecr:BatchGetImage", - "ecr:GetDownloadUrlForLayer" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ecr:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Fn::FindInMap": [ - "namedevelopmentenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ":repository/aws-appmesh-envoy" - ] - ] - } - }, - { - "Action": "ecr:GetAuthorizationToken", - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "namedevelopmenttaskdefinitionExecutionRoleDefaultPolicy34EAA008", - "Roles": [ - { - "Ref": "namedevelopmenttaskdefinitionExecutionRole48B53E4E" - } - ] - } - }, - "namedevelopmenttaskdefinitionenvoyLogGroupF8FCAFD6": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "namedevelopmentlogs108670CC": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "name-development-logs", - "RetentionInDays": 30 - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "namedevelopmentenvoytoappmesh45FF08AA": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "appmesh:StreamAggregatedResources", - "Effect": "Allow", - "Resource": { - "Ref": "developmentmeshCEC28AFE" - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "namedevelopmentenvoytoappmesh45FF08AA", - "Roles": [ - { - "Ref": "namedevelopmenttaskdefinitionTaskRole66A85BBB" - } - ] - } - }, - "namedevelopmentserviceService8A24F793": { - "Type": "AWS::ECS::Service", - "Properties": { - "Cluster": { - "Ref": "developmentenvironmentcluster1B64BE8B" - }, - "DeploymentConfiguration": { - "MaximumPercent": 200, - "MinimumHealthyPercent": 100 - }, - "DesiredCount": 1, - "EnableECSManagedTags": false, - "LaunchType": "FARGATE", - "NetworkConfiguration": { - "AwsvpcConfiguration": { - "AssignPublicIp": "DISABLED", - "SecurityGroups": [ - { - "Fn::GetAtt": [ - "namedevelopmentserviceSecurityGroupE2ECED97", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Ref": "developmentenvironmentvpcPrivateSubnet1SubnetAAECD171" - }, - { - "Ref": "developmentenvironmentvpcPrivateSubnet2Subnet20C1C37D" - }, - { - "Ref": "developmentenvironmentvpcPrivateSubnet3SubnetAE84C610" - } - ] - } - }, - "ServiceRegistries": [ - { - "RegistryArn": { - "Fn::GetAtt": [ - "namedevelopmentserviceCloudmapService63674467", - "Arn" - ] - } - } - ], - "TaskDefinition": { - "Ref": "namedevelopmenttaskdefinition0468FBFF" - } - } - }, - "namedevelopmentserviceCloudmapService63674467": { - "Type": "AWS::ServiceDiscovery::Service", - "Properties": { - "DnsConfig": { - "DnsRecords": [ - { - "TTL": 10, - "Type": "A" - } - ], - "NamespaceId": { - "Fn::GetAtt": [ - "developmentenvironmentclusterDefaultServiceDiscoveryNamespace0F234767", - "Id" - ] - }, - "RoutingPolicy": "MULTIVALUE" - }, - "HealthCheckCustomConfig": { - "FailureThreshold": 2 - }, - "Name": "name-development", - "NamespaceId": { - "Fn::GetAtt": [ - "developmentenvironmentclusterDefaultServiceDiscoveryNamespace0F234767", - "Id" - ] - } - } - }, - "namedevelopmentserviceSecurityGroupE2ECED97": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "aws-ecs-integ/name-development-service/SecurityGroup", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "VpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - } - } - }, - "namedevelopmentvirtualnode55118E80": { - "Type": "AWS::AppMesh::VirtualNode", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "developmentmeshCEC28AFE", - "MeshName" - ] - }, - "Spec": { - "Listeners": [ - { - "PortMapping": { - "Port": 80, - "Protocol": "http" - } - } - ], - "ServiceDiscovery": { - "AWSCloudMap": { - "NamespaceName": "development", - "ServiceName": { - "Fn::GetAtt": [ - "namedevelopmentserviceCloudmapService63674467", - "Name" - ] - } - } - } - }, - "VirtualNodeName": "name-development" - } - }, - "namedevelopmentvirtualrouter0AE5105D": { - "Type": "AWS::AppMesh::VirtualRouter", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "developmentmeshCEC28AFE", - "MeshName" - ] - }, - "Spec": { - "Listeners": [ - { - "PortMapping": { - "Port": 80, - "Protocol": "http" - } - } - ] - }, - "VirtualRouterName": "name-development" - } - }, - "namedevelopmentvirtualrouternamedevelopmentroute611E499A": { - "Type": "AWS::AppMesh::Route", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "developmentmeshCEC28AFE", - "MeshName" - ] - }, - "Spec": { - "HttpRoute": { - "Action": { - "WeightedTargets": [ - { - "VirtualNode": { - "Fn::GetAtt": [ - "namedevelopmentvirtualnode55118E80", - "VirtualNodeName" - ] - }, - "Weight": 1 - } - ] - }, - "Match": { - "Prefix": "/" - } - } - }, - "VirtualRouterName": { - "Fn::GetAtt": [ - "namedevelopmentvirtualrouter0AE5105D", - "VirtualRouterName" - ] - }, - "RouteName": "name-development-route" - } - }, - "namedevelopmentvirtualserviceD936E3FD": { - "Type": "AWS::AppMesh::VirtualService", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "developmentmeshCEC28AFE", - "MeshName" - ] - }, - "Spec": { - "Provider": { - "VirtualRouter": { - "VirtualRouterName": { - "Fn::GetAtt": [ - "namedevelopmentvirtualrouter0AE5105D", - "VirtualRouterName" - ] - } - } - } - }, - "VirtualServiceName": "name-development.development" - } - } - }, - "Mappings": { - "nameproductionenvoyimageaccountmapping": { - "ap-northeast-1": { - "ecrRepo": "840364872350" - }, - "ap-northeast-2": { - "ecrRepo": "840364872350" - }, - "ap-south-1": { - "ecrRepo": "840364872350" - }, - "ap-southeast-1": { - "ecrRepo": "840364872350" - }, - "ap-southeast-2": { - "ecrRepo": "840364872350" - }, - "ca-central-1": { - "ecrRepo": "840364872350" - }, - "cn-north-1": { - "ecrRepo": "919366029133" - }, - "cn-northwest-1": { - "ecrRepo": "919830735681" - }, - "eu-central-1": { - "ecrRepo": "840364872350" - }, - "eu-north-1": { - "ecrRepo": "840364872350" - }, - "eu-south-1": { - "ecrRepo": "422531588944" - }, - "eu-west-1": { - "ecrRepo": "840364872350" - }, - "eu-west-2": { - "ecrRepo": "840364872350" - }, - "eu-west-3": { - "ecrRepo": "840364872350" - }, - "sa-east-1": { - "ecrRepo": "840364872350" - }, - "us-east-1": { - "ecrRepo": "840364872350" - }, - "us-east-2": { - "ecrRepo": "840364872350" - }, - "us-west-1": { - "ecrRepo": "840364872350" - }, - "us-west-2": { - "ecrRepo": "840364872350" - }, - "me-south-1": { - "ecrRepo": "772975370895" - }, - "ap-east-1": { - "ecrRepo": "856666278305" - }, - "af-south-1": { - "ecrRepo": "924023996002" - } - }, - "namedevelopmentenvoyimageaccountmapping": { - "ap-northeast-1": { - "ecrRepo": "840364872350" - }, - "ap-northeast-2": { - "ecrRepo": "840364872350" - }, - "ap-south-1": { - "ecrRepo": "840364872350" - }, - "ap-southeast-1": { - "ecrRepo": "840364872350" - }, - "ap-southeast-2": { - "ecrRepo": "840364872350" - }, - "ca-central-1": { - "ecrRepo": "840364872350" - }, - "cn-north-1": { - "ecrRepo": "919366029133" - }, - "cn-northwest-1": { - "ecrRepo": "919830735681" - }, - "eu-central-1": { - "ecrRepo": "840364872350" - }, - "eu-north-1": { - "ecrRepo": "840364872350" - }, - "eu-south-1": { - "ecrRepo": "422531588944" - }, - "eu-west-1": { - "ecrRepo": "840364872350" - }, - "eu-west-2": { - "ecrRepo": "840364872350" - }, - "eu-west-3": { - "ecrRepo": "840364872350" - }, - "sa-east-1": { - "ecrRepo": "840364872350" - }, - "us-east-1": { - "ecrRepo": "840364872350" - }, - "us-east-2": { - "ecrRepo": "840364872350" - }, - "us-west-1": { - "ecrRepo": "840364872350" - }, - "us-west-2": { - "ecrRepo": "840364872350" - }, - "me-south-1": { - "ecrRepo": "772975370895" - }, - "ap-east-1": { - "ecrRepo": "856666278305" - }, - "af-south-1": { - "ecrRepo": "924023996002" - } - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.multiple-environments.ts b/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.multiple-environments.ts deleted file mode 100644 index bc5bd3f32e742..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.multiple-environments.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { Mesh } from '@aws-cdk/aws-appmesh'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as cdk from '@aws-cdk/core'; -import { Container, Environment, Service, ServiceDescription, AppMeshExtension } from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-ecs-integ'); - -const production = new Environment(stack, 'production'); -const development = new Environment(stack, 'development'); - -const productionMesh = new Mesh(stack, 'production-mesh'); -const developmentMesh = new Mesh(stack, 'development-mesh'); - -/** Production name service */ -const productionNameDescription = new ServiceDescription(); -productionNameDescription.add(new Container({ - cpu: 1024, - memoryMiB: 2048, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - environment: { - PORT: '80', - }, -})); -productionNameDescription.add(new AppMeshExtension({ mesh: productionMesh })); - -new Service(stack, 'name-production', { - environment: production, - serviceDescription: productionNameDescription, -}); - -/** Development name service */ -const developmentNameDescription = new ServiceDescription(); -developmentNameDescription.add(new Container({ - cpu: 1024, - memoryMiB: 2048, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - environment: { - PORT: '80', - }, -})); -developmentNameDescription.add(new AppMeshExtension({ mesh: developmentMesh })); - -new Service(stack, 'name-development', { - environment: development, - serviceDescription: developmentNameDescription, -}); - -/** - * This test verifies the edge case of creating multiple environments - * on the same account to ensure that there are no conflicts. - */ \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.publish-subscribe.expected.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.publish-subscribe.expected.json deleted file mode 100644 index 34ffb8672f890..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.publish-subscribe.expected.json +++ /dev/null @@ -1,1478 +0,0 @@ -{ - "Resources": { - "productionenvironmentvpcAEB47DF7": { - "Type": "AWS::EC2::VPC", - "Properties": { - "CidrBlock": "10.0.0.0/16", - "EnableDnsHostnames": true, - "EnableDnsSupport": true, - "InstanceTenancy": "default", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1Subnet8D92C089": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.0.0/19", - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "AvailabilityZone": "test-region-1a", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1RouteTableAssociationA8117374": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - } - } - }, - "productionenvironmentvpcPublicSubnet1DefaultRoute524C894D": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - }, - "DependsOn": [ - "productionenvironmentvpcVPCGW1B428D07" - ] - }, - "productionenvironmentvpcPublicSubnet1EIP54BA88DB": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1NATGateway6075E4CA": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - }, - "AllocationId": { - "Fn::GetAtt": [ - "productionenvironmentvpcPublicSubnet1EIP54BA88DB", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet2Subnet298E6C31": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.32.0/19", - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "AvailabilityZone": "test-region-1b", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet2RouteTable842A68D7": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet2RouteTableAssociation0A7549F3": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet2RouteTable842A68D7" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - } - } - }, - "productionenvironmentvpcPublicSubnet2DefaultRoute92CD697D": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet2RouteTable842A68D7" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - }, - "DependsOn": [ - "productionenvironmentvpcVPCGW1B428D07" - ] - }, - "productionenvironmentvpcPublicSubnet2EIP14CA46AA": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet2NATGatewayE1850FCC": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - }, - "AllocationId": { - "Fn::GetAtt": [ - "productionenvironmentvpcPublicSubnet2EIP14CA46AA", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet3SubnetC7B5665D": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.64.0/19", - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "AvailabilityZone": "test-region-1c", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet3" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet3RouteTable00E3BF60": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet3" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet3RouteTableAssociationFA34D6E7": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet3RouteTable00E3BF60" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet3SubnetC7B5665D" - } - } - }, - "productionenvironmentvpcPublicSubnet3DefaultRouteE1ADEA6C": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet3RouteTable00E3BF60" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - }, - "DependsOn": [ - "productionenvironmentvpcVPCGW1B428D07" - ] - }, - "productionenvironmentvpcPublicSubnet3EIP53405AED": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet3" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet3NATGateway94604057": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet3SubnetC7B5665D" - }, - "AllocationId": { - "Fn::GetAtt": [ - "productionenvironmentvpcPublicSubnet3EIP53405AED", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet3" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet1Subnet53F632E6": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.96.0/19", - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "AvailabilityZone": "test-region-1a", - "MapPublicIpOnLaunch": false, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Private" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Private" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet1RouteTableAssociation8BA32463": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - } - } - }, - "productionenvironmentvpcPrivateSubnet1DefaultRouteFBB3DE6C": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "productionenvironmentvpcPublicSubnet1NATGateway6075E4CA" - } - } - }, - "productionenvironmentvpcPrivateSubnet2Subnet756FB93C": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.128.0/19", - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "AvailabilityZone": "test-region-1b", - "MapPublicIpOnLaunch": false, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Private" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Private" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet2RouteTableAssociation09188261": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - } - }, - "productionenvironmentvpcPrivateSubnet2DefaultRoute5F9AB6C1": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "productionenvironmentvpcPublicSubnet2NATGatewayE1850FCC" - } - } - }, - "productionenvironmentvpcPrivateSubnet3Subnet3BD4064E": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "CidrBlock": "10.0.160.0/19", - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "AvailabilityZone": "test-region-1c", - "MapPublicIpOnLaunch": false, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Private" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Private" - }, - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet3" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet3RouteTable1A244D34": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet3" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet3RouteTableAssociation65F18B9C": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet3RouteTable1A244D34" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPrivateSubnet3Subnet3BD4064E" - } - } - }, - "productionenvironmentvpcPrivateSubnet3DefaultRoute2438918B": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet3RouteTable1A244D34" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "productionenvironmentvpcPublicSubnet3NATGateway94604057" - } - } - }, - "productionenvironmentvpcIGWE7C39890": { - "Type": "AWS::EC2::InternetGateway", - "Properties": { - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc" - } - ] - } - }, - "productionenvironmentvpcVPCGW1B428D07": { - "Type": "AWS::EC2::VPCGatewayAttachment", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "InternetGatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - } - }, - "productionenvironmentclusterC6599D2D": { - "Type": "AWS::ECS::Cluster" - }, - "signupD2AAA171": { - "Type": "AWS::SNS::Topic" - }, - "delete1CCE71FF": { - "Type": "AWS::SNS::Topic" - }, - "PublishertaskdefinitionTaskRoleE8655AA5": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PublishertaskdefinitionTaskRoleDefaultPolicyD6E49F15": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "sns:Publish", - "Effect": "Allow", - "Resource": [ - { - "Ref": "delete1CCE71FF" - }, - { - "Ref": "signupD2AAA171" - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PublishertaskdefinitionTaskRoleDefaultPolicyD6E49F15", - "Roles": [ - { - "Ref": "PublishertaskdefinitionTaskRoleE8655AA5" - } - ] - } - }, - "PublishertaskdefinitionA4324C64": { - "Type": "AWS::ECS::TaskDefinition", - "Properties": { - "ContainerDefinitions": [ - { - "Cpu": 256, - "Environment": [ - { - "Name": "PORT", - "Value": "80" - }, - { - "Name": "SIGN-UP_TOPIC_ARN", - "Value": { - "Ref": "signupD2AAA171" - } - }, - { - "Name": "DELETE_TOPIC_ARN", - "Value": { - "Ref": "delete1CCE71FF" - } - } - ], - "Essential": true, - "Image": "nathanpeck/name", - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "PublisherlogsDF0C1067" - }, - "awslogs-stream-prefix": "Publisher", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "Memory": 512, - "Name": "app", - "PortMappings": [ - { - "ContainerPort": 80, - "Protocol": "tcp" - } - ], - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ] - } - ], - "Cpu": "256", - "ExecutionRoleArn": { - "Fn::GetAtt": [ - "PublishertaskdefinitionExecutionRole5C00C542", - "Arn" - ] - }, - "Family": "awsecsintegPublishertaskdefinitionD50610D0", - "Memory": "512", - "NetworkMode": "awsvpc", - "RequiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "TaskRoleArn": { - "Fn::GetAtt": [ - "PublishertaskdefinitionTaskRoleE8655AA5", - "Arn" - ] - } - } - }, - "PublishertaskdefinitionExecutionRole5C00C542": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PublishertaskdefinitionExecutionRoleDefaultPolicy681FD8E6": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PublisherlogsDF0C1067", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PublishertaskdefinitionExecutionRoleDefaultPolicy681FD8E6", - "Roles": [ - { - "Ref": "PublishertaskdefinitionExecutionRole5C00C542" - } - ] - } - }, - "PublisherlogsDF0C1067": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "Publisher-logs", - "RetentionInDays": 30 - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "PublisherserviceService9EB00F60": { - "Type": "AWS::ECS::Service", - "Properties": { - "Cluster": { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "DeploymentConfiguration": { - "MaximumPercent": 200, - "MinimumHealthyPercent": 100 - }, - "DesiredCount": 1, - "EnableECSManagedTags": false, - "LaunchType": "FARGATE", - "NetworkConfiguration": { - "AwsvpcConfiguration": { - "AssignPublicIp": "DISABLED", - "SecurityGroups": [ - { - "Fn::GetAtt": [ - "PublisherserviceSecurityGroupC7B0C0D0", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - }, - { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - }, - { - "Ref": "productionenvironmentvpcPrivateSubnet3Subnet3BD4064E" - } - ] - } - }, - "TaskDefinition": { - "Ref": "PublishertaskdefinitionA4324C64" - } - } - }, - "PublisherserviceSecurityGroupC7B0C0D0": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "aws-ecs-integ/Publisher-service/SecurityGroup", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "signupqueue33AFF2E6": { - "Type": "AWS::SQS::Queue", - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "signupqueuePolicy185ADC00": { - "Type": "AWS::SQS::QueuePolicy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "sqs:SendMessage", - "Condition": { - "ArnEquals": { - "aws:SourceArn": { - "Ref": "signupD2AAA171" - } - } - }, - "Effect": "Allow", - "Principal": { - "Service": "sns.amazonaws.com" - }, - "Resource": { - "Fn::GetAtt": [ - "signupqueue33AFF2E6", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "Queues": [ - { - "Ref": "signupqueue33AFF2E6" - } - ] - } - }, - "signupqueueawsecsintegsignup8DE00B29CE828029": { - "Type": "AWS::SNS::Subscription", - "Properties": { - "Protocol": "sqs", - "TopicArn": { - "Ref": "signupD2AAA171" - }, - "Endpoint": { - "Fn::GetAtt": [ - "signupqueue33AFF2E6", - "Arn" - ] - } - } - }, - "EventsDeadLetterQueue404572C7": { - "Type": "AWS::SQS::Queue", - "Properties": { - "MessageRetentionPeriod": 1209600 - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "EventsQueueB96EB0D2": { - "Type": "AWS::SQS::Queue", - "Properties": { - "RedrivePolicy": { - "deadLetterTargetArn": { - "Fn::GetAtt": [ - "EventsDeadLetterQueue404572C7", - "Arn" - ] - }, - "maxReceiveCount": 3 - } - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "EventsQueuePolicyF3E925EC": { - "Type": "AWS::SQS::QueuePolicy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "sqs:SendMessage", - "Condition": { - "ArnEquals": { - "aws:SourceArn": { - "Ref": "delete1CCE71FF" - } - } - }, - "Effect": "Allow", - "Principal": { - "Service": "sns.amazonaws.com" - }, - "Resource": { - "Fn::GetAtt": [ - "EventsQueueB96EB0D2", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "Queues": [ - { - "Ref": "EventsQueueB96EB0D2" - } - ] - } - }, - "EventsQueueawsecsintegdeleteF56807768162F4C0": { - "Type": "AWS::SNS::Subscription", - "Properties": { - "Protocol": "sqs", - "TopicArn": { - "Ref": "delete1CCE71FF" - }, - "Endpoint": { - "Fn::GetAtt": [ - "EventsQueueB96EB0D2", - "Arn" - ] - } - } - }, - "WorkertaskdefinitionTaskRole1EBF20D6": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "WorkertaskdefinitionTaskRoleDefaultPolicy45EAFD8C": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "sqs:ChangeMessageVisibility", - "sqs:DeleteMessage", - "sqs:GetQueueAttributes", - "sqs:GetQueueUrl", - "sqs:ReceiveMessage" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "EventsQueueB96EB0D2", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "signupqueue33AFF2E6", - "Arn" - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "WorkertaskdefinitionTaskRoleDefaultPolicy45EAFD8C", - "Roles": [ - { - "Ref": "WorkertaskdefinitionTaskRole1EBF20D6" - } - ] - } - }, - "WorkertaskdefinitionBF93A675": { - "Type": "AWS::ECS::TaskDefinition", - "Properties": { - "ContainerDefinitions": [ - { - "Cpu": 256, - "Environment": [ - { - "Name": "PORT", - "Value": "80" - }, - { - "Name": "WORKER_QUEUE_URI", - "Value": { - "Ref": "EventsQueueB96EB0D2" - } - } - ], - "Essential": true, - "Image": "nathanpeck/name", - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "Workerlogs2994AC4D" - }, - "awslogs-stream-prefix": "Worker", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "Memory": 512, - "Name": "app", - "PortMappings": [ - { - "ContainerPort": 80, - "Protocol": "tcp" - } - ], - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ] - } - ], - "Cpu": "256", - "ExecutionRoleArn": { - "Fn::GetAtt": [ - "WorkertaskdefinitionExecutionRole3C1A1848", - "Arn" - ] - }, - "Family": "awsecsintegWorkertaskdefinition32B60762", - "Memory": "512", - "NetworkMode": "awsvpc", - "RequiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "TaskRoleArn": { - "Fn::GetAtt": [ - "WorkertaskdefinitionTaskRole1EBF20D6", - "Arn" - ] - } - } - }, - "WorkertaskdefinitionExecutionRole3C1A1848": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "WorkertaskdefinitionExecutionRoleDefaultPolicy6E199B19": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "Workerlogs2994AC4D", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "WorkertaskdefinitionExecutionRoleDefaultPolicy6E199B19", - "Roles": [ - { - "Ref": "WorkertaskdefinitionExecutionRole3C1A1848" - } - ] - } - }, - "Workerlogs2994AC4D": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "Worker-logs", - "RetentionInDays": 30 - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "WorkerserviceService68C5A5C3": { - "Type": "AWS::ECS::Service", - "Properties": { - "Cluster": { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "DeploymentConfiguration": { - "MaximumPercent": 200, - "MinimumHealthyPercent": 100 - }, - "EnableECSManagedTags": false, - "LaunchType": "FARGATE", - "NetworkConfiguration": { - "AwsvpcConfiguration": { - "AssignPublicIp": "DISABLED", - "SecurityGroups": [ - { - "Fn::GetAtt": [ - "WorkerserviceSecurityGroup1CDDB904", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - }, - { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - }, - { - "Ref": "productionenvironmentvpcPrivateSubnet3Subnet3BD4064E" - } - ] - } - }, - "TaskDefinition": { - "Ref": "WorkertaskdefinitionBF93A675" - } - } - }, - "WorkerserviceSecurityGroup1CDDB904": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "aws-ecs-integ/Worker-service/SecurityGroup", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "WorkerserviceTaskCountTarget6636D808": { - "Type": "AWS::ApplicationAutoScaling::ScalableTarget", - "Properties": { - "MaxCapacity": 10, - "MinCapacity": 1, - "ResourceId": { - "Fn::Join": [ - "", - [ - "service/", - { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "/", - { - "Fn::GetAtt": [ - "WorkerserviceService68C5A5C3", - "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" - } - }, - "WorkerserviceTaskCountTargetEventsQueueautoscalingpolicyD12B62ED": { - "Type": "AWS::ApplicationAutoScaling::ScalingPolicy", - "Properties": { - "PolicyName": "awsecsintegWorkerserviceTaskCountTargetEventsQueueautoscalingpolicyDBD40B57", - "PolicyType": "TargetTrackingScaling", - "ScalingTargetId": { - "Ref": "WorkerserviceTaskCountTarget6636D808" - }, - "TargetTrackingScalingPolicyConfiguration": { - "CustomizedMetricSpecification": { - "Dimensions": [ - { - "Name": "QueueName", - "Value": { - "Fn::GetAtt": [ - "EventsQueueB96EB0D2", - "QueueName" - ] - } - } - ], - "MetricName": "BacklogPerTask", - "Namespace": "production-Worker", - "Statistic": "Average", - "Unit": "Count" - }, - "TargetValue": 15 - } - } - }, - "WorkerserviceTaskCountTargetsignupqueueautoscalingpolicyB7321DB7": { - "Type": "AWS::ApplicationAutoScaling::ScalingPolicy", - "Properties": { - "PolicyName": "awsecsintegWorkerserviceTaskCountTargetsignupqueueautoscalingpolicyDF93FC37", - "PolicyType": "TargetTrackingScaling", - "ScalingTargetId": { - "Ref": "WorkerserviceTaskCountTarget6636D808" - }, - "TargetTrackingScalingPolicyConfiguration": { - "CustomizedMetricSpecification": { - "Dimensions": [ - { - "Name": "QueueName", - "Value": { - "Fn::GetAtt": [ - "signupqueue33AFF2E6", - "QueueName" - ] - } - } - ], - "MetricName": "BacklogPerTask", - "Namespace": "production-Worker", - "Statistic": "Average", - "Unit": "Count" - }, - "TargetValue": 30 - } - } - }, - "BackLogPerTaskCalculatorFunctionServiceRoleEFA723A4": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - ] - ] - } - ] - } - }, - "BackLogPerTaskCalculatorFunctionServiceRoleDefaultPolicyB6B10266": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "ecs:DescribeServices", - "Condition": { - "ArnEquals": { - "ecs:cluster": { - "Fn::GetAtt": [ - "productionenvironmentclusterC6599D2D", - "Arn" - ] - } - } - }, - "Effect": "Allow", - "Resource": { - "Ref": "WorkerserviceService68C5A5C3" - } - }, - { - "Action": [ - "sqs:GetQueueAttributes", - "sqs:GetQueueUrl" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "EventsQueueB96EB0D2", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "signupqueue33AFF2E6", - "Arn" - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "BackLogPerTaskCalculatorFunctionServiceRoleDefaultPolicyB6B10266", - "Roles": [ - { - "Ref": "BackLogPerTaskCalculatorFunctionServiceRoleEFA723A4" - } - ] - } - }, - "BackLogPerTaskCalculatorFunction95AA21D5": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Ref": "AssetParametersa820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91S3Bucket1FFDEA8D" - }, - "S3Key": { - "Fn::Join": [ - "", - [ - { - "Fn::Select": [ - 0, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParametersa820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91S3VersionKeyA60C027B" - } - ] - } - ] - }, - { - "Fn::Select": [ - 1, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParametersa820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91S3VersionKeyA60C027B" - } - ] - } - ] - } - ] - ] - } - }, - "Role": { - "Fn::GetAtt": [ - "BackLogPerTaskCalculatorFunctionServiceRoleEFA723A4", - "Arn" - ] - }, - "Environment": { - "Variables": { - "CLUSTER_NAME": { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "SERVICE_NAME": { - "Fn::GetAtt": [ - "WorkerserviceService68C5A5C3", - "Name" - ] - }, - "NAMESPACE": "production-Worker", - "QUEUE_NAMES": { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "EventsQueueB96EB0D2", - "QueueName" - ] - }, - ",", - { - "Fn::GetAtt": [ - "signupqueue33AFF2E6", - "QueueName" - ] - } - ] - ] - } - } - }, - "Handler": "index.queue_handler", - "Runtime": "python3.9" - }, - "DependsOn": [ - "BackLogPerTaskCalculatorFunctionServiceRoleDefaultPolicyB6B10266", - "BackLogPerTaskCalculatorFunctionServiceRoleEFA723A4" - ] - }, - "BacklogPerTaskScheduledRuleB871DD15": { - "Type": "AWS::Events::Rule", - "Properties": { - "ScheduleExpression": "rate(1 minute)", - "State": "ENABLED", - "Targets": [ - { - "Arn": { - "Fn::GetAtt": [ - "BackLogPerTaskCalculatorFunction95AA21D5", - "Arn" - ] - }, - "Id": "Target0" - } - ] - } - }, - "BacklogPerTaskScheduledRuleAllowEventRuleawsecsintegBackLogPerTaskCalculatorFunctionEB2B91C7CCD725BB": { - "Type": "AWS::Lambda::Permission", - "Properties": { - "Action": "lambda:InvokeFunction", - "FunctionName": { - "Fn::GetAtt": [ - "BackLogPerTaskCalculatorFunction95AA21D5", - "Arn" - ] - }, - "Principal": "events.amazonaws.com", - "SourceArn": { - "Fn::GetAtt": [ - "BacklogPerTaskScheduledRuleB871DD15", - "Arn" - ] - } - } - }, - "WorkerBackLogPerTaskCalculatorLogsA4B5AF42": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": { - "Fn::Join": [ - "", - [ - "/aws/lambda/", - { - "Ref": "BackLogPerTaskCalculatorFunction95AA21D5" - } - ] - ] - }, - "RetentionInDays": 3 - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - } - }, - "Parameters": { - "AssetParametersa820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91S3Bucket1FFDEA8D": { - "Type": "String", - "Description": "S3 bucket for asset \"a820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91\"" - }, - "AssetParametersa820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91S3VersionKeyA60C027B": { - "Type": "String", - "Description": "S3 key for asset version \"a820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91\"" - }, - "AssetParametersa820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91ArtifactHashC1953821": { - "Type": "String", - "Description": "Artifact hash for asset \"a820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91\"" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.publish-subscribe.ts b/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.publish-subscribe.ts deleted file mode 100644 index 9cef50adce4c0..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/integ.publish-subscribe.ts +++ /dev/null @@ -1,82 +0,0 @@ -import * as ecs from '@aws-cdk/aws-ecs'; -import * as sns from '@aws-cdk/aws-sns'; -import * as sqs from '@aws-cdk/aws-sqs'; -import * as cdk from '@aws-cdk/core'; -import { Container, Environment, InjecterExtension, InjectableTopic, QueueExtension, Service, ServiceDescription, TopicSubscription } from '../lib'; - - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-ecs-integ'); - -const environment = new Environment(stack, 'production'); - -const pubServiceDescription = new ServiceDescription(); - -pubServiceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - environment: { - PORT: '80', - }, -})); - -const topic1 = new InjectableTopic({ - topic: new sns.Topic(stack, 'sign-up'), -}); - -const topic2 = new InjectableTopic({ - topic: new sns.Topic(stack, 'delete'), -}); - -pubServiceDescription.add(new InjecterExtension({ - injectables: [topic1, topic2], -})); - -new Service(stack, 'Publisher', { - environment: environment, - serviceDescription: pubServiceDescription, -}); - -const subServiceDescription = new ServiceDescription(); - -subServiceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - environment: { - PORT: '80', - }, -})); - -const topicSubscription1 = new TopicSubscription({ - topic: topic1.topic, - topicSubscriptionQueue: { - queue: new sqs.Queue(stack, 'sign-up-queue'), - scaleOnLatency: { - acceptableLatency: cdk.Duration.minutes(10), - messageProcessingTime: cdk.Duration.seconds(20), - }, - }, -}); -const topicSubscription2 = new TopicSubscription({ - topic: topic2.topic, -}); - -subServiceDescription.add(new QueueExtension({ - subscriptions: [topicSubscription1, topicSubscription2], - scaleOnLatency: { - acceptableLatency: cdk.Duration.minutes(5), - messageProcessingTime: cdk.Duration.seconds(20), - }, -})); - -new Service(stack, 'Worker', { - environment: environment, - serviceDescription: subServiceDescription, - autoScaleTaskCount: { - maxTaskCount: 10, - }, -}); \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/multiple-environments.integ.snapshot/aws-ecs-integ.assets.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/multiple-environments.integ.snapshot/aws-ecs-integ.assets.json deleted file mode 100644 index a861676b9d655..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/multiple-environments.integ.snapshot/aws-ecs-integ.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "20.0.0", - "files": { - "1c4ad1ddd84ec62cd00e1c01c2971172dcc3acca3cf10509e3f7dca20433d2e3": { - "source": { - "path": "aws-ecs-integ.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "1c4ad1ddd84ec62cd00e1c01c2971172dcc3acca3cf10509e3f7dca20433d2e3.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-containers/ecs-service-extensions/test/multiple-environments.integ.snapshot/aws-ecs-integ.template.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/multiple-environments.integ.snapshot/aws-ecs-integ.template.json deleted file mode 100644 index c8a1d5bae0905..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/multiple-environments.integ.snapshot/aws-ecs-integ.template.json +++ /dev/null @@ -1,2070 +0,0 @@ -{ - "Resources": { - "productionenvironmentvpcAEB47DF7": { - "Type": "AWS::EC2::VPC", - "Properties": { - "CidrBlock": "10.0.0.0/16", - "EnableDnsHostnames": true, - "EnableDnsSupport": true, - "InstanceTenancy": "default", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1Subnet8D92C089": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1RouteTableAssociationA8117374": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - } - } - }, - "productionenvironmentvpcPublicSubnet1DefaultRoute524C894D": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - }, - "DependsOn": [ - "productionenvironmentvpcVPCGW1B428D07" - ] - }, - "productionenvironmentvpcPublicSubnet1EIP54BA88DB": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1NATGateway6075E4CA": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - }, - "AllocationId": { - "Fn::GetAtt": [ - "productionenvironmentvpcPublicSubnet1EIP54BA88DB", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - }, - "DependsOn": [ - "productionenvironmentvpcPublicSubnet1DefaultRoute524C894D", - "productionenvironmentvpcPublicSubnet1RouteTableAssociationA8117374" - ] - }, - "productionenvironmentvpcPublicSubnet2Subnet298E6C31": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet2RouteTable842A68D7": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet2RouteTableAssociation0A7549F3": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet2RouteTable842A68D7" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - } - } - }, - "productionenvironmentvpcPublicSubnet2DefaultRoute92CD697D": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet2RouteTable842A68D7" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - }, - "DependsOn": [ - "productionenvironmentvpcVPCGW1B428D07" - ] - }, - "productionenvironmentvpcPublicSubnet2EIP14CA46AA": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet2NATGatewayE1850FCC": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - }, - "AllocationId": { - "Fn::GetAtt": [ - "productionenvironmentvpcPublicSubnet2EIP14CA46AA", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - }, - "DependsOn": [ - "productionenvironmentvpcPublicSubnet2DefaultRoute92CD697D", - "productionenvironmentvpcPublicSubnet2RouteTableAssociation0A7549F3" - ] - }, - "productionenvironmentvpcPrivateSubnet1Subnet53F632E6": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet1RouteTableAssociation8BA32463": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - } - } - }, - "productionenvironmentvpcPrivateSubnet1DefaultRouteFBB3DE6C": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "productionenvironmentvpcPublicSubnet1NATGateway6075E4CA" - } - } - }, - "productionenvironmentvpcPrivateSubnet2Subnet756FB93C": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet2RouteTableAssociation09188261": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - } - }, - "productionenvironmentvpcPrivateSubnet2DefaultRoute5F9AB6C1": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "productionenvironmentvpcPublicSubnet2NATGatewayE1850FCC" - } - } - }, - "productionenvironmentvpcIGWE7C39890": { - "Type": "AWS::EC2::InternetGateway", - "Properties": { - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc" - } - ] - } - }, - "productionenvironmentvpcVPCGW1B428D07": { - "Type": "AWS::EC2::VPCGatewayAttachment", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "InternetGatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - } - }, - "productionenvironmentclusterC6599D2D": { - "Type": "AWS::ECS::Cluster" - }, - "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D": { - "Type": "AWS::ServiceDiscovery::PrivateDnsNamespace", - "Properties": { - "Name": "production", - "Vpc": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "developmentenvironmentvpcCB4216A4": { - "Type": "AWS::EC2::VPC", - "Properties": { - "CidrBlock": "10.0.0.0/16", - "EnableDnsHostnames": true, - "EnableDnsSupport": true, - "InstanceTenancy": "default", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc" - } - ] - } - }, - "developmentenvironmentvpcPublicSubnet1Subnet0D18046B": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "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-integ/development-environment-vpc/PublicSubnet1" - } - ] - } - }, - "developmentenvironmentvpcPublicSubnet1RouteTable8FC58983": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc/PublicSubnet1" - } - ] - } - }, - "developmentenvironmentvpcPublicSubnet1RouteTableAssociation8F257A0C": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "developmentenvironmentvpcPublicSubnet1RouteTable8FC58983" - }, - "SubnetId": { - "Ref": "developmentenvironmentvpcPublicSubnet1Subnet0D18046B" - } - } - }, - "developmentenvironmentvpcPublicSubnet1DefaultRoute2BAA794D": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "developmentenvironmentvpcPublicSubnet1RouteTable8FC58983" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "developmentenvironmentvpcIGW2B4E91B1" - } - }, - "DependsOn": [ - "developmentenvironmentvpcVPCGW702C2C38" - ] - }, - "developmentenvironmentvpcPublicSubnet1EIPE8B9F4D4": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc/PublicSubnet1" - } - ] - } - }, - "developmentenvironmentvpcPublicSubnet1NATGateway6B01CC4E": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "developmentenvironmentvpcPublicSubnet1Subnet0D18046B" - }, - "AllocationId": { - "Fn::GetAtt": [ - "developmentenvironmentvpcPublicSubnet1EIPE8B9F4D4", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc/PublicSubnet1" - } - ] - }, - "DependsOn": [ - "developmentenvironmentvpcPublicSubnet1DefaultRoute2BAA794D", - "developmentenvironmentvpcPublicSubnet1RouteTableAssociation8F257A0C" - ] - }, - "developmentenvironmentvpcPublicSubnet2SubnetC2026CD3": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "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-integ/development-environment-vpc/PublicSubnet2" - } - ] - } - }, - "developmentenvironmentvpcPublicSubnet2RouteTable803A92C2": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc/PublicSubnet2" - } - ] - } - }, - "developmentenvironmentvpcPublicSubnet2RouteTableAssociation6630985C": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "developmentenvironmentvpcPublicSubnet2RouteTable803A92C2" - }, - "SubnetId": { - "Ref": "developmentenvironmentvpcPublicSubnet2SubnetC2026CD3" - } - } - }, - "developmentenvironmentvpcPublicSubnet2DefaultRoute2C5118B5": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "developmentenvironmentvpcPublicSubnet2RouteTable803A92C2" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "developmentenvironmentvpcIGW2B4E91B1" - } - }, - "DependsOn": [ - "developmentenvironmentvpcVPCGW702C2C38" - ] - }, - "developmentenvironmentvpcPublicSubnet2EIP560C2BBA": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc/PublicSubnet2" - } - ] - } - }, - "developmentenvironmentvpcPublicSubnet2NATGateway15A9C252": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "developmentenvironmentvpcPublicSubnet2SubnetC2026CD3" - }, - "AllocationId": { - "Fn::GetAtt": [ - "developmentenvironmentvpcPublicSubnet2EIP560C2BBA", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc/PublicSubnet2" - } - ] - }, - "DependsOn": [ - "developmentenvironmentvpcPublicSubnet2DefaultRoute2C5118B5", - "developmentenvironmentvpcPublicSubnet2RouteTableAssociation6630985C" - ] - }, - "developmentenvironmentvpcPrivateSubnet1SubnetAAECD171": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "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-integ/development-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "developmentenvironmentvpcPrivateSubnet1RouteTable29CEB1DB": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "developmentenvironmentvpcPrivateSubnet1RouteTableAssociation95EE92E6": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "developmentenvironmentvpcPrivateSubnet1RouteTable29CEB1DB" - }, - "SubnetId": { - "Ref": "developmentenvironmentvpcPrivateSubnet1SubnetAAECD171" - } - } - }, - "developmentenvironmentvpcPrivateSubnet1DefaultRoute1813B5F3": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "developmentenvironmentvpcPrivateSubnet1RouteTable29CEB1DB" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "developmentenvironmentvpcPublicSubnet1NATGateway6B01CC4E" - } - } - }, - "developmentenvironmentvpcPrivateSubnet2Subnet20C1C37D": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "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-integ/development-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "developmentenvironmentvpcPrivateSubnet2RouteTable687AB03B": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "developmentenvironmentvpcPrivateSubnet2RouteTableAssociation1C336DAE": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "developmentenvironmentvpcPrivateSubnet2RouteTable687AB03B" - }, - "SubnetId": { - "Ref": "developmentenvironmentvpcPrivateSubnet2Subnet20C1C37D" - } - } - }, - "developmentenvironmentvpcPrivateSubnet2DefaultRoute1B4A6D0D": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "developmentenvironmentvpcPrivateSubnet2RouteTable687AB03B" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "developmentenvironmentvpcPublicSubnet2NATGateway15A9C252" - } - } - }, - "developmentenvironmentvpcIGW2B4E91B1": { - "Type": "AWS::EC2::InternetGateway", - "Properties": { - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/development-environment-vpc" - } - ] - } - }, - "developmentenvironmentvpcVPCGW702C2C38": { - "Type": "AWS::EC2::VPCGatewayAttachment", - "Properties": { - "VpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "InternetGatewayId": { - "Ref": "developmentenvironmentvpcIGW2B4E91B1" - } - } - }, - "developmentenvironmentcluster1B64BE8B": { - "Type": "AWS::ECS::Cluster" - }, - "developmentenvironmentclusterDefaultServiceDiscoveryNamespace0F234767": { - "Type": "AWS::ServiceDiscovery::PrivateDnsNamespace", - "Properties": { - "Name": "development", - "Vpc": { - "Ref": "developmentenvironmentvpcCB4216A4" - } - } - }, - "productionmeshB6E81744": { - "Type": "AWS::AppMesh::Mesh", - "Properties": { - "MeshName": "awsecsintegproductionmesh1A4ED585", - "Spec": {} - } - }, - "developmentmeshCEC28AFE": { - "Type": "AWS::AppMesh::Mesh", - "Properties": { - "MeshName": "awsecsintegdevelopmentmeshEFC35179", - "Spec": {} - } - }, - "nameproductiontaskdefinitionTaskRole93E922EB": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "nameproductiontaskdefinition33A5D5E0": { - "Type": "AWS::ECS::TaskDefinition", - "Properties": { - "ContainerDefinitions": [ - { - "Cpu": 1024, - "DependsOn": [ - { - "Condition": "HEALTHY", - "ContainerName": "envoy" - } - ], - "Environment": [ - { - "Name": "PORT", - "Value": "80" - } - ], - "Essential": true, - "Image": "nathanpeck/name", - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "nameproductionlogsD0BFFE8C" - }, - "awslogs-stream-prefix": "name-production", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "Memory": 2048, - "Name": "app", - "PortMappings": [ - { - "ContainerPort": 80, - "Protocol": "tcp" - } - ], - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ] - }, - { - "Environment": [ - { - "Name": "APPMESH_VIRTUAL_NODE_NAME", - "Value": { - "Fn::Join": [ - "", - [ - "mesh/", - { - "Fn::GetAtt": [ - "productionmeshB6E81744", - "MeshName" - ] - }, - "/virtualNode/name-production" - ] - ] - } - }, - { - "Name": "AWS_REGION", - "Value": { - "Ref": "AWS::Region" - } - }, - { - "Name": "ENABLE_ENVOY_STATS_TAGS", - "Value": "1" - }, - { - "Name": "ENABLE_ENVOY_DOG_STATSD", - "Value": "1" - } - ], - "Essential": true, - "HealthCheck": { - "Command": [ - "CMD-SHELL", - "curl -s http://localhost:9901/server_info | grep state | grep -q LIVE" - ], - "Interval": 5, - "Retries": 3, - "StartPeriod": 10, - "Timeout": 2 - }, - "Image": { - "Fn::Join": [ - "", - [ - { - "Fn::FindInMap": [ - "nameproductionenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ".dkr.ecr.", - { - "Ref": "AWS::Region" - }, - ".", - { - "Ref": "AWS::URLSuffix" - }, - "/aws-appmesh-envoy:v1.15.1.0-prod" - ] - ] - }, - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "nameproductiontaskdefinitionenvoyLogGroupF79A2732" - }, - "awslogs-stream-prefix": "envoy", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "MemoryReservation": 128, - "Name": "envoy", - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ], - "User": "1337" - } - ], - "Cpu": "1024", - "ExecutionRoleArn": { - "Fn::GetAtt": [ - "nameproductiontaskdefinitionExecutionRoleB72DD86B", - "Arn" - ] - }, - "Family": "awsecsintegnameproductiontaskdefinition9E1C363B", - "Memory": "2048", - "NetworkMode": "awsvpc", - "ProxyConfiguration": { - "ContainerName": "envoy", - "ProxyConfigurationProperties": [ - { - "Name": "AppPorts", - "Value": "80" - }, - { - "Name": "ProxyEgressPort", - "Value": "15001" - }, - { - "Name": "ProxyIngressPort", - "Value": "15000" - }, - { - "Name": "IgnoredUID", - "Value": "1337" - }, - { - "Name": "IgnoredGID", - "Value": "1338" - }, - { - "Name": "EgressIgnoredIPs", - "Value": "169.254.170.2,169.254.169.254" - } - ], - "Type": "APPMESH" - }, - "RequiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "TaskRoleArn": { - "Fn::GetAtt": [ - "nameproductiontaskdefinitionTaskRole93E922EB", - "Arn" - ] - } - } - }, - "nameproductiontaskdefinitionExecutionRoleB72DD86B": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "nameproductiontaskdefinitionExecutionRoleDefaultPolicyB66C67BE": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "nameproductionlogsD0BFFE8C", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "nameproductiontaskdefinitionenvoyLogGroupF79A2732", - "Arn" - ] - } - ] - }, - { - "Action": [ - "ecr:BatchCheckLayerAvailability", - "ecr:BatchGetImage", - "ecr:GetDownloadUrlForLayer" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ecr:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Fn::FindInMap": [ - "nameproductionenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ":repository/aws-appmesh-envoy" - ] - ] - } - }, - { - "Action": "ecr:GetAuthorizationToken", - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "nameproductiontaskdefinitionExecutionRoleDefaultPolicyB66C67BE", - "Roles": [ - { - "Ref": "nameproductiontaskdefinitionExecutionRoleB72DD86B" - } - ] - } - }, - "nameproductiontaskdefinitionenvoyLogGroupF79A2732": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "nameproductionlogsD0BFFE8C": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "name-production-logs", - "RetentionInDays": 30 - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "nameproductionenvoytoappmesh1B44B04A": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "appmesh:StreamAggregatedResources", - "Effect": "Allow", - "Resource": { - "Ref": "productionmeshB6E81744" - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "nameproductionenvoytoappmesh1B44B04A", - "Roles": [ - { - "Ref": "nameproductiontaskdefinitionTaskRole93E922EB" - } - ] - } - }, - "nameproductionserviceServiceB2D31516": { - "Type": "AWS::ECS::Service", - "Properties": { - "Cluster": { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "DeploymentConfiguration": { - "MaximumPercent": 200, - "MinimumHealthyPercent": 100 - }, - "DesiredCount": 1, - "EnableECSManagedTags": false, - "LaunchType": "FARGATE", - "NetworkConfiguration": { - "AwsvpcConfiguration": { - "AssignPublicIp": "DISABLED", - "SecurityGroups": [ - { - "Fn::GetAtt": [ - "nameproductionserviceSecurityGroupF496E439", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - }, - { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - ] - } - }, - "ServiceRegistries": [ - { - "RegistryArn": { - "Fn::GetAtt": [ - "nameproductionserviceCloudmapService60E3273A", - "Arn" - ] - } - } - ], - "TaskDefinition": { - "Ref": "nameproductiontaskdefinition33A5D5E0" - } - } - }, - "nameproductionserviceCloudmapService60E3273A": { - "Type": "AWS::ServiceDiscovery::Service", - "Properties": { - "DnsConfig": { - "DnsRecords": [ - { - "TTL": 10, - "Type": "A" - } - ], - "NamespaceId": { - "Fn::GetAtt": [ - "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D", - "Id" - ] - }, - "RoutingPolicy": "MULTIVALUE" - }, - "HealthCheckCustomConfig": { - "FailureThreshold": 2 - }, - "Name": "name-production", - "NamespaceId": { - "Fn::GetAtt": [ - "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D", - "Id" - ] - } - } - }, - "nameproductionserviceSecurityGroupF496E439": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "aws-ecs-integ/name-production-service/SecurityGroup", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "nameproductionvirtualnodeC78443D9": { - "Type": "AWS::AppMesh::VirtualNode", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "productionmeshB6E81744", - "MeshName" - ] - }, - "Spec": { - "Listeners": [ - { - "PortMapping": { - "Port": 80, - "Protocol": "http" - } - } - ], - "ServiceDiscovery": { - "AWSCloudMap": { - "NamespaceName": "production", - "ServiceName": { - "Fn::GetAtt": [ - "nameproductionserviceCloudmapService60E3273A", - "Name" - ] - } - } - } - }, - "VirtualNodeName": "name-production" - } - }, - "nameproductionvirtualrouter00E3366D": { - "Type": "AWS::AppMesh::VirtualRouter", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "productionmeshB6E81744", - "MeshName" - ] - }, - "Spec": { - "Listeners": [ - { - "PortMapping": { - "Port": 80, - "Protocol": "http" - } - } - ] - }, - "VirtualRouterName": "name-production" - } - }, - "nameproductionvirtualrouternameproductionrouteE886BEFD": { - "Type": "AWS::AppMesh::Route", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "productionmeshB6E81744", - "MeshName" - ] - }, - "Spec": { - "HttpRoute": { - "Action": { - "WeightedTargets": [ - { - "VirtualNode": { - "Fn::GetAtt": [ - "nameproductionvirtualnodeC78443D9", - "VirtualNodeName" - ] - }, - "Weight": 1 - } - ] - }, - "Match": { - "Prefix": "/" - } - } - }, - "VirtualRouterName": { - "Fn::GetAtt": [ - "nameproductionvirtualrouter00E3366D", - "VirtualRouterName" - ] - }, - "RouteName": "name-production-route" - } - }, - "nameproductionvirtualservice4D49D5F6": { - "Type": "AWS::AppMesh::VirtualService", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "productionmeshB6E81744", - "MeshName" - ] - }, - "Spec": { - "Provider": { - "VirtualRouter": { - "VirtualRouterName": { - "Fn::GetAtt": [ - "nameproductionvirtualrouter00E3366D", - "VirtualRouterName" - ] - } - } - } - }, - "VirtualServiceName": "name-production.production" - } - }, - "namedevelopmenttaskdefinitionTaskRole66A85BBB": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "namedevelopmenttaskdefinition0468FBFF": { - "Type": "AWS::ECS::TaskDefinition", - "Properties": { - "ContainerDefinitions": [ - { - "Cpu": 1024, - "DependsOn": [ - { - "Condition": "HEALTHY", - "ContainerName": "envoy" - } - ], - "Environment": [ - { - "Name": "PORT", - "Value": "80" - } - ], - "Essential": true, - "Image": "nathanpeck/name", - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "namedevelopmentlogs108670CC" - }, - "awslogs-stream-prefix": "name-development", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "Memory": 2048, - "Name": "app", - "PortMappings": [ - { - "ContainerPort": 80, - "Protocol": "tcp" - } - ], - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ] - }, - { - "Environment": [ - { - "Name": "APPMESH_VIRTUAL_NODE_NAME", - "Value": { - "Fn::Join": [ - "", - [ - "mesh/", - { - "Fn::GetAtt": [ - "developmentmeshCEC28AFE", - "MeshName" - ] - }, - "/virtualNode/name-development" - ] - ] - } - }, - { - "Name": "AWS_REGION", - "Value": { - "Ref": "AWS::Region" - } - }, - { - "Name": "ENABLE_ENVOY_STATS_TAGS", - "Value": "1" - }, - { - "Name": "ENABLE_ENVOY_DOG_STATSD", - "Value": "1" - } - ], - "Essential": true, - "HealthCheck": { - "Command": [ - "CMD-SHELL", - "curl -s http://localhost:9901/server_info | grep state | grep -q LIVE" - ], - "Interval": 5, - "Retries": 3, - "StartPeriod": 10, - "Timeout": 2 - }, - "Image": { - "Fn::Join": [ - "", - [ - { - "Fn::FindInMap": [ - "namedevelopmentenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ".dkr.ecr.", - { - "Ref": "AWS::Region" - }, - ".", - { - "Ref": "AWS::URLSuffix" - }, - "/aws-appmesh-envoy:v1.15.1.0-prod" - ] - ] - }, - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "namedevelopmenttaskdefinitionenvoyLogGroupF8FCAFD6" - }, - "awslogs-stream-prefix": "envoy", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "MemoryReservation": 128, - "Name": "envoy", - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ], - "User": "1337" - } - ], - "Cpu": "1024", - "ExecutionRoleArn": { - "Fn::GetAtt": [ - "namedevelopmenttaskdefinitionExecutionRole48B53E4E", - "Arn" - ] - }, - "Family": "awsecsintegnamedevelopmenttaskdefinitionC3797E10", - "Memory": "2048", - "NetworkMode": "awsvpc", - "ProxyConfiguration": { - "ContainerName": "envoy", - "ProxyConfigurationProperties": [ - { - "Name": "AppPorts", - "Value": "80" - }, - { - "Name": "ProxyEgressPort", - "Value": "15001" - }, - { - "Name": "ProxyIngressPort", - "Value": "15000" - }, - { - "Name": "IgnoredUID", - "Value": "1337" - }, - { - "Name": "IgnoredGID", - "Value": "1338" - }, - { - "Name": "EgressIgnoredIPs", - "Value": "169.254.170.2,169.254.169.254" - } - ], - "Type": "APPMESH" - }, - "RequiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "TaskRoleArn": { - "Fn::GetAtt": [ - "namedevelopmenttaskdefinitionTaskRole66A85BBB", - "Arn" - ] - } - } - }, - "namedevelopmenttaskdefinitionExecutionRole48B53E4E": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "namedevelopmenttaskdefinitionExecutionRoleDefaultPolicy34EAA008": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "namedevelopmentlogs108670CC", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "namedevelopmenttaskdefinitionenvoyLogGroupF8FCAFD6", - "Arn" - ] - } - ] - }, - { - "Action": [ - "ecr:BatchCheckLayerAvailability", - "ecr:BatchGetImage", - "ecr:GetDownloadUrlForLayer" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ecr:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Fn::FindInMap": [ - "namedevelopmentenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ":repository/aws-appmesh-envoy" - ] - ] - } - }, - { - "Action": "ecr:GetAuthorizationToken", - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "namedevelopmenttaskdefinitionExecutionRoleDefaultPolicy34EAA008", - "Roles": [ - { - "Ref": "namedevelopmenttaskdefinitionExecutionRole48B53E4E" - } - ] - } - }, - "namedevelopmenttaskdefinitionenvoyLogGroupF8FCAFD6": { - "Type": "AWS::Logs::LogGroup", - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "namedevelopmentlogs108670CC": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "name-development-logs", - "RetentionInDays": 30 - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "namedevelopmentenvoytoappmesh45FF08AA": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "appmesh:StreamAggregatedResources", - "Effect": "Allow", - "Resource": { - "Ref": "developmentmeshCEC28AFE" - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "namedevelopmentenvoytoappmesh45FF08AA", - "Roles": [ - { - "Ref": "namedevelopmenttaskdefinitionTaskRole66A85BBB" - } - ] - } - }, - "namedevelopmentserviceService8A24F793": { - "Type": "AWS::ECS::Service", - "Properties": { - "Cluster": { - "Ref": "developmentenvironmentcluster1B64BE8B" - }, - "DeploymentConfiguration": { - "MaximumPercent": 200, - "MinimumHealthyPercent": 100 - }, - "DesiredCount": 1, - "EnableECSManagedTags": false, - "LaunchType": "FARGATE", - "NetworkConfiguration": { - "AwsvpcConfiguration": { - "AssignPublicIp": "DISABLED", - "SecurityGroups": [ - { - "Fn::GetAtt": [ - "namedevelopmentserviceSecurityGroupE2ECED97", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Ref": "developmentenvironmentvpcPrivateSubnet1SubnetAAECD171" - }, - { - "Ref": "developmentenvironmentvpcPrivateSubnet2Subnet20C1C37D" - } - ] - } - }, - "ServiceRegistries": [ - { - "RegistryArn": { - "Fn::GetAtt": [ - "namedevelopmentserviceCloudmapService63674467", - "Arn" - ] - } - } - ], - "TaskDefinition": { - "Ref": "namedevelopmenttaskdefinition0468FBFF" - } - } - }, - "namedevelopmentserviceCloudmapService63674467": { - "Type": "AWS::ServiceDiscovery::Service", - "Properties": { - "DnsConfig": { - "DnsRecords": [ - { - "TTL": 10, - "Type": "A" - } - ], - "NamespaceId": { - "Fn::GetAtt": [ - "developmentenvironmentclusterDefaultServiceDiscoveryNamespace0F234767", - "Id" - ] - }, - "RoutingPolicy": "MULTIVALUE" - }, - "HealthCheckCustomConfig": { - "FailureThreshold": 2 - }, - "Name": "name-development", - "NamespaceId": { - "Fn::GetAtt": [ - "developmentenvironmentclusterDefaultServiceDiscoveryNamespace0F234767", - "Id" - ] - } - } - }, - "namedevelopmentserviceSecurityGroupE2ECED97": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "aws-ecs-integ/name-development-service/SecurityGroup", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "VpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - } - } - }, - "namedevelopmentvirtualnode55118E80": { - "Type": "AWS::AppMesh::VirtualNode", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "developmentmeshCEC28AFE", - "MeshName" - ] - }, - "Spec": { - "Listeners": [ - { - "PortMapping": { - "Port": 80, - "Protocol": "http" - } - } - ], - "ServiceDiscovery": { - "AWSCloudMap": { - "NamespaceName": "development", - "ServiceName": { - "Fn::GetAtt": [ - "namedevelopmentserviceCloudmapService63674467", - "Name" - ] - } - } - } - }, - "VirtualNodeName": "name-development" - } - }, - "namedevelopmentvirtualrouter0AE5105D": { - "Type": "AWS::AppMesh::VirtualRouter", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "developmentmeshCEC28AFE", - "MeshName" - ] - }, - "Spec": { - "Listeners": [ - { - "PortMapping": { - "Port": 80, - "Protocol": "http" - } - } - ] - }, - "VirtualRouterName": "name-development" - } - }, - "namedevelopmentvirtualrouternamedevelopmentroute611E499A": { - "Type": "AWS::AppMesh::Route", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "developmentmeshCEC28AFE", - "MeshName" - ] - }, - "Spec": { - "HttpRoute": { - "Action": { - "WeightedTargets": [ - { - "VirtualNode": { - "Fn::GetAtt": [ - "namedevelopmentvirtualnode55118E80", - "VirtualNodeName" - ] - }, - "Weight": 1 - } - ] - }, - "Match": { - "Prefix": "/" - } - } - }, - "VirtualRouterName": { - "Fn::GetAtt": [ - "namedevelopmentvirtualrouter0AE5105D", - "VirtualRouterName" - ] - }, - "RouteName": "name-development-route" - } - }, - "namedevelopmentvirtualserviceD936E3FD": { - "Type": "AWS::AppMesh::VirtualService", - "Properties": { - "MeshName": { - "Fn::GetAtt": [ - "developmentmeshCEC28AFE", - "MeshName" - ] - }, - "Spec": { - "Provider": { - "VirtualRouter": { - "VirtualRouterName": { - "Fn::GetAtt": [ - "namedevelopmentvirtualrouter0AE5105D", - "VirtualRouterName" - ] - } - } - } - }, - "VirtualServiceName": "name-development.development" - } - } - }, - "Mappings": { - "nameproductionenvoyimageaccountmapping": { - "ap-northeast-1": { - "ecrRepo": "840364872350" - }, - "ap-northeast-2": { - "ecrRepo": "840364872350" - }, - "ap-south-1": { - "ecrRepo": "840364872350" - }, - "ap-southeast-1": { - "ecrRepo": "840364872350" - }, - "ap-southeast-2": { - "ecrRepo": "840364872350" - }, - "ca-central-1": { - "ecrRepo": "840364872350" - }, - "cn-north-1": { - "ecrRepo": "919366029133" - }, - "cn-northwest-1": { - "ecrRepo": "919830735681" - }, - "eu-central-1": { - "ecrRepo": "840364872350" - }, - "eu-north-1": { - "ecrRepo": "840364872350" - }, - "eu-south-1": { - "ecrRepo": "422531588944" - }, - "eu-west-1": { - "ecrRepo": "840364872350" - }, - "eu-west-2": { - "ecrRepo": "840364872350" - }, - "eu-west-3": { - "ecrRepo": "840364872350" - }, - "sa-east-1": { - "ecrRepo": "840364872350" - }, - "us-east-1": { - "ecrRepo": "840364872350" - }, - "us-east-2": { - "ecrRepo": "840364872350" - }, - "us-west-1": { - "ecrRepo": "840364872350" - }, - "us-west-2": { - "ecrRepo": "840364872350" - }, - "me-south-1": { - "ecrRepo": "772975370895" - }, - "ap-east-1": { - "ecrRepo": "856666278305" - }, - "af-south-1": { - "ecrRepo": "924023996002" - } - }, - "namedevelopmentenvoyimageaccountmapping": { - "ap-northeast-1": { - "ecrRepo": "840364872350" - }, - "ap-northeast-2": { - "ecrRepo": "840364872350" - }, - "ap-south-1": { - "ecrRepo": "840364872350" - }, - "ap-southeast-1": { - "ecrRepo": "840364872350" - }, - "ap-southeast-2": { - "ecrRepo": "840364872350" - }, - "ca-central-1": { - "ecrRepo": "840364872350" - }, - "cn-north-1": { - "ecrRepo": "919366029133" - }, - "cn-northwest-1": { - "ecrRepo": "919830735681" - }, - "eu-central-1": { - "ecrRepo": "840364872350" - }, - "eu-north-1": { - "ecrRepo": "840364872350" - }, - "eu-south-1": { - "ecrRepo": "422531588944" - }, - "eu-west-1": { - "ecrRepo": "840364872350" - }, - "eu-west-2": { - "ecrRepo": "840364872350" - }, - "eu-west-3": { - "ecrRepo": "840364872350" - }, - "sa-east-1": { - "ecrRepo": "840364872350" - }, - "us-east-1": { - "ecrRepo": "840364872350" - }, - "us-east-2": { - "ecrRepo": "840364872350" - }, - "us-west-1": { - "ecrRepo": "840364872350" - }, - "us-west-2": { - "ecrRepo": "840364872350" - }, - "me-south-1": { - "ecrRepo": "772975370895" - }, - "ap-east-1": { - "ecrRepo": "856666278305" - }, - "af-south-1": { - "ecrRepo": "924023996002" - } - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/multiple-environments.integ.snapshot/cdk.out b/packages/@aws-cdk-containers/ecs-service-extensions/test/multiple-environments.integ.snapshot/cdk.out deleted file mode 100644 index 588d7b269d34f..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/multiple-environments.integ.snapshot/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/multiple-environments.integ.snapshot/integ.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/multiple-environments.integ.snapshot/integ.json deleted file mode 100644 index f395e0c5aec85..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/multiple-environments.integ.snapshot/integ.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "version": "20.0.0", - "testCases": { - "integ.multiple-environments": { - "stacks": [ - "aws-ecs-integ" - ], - "diffAssets": false, - "stackUpdateWorkflow": true - } - }, - "synthContext": {}, - "enableLookups": false -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/multiple-environments.integ.snapshot/manifest.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/multiple-environments.integ.snapshot/manifest.json deleted file mode 100644 index e031c17b58fe9..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/multiple-environments.integ.snapshot/manifest.json +++ /dev/null @@ -1,514 +0,0 @@ -{ - "version": "20.0.0", - "artifacts": { - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - }, - "aws-ecs-integ": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "aws-ecs-integ.template.json", - "validateOnSynth": false - }, - "metadata": { - "/aws-ecs-integ/production-environment-vpc/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcAEB47DF7" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet1/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet1/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet1/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet1RouteTableAssociationA8117374" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet1/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet1DefaultRoute524C894D" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet1/EIP": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet1EIP54BA88DB" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet1/NATGateway": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet1NATGateway6075E4CA" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet2/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet2/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet2RouteTable842A68D7" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet2/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet2RouteTableAssociation0A7549F3" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet2/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet2DefaultRoute92CD697D" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet2/EIP": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet2EIP14CA46AA" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet2/NATGateway": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet2NATGatewayE1850FCC" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet1/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet1/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet1/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet1RouteTableAssociation8BA32463" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet1/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet1DefaultRouteFBB3DE6C" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet2/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet2/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet2/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet2RouteTableAssociation09188261" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet2/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet2DefaultRoute5F9AB6C1" - } - ], - "/aws-ecs-integ/production-environment-vpc/IGW": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcIGWE7C39890" - } - ], - "/aws-ecs-integ/production-environment-vpc/VPCGW": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcVPCGW1B428D07" - } - ], - "/aws-ecs-integ/production-environment-cluster/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentclusterC6599D2D" - } - ], - "/aws-ecs-integ/production-environment-cluster/DefaultServiceDiscoveryNamespace/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D" - } - ], - "/aws-ecs-integ/development-environment-vpc/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "developmentenvironmentvpcCB4216A4" - } - ], - "/aws-ecs-integ/development-environment-vpc/PublicSubnet1/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "developmentenvironmentvpcPublicSubnet1Subnet0D18046B" - } - ], - "/aws-ecs-integ/development-environment-vpc/PublicSubnet1/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "developmentenvironmentvpcPublicSubnet1RouteTable8FC58983" - } - ], - "/aws-ecs-integ/development-environment-vpc/PublicSubnet1/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "developmentenvironmentvpcPublicSubnet1RouteTableAssociation8F257A0C" - } - ], - "/aws-ecs-integ/development-environment-vpc/PublicSubnet1/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "developmentenvironmentvpcPublicSubnet1DefaultRoute2BAA794D" - } - ], - "/aws-ecs-integ/development-environment-vpc/PublicSubnet1/EIP": [ - { - "type": "aws:cdk:logicalId", - "data": "developmentenvironmentvpcPublicSubnet1EIPE8B9F4D4" - } - ], - "/aws-ecs-integ/development-environment-vpc/PublicSubnet1/NATGateway": [ - { - "type": "aws:cdk:logicalId", - "data": "developmentenvironmentvpcPublicSubnet1NATGateway6B01CC4E" - } - ], - "/aws-ecs-integ/development-environment-vpc/PublicSubnet2/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "developmentenvironmentvpcPublicSubnet2SubnetC2026CD3" - } - ], - "/aws-ecs-integ/development-environment-vpc/PublicSubnet2/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "developmentenvironmentvpcPublicSubnet2RouteTable803A92C2" - } - ], - "/aws-ecs-integ/development-environment-vpc/PublicSubnet2/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "developmentenvironmentvpcPublicSubnet2RouteTableAssociation6630985C" - } - ], - "/aws-ecs-integ/development-environment-vpc/PublicSubnet2/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "developmentenvironmentvpcPublicSubnet2DefaultRoute2C5118B5" - } - ], - "/aws-ecs-integ/development-environment-vpc/PublicSubnet2/EIP": [ - { - "type": "aws:cdk:logicalId", - "data": "developmentenvironmentvpcPublicSubnet2EIP560C2BBA" - } - ], - "/aws-ecs-integ/development-environment-vpc/PublicSubnet2/NATGateway": [ - { - "type": "aws:cdk:logicalId", - "data": "developmentenvironmentvpcPublicSubnet2NATGateway15A9C252" - } - ], - "/aws-ecs-integ/development-environment-vpc/PrivateSubnet1/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "developmentenvironmentvpcPrivateSubnet1SubnetAAECD171" - } - ], - "/aws-ecs-integ/development-environment-vpc/PrivateSubnet1/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "developmentenvironmentvpcPrivateSubnet1RouteTable29CEB1DB" - } - ], - "/aws-ecs-integ/development-environment-vpc/PrivateSubnet1/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "developmentenvironmentvpcPrivateSubnet1RouteTableAssociation95EE92E6" - } - ], - "/aws-ecs-integ/development-environment-vpc/PrivateSubnet1/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "developmentenvironmentvpcPrivateSubnet1DefaultRoute1813B5F3" - } - ], - "/aws-ecs-integ/development-environment-vpc/PrivateSubnet2/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "developmentenvironmentvpcPrivateSubnet2Subnet20C1C37D" - } - ], - "/aws-ecs-integ/development-environment-vpc/PrivateSubnet2/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "developmentenvironmentvpcPrivateSubnet2RouteTable687AB03B" - } - ], - "/aws-ecs-integ/development-environment-vpc/PrivateSubnet2/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "developmentenvironmentvpcPrivateSubnet2RouteTableAssociation1C336DAE" - } - ], - "/aws-ecs-integ/development-environment-vpc/PrivateSubnet2/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "developmentenvironmentvpcPrivateSubnet2DefaultRoute1B4A6D0D" - } - ], - "/aws-ecs-integ/development-environment-vpc/IGW": [ - { - "type": "aws:cdk:logicalId", - "data": "developmentenvironmentvpcIGW2B4E91B1" - } - ], - "/aws-ecs-integ/development-environment-vpc/VPCGW": [ - { - "type": "aws:cdk:logicalId", - "data": "developmentenvironmentvpcVPCGW702C2C38" - } - ], - "/aws-ecs-integ/development-environment-cluster/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "developmentenvironmentcluster1B64BE8B" - } - ], - "/aws-ecs-integ/development-environment-cluster/DefaultServiceDiscoveryNamespace/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "developmentenvironmentclusterDefaultServiceDiscoveryNamespace0F234767" - } - ], - "/aws-ecs-integ/production-mesh/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "productionmeshB6E81744" - } - ], - "/aws-ecs-integ/development-mesh/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "developmentmeshCEC28AFE" - } - ], - "/aws-ecs-integ/name-production-task-definition/TaskRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameproductiontaskdefinitionTaskRole93E922EB" - } - ], - "/aws-ecs-integ/name-production-task-definition/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameproductiontaskdefinition33A5D5E0" - } - ], - "/aws-ecs-integ/name-production-task-definition/ExecutionRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameproductiontaskdefinitionExecutionRoleB72DD86B" - } - ], - "/aws-ecs-integ/name-production-task-definition/ExecutionRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameproductiontaskdefinitionExecutionRoleDefaultPolicyB66C67BE" - } - ], - "/aws-ecs-integ/name-production-task-definition/envoy/LogGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameproductiontaskdefinitionenvoyLogGroupF79A2732" - } - ], - "/aws-ecs-integ/name-production-logs/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameproductionlogsD0BFFE8C" - } - ], - "/aws-ecs-integ/name-production-envoy-image-account-mapping": [ - { - "type": "aws:cdk:logicalId", - "data": "nameproductionenvoyimageaccountmapping" - } - ], - "/aws-ecs-integ/name-production-envoy-to-appmesh/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameproductionenvoytoappmesh1B44B04A" - } - ], - "/aws-ecs-integ/name-production-service/Service": [ - { - "type": "aws:cdk:logicalId", - "data": "nameproductionserviceServiceB2D31516" - } - ], - "/aws-ecs-integ/name-production-service/CloudmapService/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameproductionserviceCloudmapService60E3273A" - } - ], - "/aws-ecs-integ/name-production-service/SecurityGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameproductionserviceSecurityGroupF496E439" - } - ], - "/aws-ecs-integ/name-production-virtual-node/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameproductionvirtualnodeC78443D9" - } - ], - "/aws-ecs-integ/name-production-virtual-router/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameproductionvirtualrouter00E3366D" - } - ], - "/aws-ecs-integ/name-production-virtual-router/name-production-route/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameproductionvirtualrouternameproductionrouteE886BEFD" - } - ], - "/aws-ecs-integ/name-production-virtual-service/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "nameproductionvirtualservice4D49D5F6" - } - ], - "/aws-ecs-integ/name-development-task-definition/TaskRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "namedevelopmenttaskdefinitionTaskRole66A85BBB" - } - ], - "/aws-ecs-integ/name-development-task-definition/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "namedevelopmenttaskdefinition0468FBFF" - } - ], - "/aws-ecs-integ/name-development-task-definition/ExecutionRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "namedevelopmenttaskdefinitionExecutionRole48B53E4E" - } - ], - "/aws-ecs-integ/name-development-task-definition/ExecutionRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "namedevelopmenttaskdefinitionExecutionRoleDefaultPolicy34EAA008" - } - ], - "/aws-ecs-integ/name-development-task-definition/envoy/LogGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "namedevelopmenttaskdefinitionenvoyLogGroupF8FCAFD6" - } - ], - "/aws-ecs-integ/name-development-logs/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "namedevelopmentlogs108670CC" - } - ], - "/aws-ecs-integ/name-development-envoy-image-account-mapping": [ - { - "type": "aws:cdk:logicalId", - "data": "namedevelopmentenvoyimageaccountmapping" - } - ], - "/aws-ecs-integ/name-development-envoy-to-appmesh/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "namedevelopmentenvoytoappmesh45FF08AA" - } - ], - "/aws-ecs-integ/name-development-service/Service": [ - { - "type": "aws:cdk:logicalId", - "data": "namedevelopmentserviceService8A24F793" - } - ], - "/aws-ecs-integ/name-development-service/CloudmapService/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "namedevelopmentserviceCloudmapService63674467" - } - ], - "/aws-ecs-integ/name-development-service/SecurityGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "namedevelopmentserviceSecurityGroupE2ECED97" - } - ], - "/aws-ecs-integ/name-development-virtual-node/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "namedevelopmentvirtualnode55118E80" - } - ], - "/aws-ecs-integ/name-development-virtual-router/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "namedevelopmentvirtualrouter0AE5105D" - } - ], - "/aws-ecs-integ/name-development-virtual-router/name-development-route/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "namedevelopmentvirtualrouternamedevelopmentroute611E499A" - } - ], - "/aws-ecs-integ/name-development-virtual-service/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "namedevelopmentvirtualserviceD936E3FD" - } - ] - }, - "displayName": "aws-ecs-integ" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/multiple-environments.integ.snapshot/tree.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/multiple-environments.integ.snapshot/tree.json deleted file mode 100644 index 743acfc5c6d86..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/multiple-environments.integ.snapshot/tree.json +++ /dev/null @@ -1,3171 +0,0 @@ -{ - "version": "tree-0.1", - "tree": { - "id": "App", - "path": "", - "children": { - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.78" - } - }, - "aws-ecs-integ": { - "id": "aws-ecs-integ", - "path": "aws-ecs-integ", - "children": { - "production": { - "id": "production", - "path": "aws-ecs-integ/production", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.78" - } - }, - "production-environment-vpc": { - "id": "production-environment-vpc", - "path": "aws-ecs-integ/production-environment-vpc", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/production-environment-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-integ/production-environment-vpc" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnVPC", - "version": "0.0.0" - } - }, - "PublicSubnet1": { - "id": "PublicSubnet1", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21" - }, - "subnetId": { - "Ref": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21" - }, - "destinationCidrBlock": "0.0.0.0/0", - "gatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - }, - "EIP": { - "id": "EIP", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1/EIP", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::EIP", - "aws:cdk:cloudformation:props": { - "domain": "vpc", - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnEIP", - "version": "0.0.0" - } - }, - "NATGateway": { - "id": "NATGateway", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1/NATGateway", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", - "aws:cdk:cloudformation:props": { - "subnetId": { - "Ref": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - }, - "allocationId": { - "Fn::GetAtt": [ - "productionenvironmentvpcPublicSubnet1EIP54BA88DB", - "AllocationId" - ] - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnNatGateway", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PublicSubnet", - "version": "0.0.0" - } - }, - "PublicSubnet2": { - "id": "PublicSubnet2", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPublicSubnet2RouteTable842A68D7" - }, - "subnetId": { - "Ref": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPublicSubnet2RouteTable842A68D7" - }, - "destinationCidrBlock": "0.0.0.0/0", - "gatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - }, - "EIP": { - "id": "EIP", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2/EIP", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::EIP", - "aws:cdk:cloudformation:props": { - "domain": "vpc", - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnEIP", - "version": "0.0.0" - } - }, - "NATGateway": { - "id": "NATGateway", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2/NATGateway", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", - "aws:cdk:cloudformation:props": { - "subnetId": { - "Ref": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - }, - "allocationId": { - "Fn::GetAtt": [ - "productionenvironmentvpcPublicSubnet2EIP14CA46AA", - "AllocationId" - ] - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnNatGateway", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PublicSubnet", - "version": "0.0.0" - } - }, - "PrivateSubnet1": { - "id": "PrivateSubnet1", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C" - }, - "subnetId": { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C" - }, - "destinationCidrBlock": "0.0.0.0/0", - "natGatewayId": { - "Ref": "productionenvironmentvpcPublicSubnet1NATGateway6075E4CA" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PrivateSubnet", - "version": "0.0.0" - } - }, - "PrivateSubnet2": { - "id": "PrivateSubnet2", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2" - }, - "subnetId": { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2" - }, - "destinationCidrBlock": "0.0.0.0/0", - "natGatewayId": { - "Ref": "productionenvironmentvpcPublicSubnet2NATGatewayE1850FCC" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PrivateSubnet", - "version": "0.0.0" - } - }, - "IGW": { - "id": "IGW", - "path": "aws-ecs-integ/production-environment-vpc/IGW", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::InternetGateway", - "aws:cdk:cloudformation:props": { - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnInternetGateway", - "version": "0.0.0" - } - }, - "VPCGW": { - "id": "VPCGW", - "path": "aws-ecs-integ/production-environment-vpc/VPCGW", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "internetGatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnVPCGatewayAttachment", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.Vpc", - "version": "0.0.0" - } - }, - "production-environment-cluster": { - "id": "production-environment-cluster", - "path": "aws-ecs-integ/production-environment-cluster", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/production-environment-cluster/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ECS::Cluster", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.CfnCluster", - "version": "0.0.0" - } - }, - "DefaultServiceDiscoveryNamespace": { - "id": "DefaultServiceDiscoveryNamespace", - "path": "aws-ecs-integ/production-environment-cluster/DefaultServiceDiscoveryNamespace", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/production-environment-cluster/DefaultServiceDiscoveryNamespace/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ServiceDiscovery::PrivateDnsNamespace", - "aws:cdk:cloudformation:props": { - "name": "production", - "vpc": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-servicediscovery.CfnPrivateDnsNamespace", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-servicediscovery.PrivateDnsNamespace", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.Cluster", - "version": "0.0.0" - } - }, - "development": { - "id": "development", - "path": "aws-ecs-integ/development", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.78" - } - }, - "development-environment-vpc": { - "id": "development-environment-vpc", - "path": "aws-ecs-integ/development-environment-vpc", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/development-environment-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-integ/development-environment-vpc" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnVPC", - "version": "0.0.0" - } - }, - "PublicSubnet1": { - "id": "PublicSubnet1", - "path": "aws-ecs-integ/development-environment-vpc/PublicSubnet1", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-ecs-integ/development-environment-vpc/PublicSubnet1/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "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-integ/development-environment-vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-ecs-integ/development-environment-vpc/PublicSubnet1/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-ecs-integ/development-environment-vpc/PublicSubnet1/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/development-environment-vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-ecs-integ/development-environment-vpc/PublicSubnet1/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "developmentenvironmentvpcPublicSubnet1RouteTable8FC58983" - }, - "subnetId": { - "Ref": "developmentenvironmentvpcPublicSubnet1Subnet0D18046B" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-ecs-integ/development-environment-vpc/PublicSubnet1/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "developmentenvironmentvpcPublicSubnet1RouteTable8FC58983" - }, - "destinationCidrBlock": "0.0.0.0/0", - "gatewayId": { - "Ref": "developmentenvironmentvpcIGW2B4E91B1" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - }, - "EIP": { - "id": "EIP", - "path": "aws-ecs-integ/development-environment-vpc/PublicSubnet1/EIP", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::EIP", - "aws:cdk:cloudformation:props": { - "domain": "vpc", - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/development-environment-vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnEIP", - "version": "0.0.0" - } - }, - "NATGateway": { - "id": "NATGateway", - "path": "aws-ecs-integ/development-environment-vpc/PublicSubnet1/NATGateway", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", - "aws:cdk:cloudformation:props": { - "subnetId": { - "Ref": "developmentenvironmentvpcPublicSubnet1Subnet0D18046B" - }, - "allocationId": { - "Fn::GetAtt": [ - "developmentenvironmentvpcPublicSubnet1EIPE8B9F4D4", - "AllocationId" - ] - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/development-environment-vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnNatGateway", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PublicSubnet", - "version": "0.0.0" - } - }, - "PublicSubnet2": { - "id": "PublicSubnet2", - "path": "aws-ecs-integ/development-environment-vpc/PublicSubnet2", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-ecs-integ/development-environment-vpc/PublicSubnet2/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "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-integ/development-environment-vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-ecs-integ/development-environment-vpc/PublicSubnet2/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-ecs-integ/development-environment-vpc/PublicSubnet2/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/development-environment-vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-ecs-integ/development-environment-vpc/PublicSubnet2/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "developmentenvironmentvpcPublicSubnet2RouteTable803A92C2" - }, - "subnetId": { - "Ref": "developmentenvironmentvpcPublicSubnet2SubnetC2026CD3" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-ecs-integ/development-environment-vpc/PublicSubnet2/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "developmentenvironmentvpcPublicSubnet2RouteTable803A92C2" - }, - "destinationCidrBlock": "0.0.0.0/0", - "gatewayId": { - "Ref": "developmentenvironmentvpcIGW2B4E91B1" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - }, - "EIP": { - "id": "EIP", - "path": "aws-ecs-integ/development-environment-vpc/PublicSubnet2/EIP", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::EIP", - "aws:cdk:cloudformation:props": { - "domain": "vpc", - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/development-environment-vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnEIP", - "version": "0.0.0" - } - }, - "NATGateway": { - "id": "NATGateway", - "path": "aws-ecs-integ/development-environment-vpc/PublicSubnet2/NATGateway", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", - "aws:cdk:cloudformation:props": { - "subnetId": { - "Ref": "developmentenvironmentvpcPublicSubnet2SubnetC2026CD3" - }, - "allocationId": { - "Fn::GetAtt": [ - "developmentenvironmentvpcPublicSubnet2EIP560C2BBA", - "AllocationId" - ] - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/development-environment-vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnNatGateway", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PublicSubnet", - "version": "0.0.0" - } - }, - "PrivateSubnet1": { - "id": "PrivateSubnet1", - "path": "aws-ecs-integ/development-environment-vpc/PrivateSubnet1", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-ecs-integ/development-environment-vpc/PrivateSubnet1/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "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-integ/development-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-ecs-integ/development-environment-vpc/PrivateSubnet1/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-ecs-integ/development-environment-vpc/PrivateSubnet1/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/development-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-ecs-integ/development-environment-vpc/PrivateSubnet1/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "developmentenvironmentvpcPrivateSubnet1RouteTable29CEB1DB" - }, - "subnetId": { - "Ref": "developmentenvironmentvpcPrivateSubnet1SubnetAAECD171" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-ecs-integ/development-environment-vpc/PrivateSubnet1/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "developmentenvironmentvpcPrivateSubnet1RouteTable29CEB1DB" - }, - "destinationCidrBlock": "0.0.0.0/0", - "natGatewayId": { - "Ref": "developmentenvironmentvpcPublicSubnet1NATGateway6B01CC4E" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PrivateSubnet", - "version": "0.0.0" - } - }, - "PrivateSubnet2": { - "id": "PrivateSubnet2", - "path": "aws-ecs-integ/development-environment-vpc/PrivateSubnet2", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-ecs-integ/development-environment-vpc/PrivateSubnet2/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "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-integ/development-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-ecs-integ/development-environment-vpc/PrivateSubnet2/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-ecs-integ/development-environment-vpc/PrivateSubnet2/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/development-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-ecs-integ/development-environment-vpc/PrivateSubnet2/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "developmentenvironmentvpcPrivateSubnet2RouteTable687AB03B" - }, - "subnetId": { - "Ref": "developmentenvironmentvpcPrivateSubnet2Subnet20C1C37D" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-ecs-integ/development-environment-vpc/PrivateSubnet2/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "developmentenvironmentvpcPrivateSubnet2RouteTable687AB03B" - }, - "destinationCidrBlock": "0.0.0.0/0", - "natGatewayId": { - "Ref": "developmentenvironmentvpcPublicSubnet2NATGateway15A9C252" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PrivateSubnet", - "version": "0.0.0" - } - }, - "IGW": { - "id": "IGW", - "path": "aws-ecs-integ/development-environment-vpc/IGW", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::InternetGateway", - "aws:cdk:cloudformation:props": { - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/development-environment-vpc" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnInternetGateway", - "version": "0.0.0" - } - }, - "VPCGW": { - "id": "VPCGW", - "path": "aws-ecs-integ/development-environment-vpc/VPCGW", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - }, - "internetGatewayId": { - "Ref": "developmentenvironmentvpcIGW2B4E91B1" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnVPCGatewayAttachment", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.Vpc", - "version": "0.0.0" - } - }, - "development-environment-cluster": { - "id": "development-environment-cluster", - "path": "aws-ecs-integ/development-environment-cluster", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/development-environment-cluster/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ECS::Cluster", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.CfnCluster", - "version": "0.0.0" - } - }, - "DefaultServiceDiscoveryNamespace": { - "id": "DefaultServiceDiscoveryNamespace", - "path": "aws-ecs-integ/development-environment-cluster/DefaultServiceDiscoveryNamespace", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/development-environment-cluster/DefaultServiceDiscoveryNamespace/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ServiceDiscovery::PrivateDnsNamespace", - "aws:cdk:cloudformation:props": { - "name": "development", - "vpc": { - "Ref": "developmentenvironmentvpcCB4216A4" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-servicediscovery.CfnPrivateDnsNamespace", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-servicediscovery.PrivateDnsNamespace", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.Cluster", - "version": "0.0.0" - } - }, - "production-mesh": { - "id": "production-mesh", - "path": "aws-ecs-integ/production-mesh", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/production-mesh/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::AppMesh::Mesh", - "aws:cdk:cloudformation:props": { - "meshName": "awsecsintegproductionmesh1A4ED585", - "spec": {} - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.CfnMesh", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.Mesh", - "version": "0.0.0" - } - }, - "development-mesh": { - "id": "development-mesh", - "path": "aws-ecs-integ/development-mesh", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/development-mesh/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::AppMesh::Mesh", - "aws:cdk:cloudformation:props": { - "meshName": "awsecsintegdevelopmentmeshEFC35179", - "spec": {} - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.CfnMesh", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.Mesh", - "version": "0.0.0" - } - }, - "name-production": { - "id": "name-production", - "path": "aws-ecs-integ/name-production", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.78" - } - }, - "name-production-task-definition": { - "id": "name-production-task-definition", - "path": "aws-ecs-integ/name-production-task-definition", - "children": { - "TaskRole": { - "id": "TaskRole", - "path": "aws-ecs-integ/name-production-task-definition/TaskRole", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-production-task-definition/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/aws-iam.CfnRole", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-production-task-definition/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ECS::TaskDefinition", - "aws:cdk:cloudformation:props": { - "containerDefinitions": [ - { - "cpu": 1024, - "dependsOn": [ - { - "containerName": "envoy", - "condition": "HEALTHY" - } - ], - "essential": true, - "image": "nathanpeck/name", - "memory": 2048, - "name": "app", - "portMappings": [ - { - "containerPort": 80, - "protocol": "tcp" - } - ], - "ulimits": [ - { - "name": "nofile", - "softLimit": 1024000, - "hardLimit": 1024000 - } - ], - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-group": { - "Ref": "nameproductionlogsD0BFFE8C" - }, - "awslogs-stream-prefix": "name-production", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "environment": [ - { - "name": "PORT", - "value": "80" - } - ] - }, - { - "essential": true, - "image": { - "Fn::Join": [ - "", - [ - { - "Fn::FindInMap": [ - "nameproductionenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ".dkr.ecr.", - { - "Ref": "AWS::Region" - }, - ".", - { - "Ref": "AWS::URLSuffix" - }, - "/aws-appmesh-envoy:v1.15.1.0-prod" - ] - ] - }, - "memoryReservation": 128, - "name": "envoy", - "ulimits": [ - { - "name": "nofile", - "softLimit": 1024000, - "hardLimit": 1024000 - } - ], - "user": "1337", - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-group": { - "Ref": "nameproductiontaskdefinitionenvoyLogGroupF79A2732" - }, - "awslogs-stream-prefix": "envoy", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "environment": [ - { - "name": "APPMESH_VIRTUAL_NODE_NAME", - "value": { - "Fn::Join": [ - "", - [ - "mesh/", - { - "Fn::GetAtt": [ - "productionmeshB6E81744", - "MeshName" - ] - }, - "/virtualNode/name-production" - ] - ] - } - }, - { - "name": "AWS_REGION", - "value": { - "Ref": "AWS::Region" - } - }, - { - "name": "ENABLE_ENVOY_STATS_TAGS", - "value": "1" - }, - { - "name": "ENABLE_ENVOY_DOG_STATSD", - "value": "1" - } - ], - "healthCheck": { - "command": [ - "CMD-SHELL", - "curl -s http://localhost:9901/server_info | grep state | grep -q LIVE" - ], - "interval": 5, - "retries": 3, - "startPeriod": 10, - "timeout": 2 - } - } - ], - "cpu": "1024", - "executionRoleArn": { - "Fn::GetAtt": [ - "nameproductiontaskdefinitionExecutionRoleB72DD86B", - "Arn" - ] - }, - "family": "awsecsintegnameproductiontaskdefinition9E1C363B", - "memory": "2048", - "networkMode": "awsvpc", - "proxyConfiguration": { - "containerName": "envoy", - "proxyConfigurationProperties": [ - { - "name": "AppPorts", - "value": "80" - }, - { - "name": "ProxyEgressPort", - "value": "15001" - }, - { - "name": "ProxyIngressPort", - "value": "15000" - }, - { - "name": "IgnoredUID", - "value": "1337" - }, - { - "name": "IgnoredGID", - "value": "1338" - }, - { - "name": "EgressIgnoredIPs", - "value": "169.254.170.2,169.254.169.254" - } - ], - "type": "APPMESH" - }, - "requiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "taskRoleArn": { - "Fn::GetAtt": [ - "nameproductiontaskdefinitionTaskRole93E922EB", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.CfnTaskDefinition", - "version": "0.0.0" - } - }, - "app": { - "id": "app", - "path": "aws-ecs-integ/name-production-task-definition/app", - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.ContainerDefinition", - "version": "0.0.0" - } - }, - "ExecutionRole": { - "id": "ExecutionRole", - "path": "aws-ecs-integ/name-production-task-definition/ExecutionRole", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-production-task-definition/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/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "aws-ecs-integ/name-production-task-definition/ExecutionRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-production-task-definition/ExecutionRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "nameproductionlogsD0BFFE8C", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "nameproductiontaskdefinitionenvoyLogGroupF79A2732", - "Arn" - ] - } - ] - }, - { - "Action": [ - "ecr:BatchCheckLayerAvailability", - "ecr:BatchGetImage", - "ecr:GetDownloadUrlForLayer" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ecr:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Fn::FindInMap": [ - "nameproductionenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ":repository/aws-appmesh-envoy" - ] - ] - } - }, - { - "Action": "ecr:GetAuthorizationToken", - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "policyName": "nameproductiontaskdefinitionExecutionRoleDefaultPolicyB66C67BE", - "roles": [ - { - "Ref": "nameproductiontaskdefinitionExecutionRoleB72DD86B" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "envoy": { - "id": "envoy", - "path": "aws-ecs-integ/name-production-task-definition/envoy", - "children": { - "LogGroup": { - "id": "LogGroup", - "path": "aws-ecs-integ/name-production-task-definition/envoy/LogGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-production-task-definition/envoy/LogGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.CfnLogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.LogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.ContainerDefinition", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.TaskDefinition", - "version": "0.0.0" - } - }, - "name-production-logs": { - "id": "name-production-logs", - "path": "aws-ecs-integ/name-production-logs", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-production-logs/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", - "aws:cdk:cloudformation:props": { - "logGroupName": "name-production-logs", - "retentionInDays": 30 - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.CfnLogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.LogGroup", - "version": "0.0.0" - } - }, - "name-production-envoy-image-account-mapping": { - "id": "name-production-envoy-image-account-mapping", - "path": "aws-ecs-integ/name-production-envoy-image-account-mapping", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnMapping", - "version": "0.0.0" - } - }, - "name-production-envoy-repo": { - "id": "name-production-envoy-repo", - "path": "aws-ecs-integ/name-production-envoy-repo", - "constructInfo": { - "fqn": "@aws-cdk/aws-ecr.RepositoryBase", - "version": "0.0.0" - } - }, - "name-production-envoy-to-appmesh": { - "id": "name-production-envoy-to-appmesh", - "path": "aws-ecs-integ/name-production-envoy-to-appmesh", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-production-envoy-to-appmesh/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": "appmesh:StreamAggregatedResources", - "Effect": "Allow", - "Resource": { - "Ref": "productionmeshB6E81744" - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "nameproductionenvoytoappmesh1B44B04A", - "roles": [ - { - "Ref": "nameproductiontaskdefinitionTaskRole93E922EB" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - }, - "name-production-service": { - "id": "name-production-service", - "path": "aws-ecs-integ/name-production-service", - "children": { - "Service": { - "id": "Service", - "path": "aws-ecs-integ/name-production-service/Service", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ECS::Service", - "aws:cdk:cloudformation:props": { - "cluster": { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "deploymentConfiguration": { - "maximumPercent": 200, - "minimumHealthyPercent": 100 - }, - "desiredCount": 1, - "enableEcsManagedTags": false, - "launchType": "FARGATE", - "networkConfiguration": { - "awsvpcConfiguration": { - "assignPublicIp": "DISABLED", - "subnets": [ - { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - }, - { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - ], - "securityGroups": [ - { - "Fn::GetAtt": [ - "nameproductionserviceSecurityGroupF496E439", - "GroupId" - ] - } - ] - } - }, - "serviceRegistries": [ - { - "registryArn": { - "Fn::GetAtt": [ - "nameproductionserviceCloudmapService60E3273A", - "Arn" - ] - } - } - ], - "taskDefinition": { - "Ref": "nameproductiontaskdefinition33A5D5E0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.CfnService", - "version": "0.0.0" - } - }, - "CloudmapService": { - "id": "CloudmapService", - "path": "aws-ecs-integ/name-production-service/CloudmapService", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-production-service/CloudmapService/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ServiceDiscovery::Service", - "aws:cdk:cloudformation:props": { - "dnsConfig": { - "dnsRecords": [ - { - "type": "A", - "ttl": 10 - } - ], - "namespaceId": { - "Fn::GetAtt": [ - "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D", - "Id" - ] - }, - "routingPolicy": "MULTIVALUE" - }, - "healthCheckCustomConfig": { - "failureThreshold": 2 - }, - "name": "name-production", - "namespaceId": { - "Fn::GetAtt": [ - "productionenvironmentclusterDefaultServiceDiscoveryNamespaceBE74D64D", - "Id" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-servicediscovery.CfnService", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-servicediscovery.Service", - "version": "0.0.0" - } - }, - "SecurityGroup": { - "id": "SecurityGroup", - "path": "aws-ecs-integ/name-production-service/SecurityGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-production-service/SecurityGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", - "aws:cdk:cloudformation:props": { - "groupDescription": "aws-ecs-integ/name-production-service/SecurityGroup", - "securityGroupEgress": [ - { - "cidrIp": "0.0.0.0/0", - "description": "Allow all outbound traffic by default", - "ipProtocol": "-1" - } - ], - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSecurityGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.SecurityGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.FargateService", - "version": "0.0.0" - } - }, - "name-production-virtual-node": { - "id": "name-production-virtual-node", - "path": "aws-ecs-integ/name-production-virtual-node", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-production-virtual-node/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::AppMesh::VirtualNode", - "aws:cdk:cloudformation:props": { - "meshName": { - "Fn::GetAtt": [ - "productionmeshB6E81744", - "MeshName" - ] - }, - "spec": { - "listeners": [ - { - "portMapping": { - "port": 80, - "protocol": "http" - } - } - ], - "serviceDiscovery": { - "awsCloudMap": { - "namespaceName": "production", - "serviceName": { - "Fn::GetAtt": [ - "nameproductionserviceCloudmapService60E3273A", - "Name" - ] - } - } - } - }, - "virtualNodeName": "name-production" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.CfnVirtualNode", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.VirtualNode", - "version": "0.0.0" - } - }, - "name-production-virtual-router": { - "id": "name-production-virtual-router", - "path": "aws-ecs-integ/name-production-virtual-router", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-production-virtual-router/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::AppMesh::VirtualRouter", - "aws:cdk:cloudformation:props": { - "meshName": { - "Fn::GetAtt": [ - "productionmeshB6E81744", - "MeshName" - ] - }, - "spec": { - "listeners": [ - { - "portMapping": { - "port": 80, - "protocol": "http" - } - } - ] - }, - "virtualRouterName": "name-production" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.CfnVirtualRouter", - "version": "0.0.0" - } - }, - "name-production-route": { - "id": "name-production-route", - "path": "aws-ecs-integ/name-production-virtual-router/name-production-route", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-production-virtual-router/name-production-route/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::AppMesh::Route", - "aws:cdk:cloudformation:props": { - "meshName": { - "Fn::GetAtt": [ - "productionmeshB6E81744", - "MeshName" - ] - }, - "spec": { - "httpRoute": { - "action": { - "weightedTargets": [ - { - "virtualNode": { - "Fn::GetAtt": [ - "nameproductionvirtualnodeC78443D9", - "VirtualNodeName" - ] - }, - "weight": 1 - } - ] - }, - "match": { - "prefix": "/" - } - } - }, - "virtualRouterName": { - "Fn::GetAtt": [ - "nameproductionvirtualrouter00E3366D", - "VirtualRouterName" - ] - }, - "routeName": "name-production-route" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.CfnRoute", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.Route", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.VirtualRouter", - "version": "0.0.0" - } - }, - "name-production-virtual-service": { - "id": "name-production-virtual-service", - "path": "aws-ecs-integ/name-production-virtual-service", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-production-virtual-service/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::AppMesh::VirtualService", - "aws:cdk:cloudformation:props": { - "meshName": { - "Fn::GetAtt": [ - "productionmeshB6E81744", - "MeshName" - ] - }, - "spec": { - "provider": { - "virtualRouter": { - "virtualRouterName": { - "Fn::GetAtt": [ - "nameproductionvirtualrouter00E3366D", - "VirtualRouterName" - ] - } - } - } - }, - "virtualServiceName": "name-production.production" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.CfnVirtualService", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.VirtualService", - "version": "0.0.0" - } - }, - "name-development": { - "id": "name-development", - "path": "aws-ecs-integ/name-development", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.78" - } - }, - "name-development-task-definition": { - "id": "name-development-task-definition", - "path": "aws-ecs-integ/name-development-task-definition", - "children": { - "TaskRole": { - "id": "TaskRole", - "path": "aws-ecs-integ/name-development-task-definition/TaskRole", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-development-task-definition/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/aws-iam.CfnRole", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-development-task-definition/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ECS::TaskDefinition", - "aws:cdk:cloudformation:props": { - "containerDefinitions": [ - { - "cpu": 1024, - "dependsOn": [ - { - "containerName": "envoy", - "condition": "HEALTHY" - } - ], - "essential": true, - "image": "nathanpeck/name", - "memory": 2048, - "name": "app", - "portMappings": [ - { - "containerPort": 80, - "protocol": "tcp" - } - ], - "ulimits": [ - { - "name": "nofile", - "softLimit": 1024000, - "hardLimit": 1024000 - } - ], - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-group": { - "Ref": "namedevelopmentlogs108670CC" - }, - "awslogs-stream-prefix": "name-development", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "environment": [ - { - "name": "PORT", - "value": "80" - } - ] - }, - { - "essential": true, - "image": { - "Fn::Join": [ - "", - [ - { - "Fn::FindInMap": [ - "namedevelopmentenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ".dkr.ecr.", - { - "Ref": "AWS::Region" - }, - ".", - { - "Ref": "AWS::URLSuffix" - }, - "/aws-appmesh-envoy:v1.15.1.0-prod" - ] - ] - }, - "memoryReservation": 128, - "name": "envoy", - "ulimits": [ - { - "name": "nofile", - "softLimit": 1024000, - "hardLimit": 1024000 - } - ], - "user": "1337", - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-group": { - "Ref": "namedevelopmenttaskdefinitionenvoyLogGroupF8FCAFD6" - }, - "awslogs-stream-prefix": "envoy", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "environment": [ - { - "name": "APPMESH_VIRTUAL_NODE_NAME", - "value": { - "Fn::Join": [ - "", - [ - "mesh/", - { - "Fn::GetAtt": [ - "developmentmeshCEC28AFE", - "MeshName" - ] - }, - "/virtualNode/name-development" - ] - ] - } - }, - { - "name": "AWS_REGION", - "value": { - "Ref": "AWS::Region" - } - }, - { - "name": "ENABLE_ENVOY_STATS_TAGS", - "value": "1" - }, - { - "name": "ENABLE_ENVOY_DOG_STATSD", - "value": "1" - } - ], - "healthCheck": { - "command": [ - "CMD-SHELL", - "curl -s http://localhost:9901/server_info | grep state | grep -q LIVE" - ], - "interval": 5, - "retries": 3, - "startPeriod": 10, - "timeout": 2 - } - } - ], - "cpu": "1024", - "executionRoleArn": { - "Fn::GetAtt": [ - "namedevelopmenttaskdefinitionExecutionRole48B53E4E", - "Arn" - ] - }, - "family": "awsecsintegnamedevelopmenttaskdefinitionC3797E10", - "memory": "2048", - "networkMode": "awsvpc", - "proxyConfiguration": { - "containerName": "envoy", - "proxyConfigurationProperties": [ - { - "name": "AppPorts", - "value": "80" - }, - { - "name": "ProxyEgressPort", - "value": "15001" - }, - { - "name": "ProxyIngressPort", - "value": "15000" - }, - { - "name": "IgnoredUID", - "value": "1337" - }, - { - "name": "IgnoredGID", - "value": "1338" - }, - { - "name": "EgressIgnoredIPs", - "value": "169.254.170.2,169.254.169.254" - } - ], - "type": "APPMESH" - }, - "requiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "taskRoleArn": { - "Fn::GetAtt": [ - "namedevelopmenttaskdefinitionTaskRole66A85BBB", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.CfnTaskDefinition", - "version": "0.0.0" - } - }, - "app": { - "id": "app", - "path": "aws-ecs-integ/name-development-task-definition/app", - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.ContainerDefinition", - "version": "0.0.0" - } - }, - "ExecutionRole": { - "id": "ExecutionRole", - "path": "aws-ecs-integ/name-development-task-definition/ExecutionRole", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-development-task-definition/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/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "aws-ecs-integ/name-development-task-definition/ExecutionRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-development-task-definition/ExecutionRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "namedevelopmentlogs108670CC", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "namedevelopmenttaskdefinitionenvoyLogGroupF8FCAFD6", - "Arn" - ] - } - ] - }, - { - "Action": [ - "ecr:BatchCheckLayerAvailability", - "ecr:BatchGetImage", - "ecr:GetDownloadUrlForLayer" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ecr:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Fn::FindInMap": [ - "namedevelopmentenvoyimageaccountmapping", - { - "Ref": "AWS::Region" - }, - "ecrRepo" - ] - }, - ":repository/aws-appmesh-envoy" - ] - ] - } - }, - { - "Action": "ecr:GetAuthorizationToken", - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "policyName": "namedevelopmenttaskdefinitionExecutionRoleDefaultPolicy34EAA008", - "roles": [ - { - "Ref": "namedevelopmenttaskdefinitionExecutionRole48B53E4E" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "envoy": { - "id": "envoy", - "path": "aws-ecs-integ/name-development-task-definition/envoy", - "children": { - "LogGroup": { - "id": "LogGroup", - "path": "aws-ecs-integ/name-development-task-definition/envoy/LogGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-development-task-definition/envoy/LogGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.CfnLogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.LogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.ContainerDefinition", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.TaskDefinition", - "version": "0.0.0" - } - }, - "name-development-logs": { - "id": "name-development-logs", - "path": "aws-ecs-integ/name-development-logs", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-development-logs/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", - "aws:cdk:cloudformation:props": { - "logGroupName": "name-development-logs", - "retentionInDays": 30 - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.CfnLogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.LogGroup", - "version": "0.0.0" - } - }, - "name-development-envoy-image-account-mapping": { - "id": "name-development-envoy-image-account-mapping", - "path": "aws-ecs-integ/name-development-envoy-image-account-mapping", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnMapping", - "version": "0.0.0" - } - }, - "name-development-envoy-repo": { - "id": "name-development-envoy-repo", - "path": "aws-ecs-integ/name-development-envoy-repo", - "constructInfo": { - "fqn": "@aws-cdk/aws-ecr.RepositoryBase", - "version": "0.0.0" - } - }, - "name-development-envoy-to-appmesh": { - "id": "name-development-envoy-to-appmesh", - "path": "aws-ecs-integ/name-development-envoy-to-appmesh", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-development-envoy-to-appmesh/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": "appmesh:StreamAggregatedResources", - "Effect": "Allow", - "Resource": { - "Ref": "developmentmeshCEC28AFE" - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "namedevelopmentenvoytoappmesh45FF08AA", - "roles": [ - { - "Ref": "namedevelopmenttaskdefinitionTaskRole66A85BBB" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - }, - "name-development-service": { - "id": "name-development-service", - "path": "aws-ecs-integ/name-development-service", - "children": { - "Service": { - "id": "Service", - "path": "aws-ecs-integ/name-development-service/Service", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ECS::Service", - "aws:cdk:cloudformation:props": { - "cluster": { - "Ref": "developmentenvironmentcluster1B64BE8B" - }, - "deploymentConfiguration": { - "maximumPercent": 200, - "minimumHealthyPercent": 100 - }, - "desiredCount": 1, - "enableEcsManagedTags": false, - "launchType": "FARGATE", - "networkConfiguration": { - "awsvpcConfiguration": { - "assignPublicIp": "DISABLED", - "subnets": [ - { - "Ref": "developmentenvironmentvpcPrivateSubnet1SubnetAAECD171" - }, - { - "Ref": "developmentenvironmentvpcPrivateSubnet2Subnet20C1C37D" - } - ], - "securityGroups": [ - { - "Fn::GetAtt": [ - "namedevelopmentserviceSecurityGroupE2ECED97", - "GroupId" - ] - } - ] - } - }, - "serviceRegistries": [ - { - "registryArn": { - "Fn::GetAtt": [ - "namedevelopmentserviceCloudmapService63674467", - "Arn" - ] - } - } - ], - "taskDefinition": { - "Ref": "namedevelopmenttaskdefinition0468FBFF" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.CfnService", - "version": "0.0.0" - } - }, - "CloudmapService": { - "id": "CloudmapService", - "path": "aws-ecs-integ/name-development-service/CloudmapService", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-development-service/CloudmapService/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ServiceDiscovery::Service", - "aws:cdk:cloudformation:props": { - "dnsConfig": { - "dnsRecords": [ - { - "type": "A", - "ttl": 10 - } - ], - "namespaceId": { - "Fn::GetAtt": [ - "developmentenvironmentclusterDefaultServiceDiscoveryNamespace0F234767", - "Id" - ] - }, - "routingPolicy": "MULTIVALUE" - }, - "healthCheckCustomConfig": { - "failureThreshold": 2 - }, - "name": "name-development", - "namespaceId": { - "Fn::GetAtt": [ - "developmentenvironmentclusterDefaultServiceDiscoveryNamespace0F234767", - "Id" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-servicediscovery.CfnService", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-servicediscovery.Service", - "version": "0.0.0" - } - }, - "SecurityGroup": { - "id": "SecurityGroup", - "path": "aws-ecs-integ/name-development-service/SecurityGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-development-service/SecurityGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", - "aws:cdk:cloudformation:props": { - "groupDescription": "aws-ecs-integ/name-development-service/SecurityGroup", - "securityGroupEgress": [ - { - "cidrIp": "0.0.0.0/0", - "description": "Allow all outbound traffic by default", - "ipProtocol": "-1" - } - ], - "vpcId": { - "Ref": "developmentenvironmentvpcCB4216A4" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSecurityGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.SecurityGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.FargateService", - "version": "0.0.0" - } - }, - "name-development-virtual-node": { - "id": "name-development-virtual-node", - "path": "aws-ecs-integ/name-development-virtual-node", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-development-virtual-node/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::AppMesh::VirtualNode", - "aws:cdk:cloudformation:props": { - "meshName": { - "Fn::GetAtt": [ - "developmentmeshCEC28AFE", - "MeshName" - ] - }, - "spec": { - "listeners": [ - { - "portMapping": { - "port": 80, - "protocol": "http" - } - } - ], - "serviceDiscovery": { - "awsCloudMap": { - "namespaceName": "development", - "serviceName": { - "Fn::GetAtt": [ - "namedevelopmentserviceCloudmapService63674467", - "Name" - ] - } - } - } - }, - "virtualNodeName": "name-development" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.CfnVirtualNode", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.VirtualNode", - "version": "0.0.0" - } - }, - "name-development-virtual-router": { - "id": "name-development-virtual-router", - "path": "aws-ecs-integ/name-development-virtual-router", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-development-virtual-router/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::AppMesh::VirtualRouter", - "aws:cdk:cloudformation:props": { - "meshName": { - "Fn::GetAtt": [ - "developmentmeshCEC28AFE", - "MeshName" - ] - }, - "spec": { - "listeners": [ - { - "portMapping": { - "port": 80, - "protocol": "http" - } - } - ] - }, - "virtualRouterName": "name-development" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.CfnVirtualRouter", - "version": "0.0.0" - } - }, - "name-development-route": { - "id": "name-development-route", - "path": "aws-ecs-integ/name-development-virtual-router/name-development-route", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-development-virtual-router/name-development-route/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::AppMesh::Route", - "aws:cdk:cloudformation:props": { - "meshName": { - "Fn::GetAtt": [ - "developmentmeshCEC28AFE", - "MeshName" - ] - }, - "spec": { - "httpRoute": { - "action": { - "weightedTargets": [ - { - "virtualNode": { - "Fn::GetAtt": [ - "namedevelopmentvirtualnode55118E80", - "VirtualNodeName" - ] - }, - "weight": 1 - } - ] - }, - "match": { - "prefix": "/" - } - } - }, - "virtualRouterName": { - "Fn::GetAtt": [ - "namedevelopmentvirtualrouter0AE5105D", - "VirtualRouterName" - ] - }, - "routeName": "name-development-route" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.CfnRoute", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.Route", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.VirtualRouter", - "version": "0.0.0" - } - }, - "name-development-virtual-service": { - "id": "name-development-virtual-service", - "path": "aws-ecs-integ/name-development-virtual-service", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/name-development-virtual-service/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::AppMesh::VirtualService", - "aws:cdk:cloudformation:props": { - "meshName": { - "Fn::GetAtt": [ - "developmentmeshCEC28AFE", - "MeshName" - ] - }, - "spec": { - "provider": { - "virtualRouter": { - "virtualRouterName": { - "Fn::GetAtt": [ - "namedevelopmentvirtualrouter0AE5105D", - "VirtualRouterName" - ] - } - } - } - }, - "virtualServiceName": "name-development.development" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.CfnVirtualService", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appmesh.VirtualService", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Stack", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.App", - "version": "0.0.0" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/publish-subscribe.integ.snapshot/asset.a820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91/index.py b/packages/@aws-cdk-containers/ecs-service-extensions/test/publish-subscribe.integ.snapshot/asset.a820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91/index.py deleted file mode 100644 index d24454171e478..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/publish-subscribe.integ.snapshot/asset.a820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91/index.py +++ /dev/null @@ -1,15 +0,0 @@ -import os -import boto3 -from queue_backlog_calculator import QueueHandler - -def queue_handler(event, context): - """ - Handler for the lambda trigger - """ - - ecs = boto3.client('ecs') - sqs = boto3.client('sqs') - - queue_handler = QueueHandler(ecs_client=ecs, sqs_client=sqs, environ=os.environ) - - return queue_handler.emit() diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/publish-subscribe.integ.snapshot/asset.a820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91/queue_backlog_calculator.py b/packages/@aws-cdk-containers/ecs-service-extensions/test/publish-subscribe.integ.snapshot/asset.a820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91/queue_backlog_calculator.py deleted file mode 100644 index 5f14d74a76bd2..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/publish-subscribe.integ.snapshot/asset.a820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91/queue_backlog_calculator.py +++ /dev/null @@ -1,71 +0,0 @@ -from math import ceil -import time -import json - -class QueueHandler: - def __init__(self, ecs_client, sqs_client, environ): - self.ecs = ecs_client - self.sqs = sqs_client - self.cluster_name = environ['CLUSTER_NAME'] - self.service_name = environ['SERVICE_NAME'] - self.namespace = environ['NAMESPACE'] - self.queue_names = environ['QUEUE_NAMES'].split(',') - - def emit(self): - try: - running_count = self.get_running_task_count() - backlogs = [self.get_queue_backlog(queue_name, running_count) for queue_name in self.queue_names] - self.timestamp = int(time.time() * 1000) - for backlog in backlogs: - self.emit_backlog_per_task_metric(backlog['queueName'], backlog['backlogPerTask']) - except Exception as e: - Exception('Exception: {}'.format(e)) - - """ - Write the backlogPerTask metric to the stdout according to the Cloudwatch embedded metric format. - """ - def emit_backlog_per_task_metric(self, queue_name, backlog_per_task): - print(json.dumps({ - "_aws": { - "Timestamp": self.timestamp, - "CloudWatchMetrics": [{ - "Namespace": self.namespace, - "Dimensions": [["QueueName"]], - "Metrics": [{"Name":"BacklogPerTask", "Unit": "Count"}] - }], - }, - "QueueName": queue_name, - "BacklogPerTask": backlog_per_task, - })) - - """ - Get the number of tasks in the 'RUNNING' state for the service 'service_name'. - """ - def get_running_task_count(self): - service_desc = self.ecs.describe_services( - cluster=self.cluster_name, - services=[self.service_name], - ) - if len(service_desc['services']) == 0: - raise Exception('There are no services with name {} in cluster: {}'.format(self.service_name, self.cluster_name)) - return service_desc['services'][0].get('runningCount', 0) - - """ - This method calculates and returns the backlogPerTask metric for the given queue. - """ - def get_queue_backlog(self, queue_name, count): - queue_url = self.sqs.get_queue_url(QueueName=queue_name) - running_count = 1 if count == 0 else count - - def get_backlog_per_task(): - queue_attributes = self.sqs.get_queue_attributes( - QueueUrl=queue_url['QueueUrl'], - AttributeNames=['ApproximateNumberOfMessages'] - ) - num_of_msgs = int(queue_attributes['Attributes'].get('ApproximateNumberOfMessages', 0)) - return ceil(num_of_msgs/running_count) - - return { - 'queueName': queue_name, - 'backlogPerTask': get_backlog_per_task() - } \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/publish-subscribe.integ.snapshot/aws-ecs-integ.assets.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/publish-subscribe.integ.snapshot/aws-ecs-integ.assets.json deleted file mode 100644 index 17514323e1e87..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/publish-subscribe.integ.snapshot/aws-ecs-integ.assets.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "version": "20.0.0", - "files": { - "a820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91": { - "source": { - "path": "asset.a820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91", - "packaging": "zip" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "a820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91.zip", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - }, - "7bed77928bc4f184a8e1345e4025a6fc29d609cf88bd752874e21f4e42d98071": { - "source": { - "path": "aws-ecs-integ.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "7bed77928bc4f184a8e1345e4025a6fc29d609cf88bd752874e21f4e42d98071.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-containers/ecs-service-extensions/test/publish-subscribe.integ.snapshot/aws-ecs-integ.template.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/publish-subscribe.integ.snapshot/aws-ecs-integ.template.json deleted file mode 100644 index f46f9b625f469..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/publish-subscribe.integ.snapshot/aws-ecs-integ.template.json +++ /dev/null @@ -1,1349 +0,0 @@ -{ - "Resources": { - "productionenvironmentvpcAEB47DF7": { - "Type": "AWS::EC2::VPC", - "Properties": { - "CidrBlock": "10.0.0.0/16", - "EnableDnsHostnames": true, - "EnableDnsSupport": true, - "InstanceTenancy": "default", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1Subnet8D92C089": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1RouteTableAssociationA8117374": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - } - } - }, - "productionenvironmentvpcPublicSubnet1DefaultRoute524C894D": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - }, - "DependsOn": [ - "productionenvironmentvpcVPCGW1B428D07" - ] - }, - "productionenvironmentvpcPublicSubnet1EIP54BA88DB": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet1NATGateway6075E4CA": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - }, - "AllocationId": { - "Fn::GetAtt": [ - "productionenvironmentvpcPublicSubnet1EIP54BA88DB", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - }, - "DependsOn": [ - "productionenvironmentvpcPublicSubnet1DefaultRoute524C894D", - "productionenvironmentvpcPublicSubnet1RouteTableAssociationA8117374" - ] - }, - "productionenvironmentvpcPublicSubnet2Subnet298E6C31": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet2RouteTable842A68D7": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet2RouteTableAssociation0A7549F3": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet2RouteTable842A68D7" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - } - } - }, - "productionenvironmentvpcPublicSubnet2DefaultRoute92CD697D": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPublicSubnet2RouteTable842A68D7" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - }, - "DependsOn": [ - "productionenvironmentvpcVPCGW1B428D07" - ] - }, - "productionenvironmentvpcPublicSubnet2EIP14CA46AA": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "productionenvironmentvpcPublicSubnet2NATGatewayE1850FCC": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - }, - "AllocationId": { - "Fn::GetAtt": [ - "productionenvironmentvpcPublicSubnet2EIP14CA46AA", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - }, - "DependsOn": [ - "productionenvironmentvpcPublicSubnet2DefaultRoute92CD697D", - "productionenvironmentvpcPublicSubnet2RouteTableAssociation0A7549F3" - ] - }, - "productionenvironmentvpcPrivateSubnet1Subnet53F632E6": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet1RouteTableAssociation8BA32463": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - } - } - }, - "productionenvironmentvpcPrivateSubnet1DefaultRouteFBB3DE6C": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "productionenvironmentvpcPublicSubnet1NATGateway6075E4CA" - } - } - }, - "productionenvironmentvpcPrivateSubnet2Subnet756FB93C": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "productionenvironmentvpcPrivateSubnet2RouteTableAssociation09188261": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2" - }, - "SubnetId": { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - } - }, - "productionenvironmentvpcPrivateSubnet2DefaultRoute5F9AB6C1": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "productionenvironmentvpcPublicSubnet2NATGatewayE1850FCC" - } - } - }, - "productionenvironmentvpcIGWE7C39890": { - "Type": "AWS::EC2::InternetGateway", - "Properties": { - "Tags": [ - { - "Key": "Name", - "Value": "aws-ecs-integ/production-environment-vpc" - } - ] - } - }, - "productionenvironmentvpcVPCGW1B428D07": { - "Type": "AWS::EC2::VPCGatewayAttachment", - "Properties": { - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "InternetGatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - } - }, - "productionenvironmentclusterC6599D2D": { - "Type": "AWS::ECS::Cluster" - }, - "signupD2AAA171": { - "Type": "AWS::SNS::Topic" - }, - "delete1CCE71FF": { - "Type": "AWS::SNS::Topic" - }, - "PublishertaskdefinitionTaskRoleE8655AA5": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PublishertaskdefinitionTaskRoleDefaultPolicyD6E49F15": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "sns:Publish", - "Effect": "Allow", - "Resource": [ - { - "Ref": "delete1CCE71FF" - }, - { - "Ref": "signupD2AAA171" - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PublishertaskdefinitionTaskRoleDefaultPolicyD6E49F15", - "Roles": [ - { - "Ref": "PublishertaskdefinitionTaskRoleE8655AA5" - } - ] - } - }, - "PublishertaskdefinitionA4324C64": { - "Type": "AWS::ECS::TaskDefinition", - "Properties": { - "ContainerDefinitions": [ - { - "Cpu": 256, - "Environment": [ - { - "Name": "PORT", - "Value": "80" - }, - { - "Name": "SIGN-UP_TOPIC_ARN", - "Value": { - "Ref": "signupD2AAA171" - } - }, - { - "Name": "DELETE_TOPIC_ARN", - "Value": { - "Ref": "delete1CCE71FF" - } - } - ], - "Essential": true, - "Image": "nathanpeck/name", - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "PublisherlogsDF0C1067" - }, - "awslogs-stream-prefix": "Publisher", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "Memory": 512, - "Name": "app", - "PortMappings": [ - { - "ContainerPort": 80, - "Protocol": "tcp" - } - ], - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ] - } - ], - "Cpu": "256", - "ExecutionRoleArn": { - "Fn::GetAtt": [ - "PublishertaskdefinitionExecutionRole5C00C542", - "Arn" - ] - }, - "Family": "awsecsintegPublishertaskdefinitionD50610D0", - "Memory": "512", - "NetworkMode": "awsvpc", - "RequiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "TaskRoleArn": { - "Fn::GetAtt": [ - "PublishertaskdefinitionTaskRoleE8655AA5", - "Arn" - ] - } - } - }, - "PublishertaskdefinitionExecutionRole5C00C542": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PublishertaskdefinitionExecutionRoleDefaultPolicy681FD8E6": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PublisherlogsDF0C1067", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PublishertaskdefinitionExecutionRoleDefaultPolicy681FD8E6", - "Roles": [ - { - "Ref": "PublishertaskdefinitionExecutionRole5C00C542" - } - ] - } - }, - "PublisherlogsDF0C1067": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "Publisher-logs", - "RetentionInDays": 30 - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "PublisherserviceService9EB00F60": { - "Type": "AWS::ECS::Service", - "Properties": { - "Cluster": { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "DeploymentConfiguration": { - "MaximumPercent": 200, - "MinimumHealthyPercent": 100 - }, - "DesiredCount": 1, - "EnableECSManagedTags": false, - "LaunchType": "FARGATE", - "NetworkConfiguration": { - "AwsvpcConfiguration": { - "AssignPublicIp": "DISABLED", - "SecurityGroups": [ - { - "Fn::GetAtt": [ - "PublisherserviceSecurityGroupC7B0C0D0", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - }, - { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - ] - } - }, - "TaskDefinition": { - "Ref": "PublishertaskdefinitionA4324C64" - } - } - }, - "PublisherserviceSecurityGroupC7B0C0D0": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "aws-ecs-integ/Publisher-service/SecurityGroup", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "signupqueue33AFF2E6": { - "Type": "AWS::SQS::Queue", - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "signupqueuePolicy185ADC00": { - "Type": "AWS::SQS::QueuePolicy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "sqs:SendMessage", - "Condition": { - "ArnEquals": { - "aws:SourceArn": { - "Ref": "signupD2AAA171" - } - } - }, - "Effect": "Allow", - "Principal": { - "Service": "sns.amazonaws.com" - }, - "Resource": { - "Fn::GetAtt": [ - "signupqueue33AFF2E6", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "Queues": [ - { - "Ref": "signupqueue33AFF2E6" - } - ] - } - }, - "signupqueueawsecsintegsignup8DE00B29CE828029": { - "Type": "AWS::SNS::Subscription", - "Properties": { - "Protocol": "sqs", - "TopicArn": { - "Ref": "signupD2AAA171" - }, - "Endpoint": { - "Fn::GetAtt": [ - "signupqueue33AFF2E6", - "Arn" - ] - } - } - }, - "EventsDeadLetterQueue404572C7": { - "Type": "AWS::SQS::Queue", - "Properties": { - "MessageRetentionPeriod": 1209600 - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "EventsQueueB96EB0D2": { - "Type": "AWS::SQS::Queue", - "Properties": { - "RedrivePolicy": { - "deadLetterTargetArn": { - "Fn::GetAtt": [ - "EventsDeadLetterQueue404572C7", - "Arn" - ] - }, - "maxReceiveCount": 3 - } - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "EventsQueuePolicyF3E925EC": { - "Type": "AWS::SQS::QueuePolicy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "sqs:SendMessage", - "Condition": { - "ArnEquals": { - "aws:SourceArn": { - "Ref": "delete1CCE71FF" - } - } - }, - "Effect": "Allow", - "Principal": { - "Service": "sns.amazonaws.com" - }, - "Resource": { - "Fn::GetAtt": [ - "EventsQueueB96EB0D2", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "Queues": [ - { - "Ref": "EventsQueueB96EB0D2" - } - ] - } - }, - "EventsQueueawsecsintegdeleteF56807768162F4C0": { - "Type": "AWS::SNS::Subscription", - "Properties": { - "Protocol": "sqs", - "TopicArn": { - "Ref": "delete1CCE71FF" - }, - "Endpoint": { - "Fn::GetAtt": [ - "EventsQueueB96EB0D2", - "Arn" - ] - } - } - }, - "WorkertaskdefinitionTaskRole1EBF20D6": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "WorkertaskdefinitionTaskRoleDefaultPolicy45EAFD8C": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "sqs:ChangeMessageVisibility", - "sqs:DeleteMessage", - "sqs:GetQueueAttributes", - "sqs:GetQueueUrl", - "sqs:ReceiveMessage" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "EventsQueueB96EB0D2", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "signupqueue33AFF2E6", - "Arn" - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "WorkertaskdefinitionTaskRoleDefaultPolicy45EAFD8C", - "Roles": [ - { - "Ref": "WorkertaskdefinitionTaskRole1EBF20D6" - } - ] - } - }, - "WorkertaskdefinitionBF93A675": { - "Type": "AWS::ECS::TaskDefinition", - "Properties": { - "ContainerDefinitions": [ - { - "Cpu": 256, - "Environment": [ - { - "Name": "PORT", - "Value": "80" - }, - { - "Name": "WORKER_QUEUE_URI", - "Value": { - "Ref": "EventsQueueB96EB0D2" - } - } - ], - "Essential": true, - "Image": "nathanpeck/name", - "LogConfiguration": { - "LogDriver": "awslogs", - "Options": { - "awslogs-group": { - "Ref": "Workerlogs2994AC4D" - }, - "awslogs-stream-prefix": "Worker", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "Memory": 512, - "Name": "app", - "PortMappings": [ - { - "ContainerPort": 80, - "Protocol": "tcp" - } - ], - "Ulimits": [ - { - "HardLimit": 1024000, - "Name": "nofile", - "SoftLimit": 1024000 - } - ] - } - ], - "Cpu": "256", - "ExecutionRoleArn": { - "Fn::GetAtt": [ - "WorkertaskdefinitionExecutionRole3C1A1848", - "Arn" - ] - }, - "Family": "awsecsintegWorkertaskdefinition32B60762", - "Memory": "512", - "NetworkMode": "awsvpc", - "RequiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "TaskRoleArn": { - "Fn::GetAtt": [ - "WorkertaskdefinitionTaskRole1EBF20D6", - "Arn" - ] - } - } - }, - "WorkertaskdefinitionExecutionRole3C1A1848": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ecs-tasks.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "WorkertaskdefinitionExecutionRoleDefaultPolicy6E199B19": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "Workerlogs2994AC4D", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "WorkertaskdefinitionExecutionRoleDefaultPolicy6E199B19", - "Roles": [ - { - "Ref": "WorkertaskdefinitionExecutionRole3C1A1848" - } - ] - } - }, - "Workerlogs2994AC4D": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": "Worker-logs", - "RetentionInDays": 30 - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "WorkerserviceService68C5A5C3": { - "Type": "AWS::ECS::Service", - "Properties": { - "Cluster": { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "DeploymentConfiguration": { - "MaximumPercent": 200, - "MinimumHealthyPercent": 100 - }, - "EnableECSManagedTags": false, - "LaunchType": "FARGATE", - "NetworkConfiguration": { - "AwsvpcConfiguration": { - "AssignPublicIp": "DISABLED", - "SecurityGroups": [ - { - "Fn::GetAtt": [ - "WorkerserviceSecurityGroup1CDDB904", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - }, - { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - ] - } - }, - "TaskDefinition": { - "Ref": "WorkertaskdefinitionBF93A675" - } - } - }, - "WorkerserviceSecurityGroup1CDDB904": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "aws-ecs-integ/Worker-service/SecurityGroup", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "VpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "WorkerserviceTaskCountTarget6636D808": { - "Type": "AWS::ApplicationAutoScaling::ScalableTarget", - "Properties": { - "MaxCapacity": 10, - "MinCapacity": 1, - "ResourceId": { - "Fn::Join": [ - "", - [ - "service/", - { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "/", - { - "Fn::GetAtt": [ - "WorkerserviceService68C5A5C3", - "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" - } - }, - "WorkerserviceTaskCountTargetEventsQueueautoscalingpolicyD12B62ED": { - "Type": "AWS::ApplicationAutoScaling::ScalingPolicy", - "Properties": { - "PolicyName": "awsecsintegWorkerserviceTaskCountTargetEventsQueueautoscalingpolicyDBD40B57", - "PolicyType": "TargetTrackingScaling", - "ScalingTargetId": { - "Ref": "WorkerserviceTaskCountTarget6636D808" - }, - "TargetTrackingScalingPolicyConfiguration": { - "CustomizedMetricSpecification": { - "Dimensions": [ - { - "Name": "QueueName", - "Value": { - "Fn::GetAtt": [ - "EventsQueueB96EB0D2", - "QueueName" - ] - } - } - ], - "MetricName": "BacklogPerTask", - "Namespace": "production-Worker", - "Statistic": "Average", - "Unit": "Count" - }, - "TargetValue": 15 - } - } - }, - "WorkerserviceTaskCountTargetsignupqueueautoscalingpolicyB7321DB7": { - "Type": "AWS::ApplicationAutoScaling::ScalingPolicy", - "Properties": { - "PolicyName": "awsecsintegWorkerserviceTaskCountTargetsignupqueueautoscalingpolicyDF93FC37", - "PolicyType": "TargetTrackingScaling", - "ScalingTargetId": { - "Ref": "WorkerserviceTaskCountTarget6636D808" - }, - "TargetTrackingScalingPolicyConfiguration": { - "CustomizedMetricSpecification": { - "Dimensions": [ - { - "Name": "QueueName", - "Value": { - "Fn::GetAtt": [ - "signupqueue33AFF2E6", - "QueueName" - ] - } - } - ], - "MetricName": "BacklogPerTask", - "Namespace": "production-Worker", - "Statistic": "Average", - "Unit": "Count" - }, - "TargetValue": 30 - } - } - }, - "BackLogPerTaskCalculatorFunctionServiceRoleEFA723A4": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - ] - ] - } - ] - } - }, - "BackLogPerTaskCalculatorFunctionServiceRoleDefaultPolicyB6B10266": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "ecs:DescribeServices", - "Condition": { - "ArnEquals": { - "ecs:cluster": { - "Fn::GetAtt": [ - "productionenvironmentclusterC6599D2D", - "Arn" - ] - } - } - }, - "Effect": "Allow", - "Resource": { - "Ref": "WorkerserviceService68C5A5C3" - } - }, - { - "Action": [ - "sqs:GetQueueAttributes", - "sqs:GetQueueUrl" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "EventsQueueB96EB0D2", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "signupqueue33AFF2E6", - "Arn" - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "BackLogPerTaskCalculatorFunctionServiceRoleDefaultPolicyB6B10266", - "Roles": [ - { - "Ref": "BackLogPerTaskCalculatorFunctionServiceRoleEFA723A4" - } - ] - } - }, - "BackLogPerTaskCalculatorFunction95AA21D5": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Ref": "AssetParametersa820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91S3Bucket1FFDEA8D" - }, - "S3Key": { - "Fn::Join": [ - "", - [ - { - "Fn::Select": [ - 0, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParametersa820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91S3VersionKeyA60C027B" - } - ] - } - ] - }, - { - "Fn::Select": [ - 1, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParametersa820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91S3VersionKeyA60C027B" - } - ] - } - ] - } - ] - ] - } - }, - "Role": { - "Fn::GetAtt": [ - "BackLogPerTaskCalculatorFunctionServiceRoleEFA723A4", - "Arn" - ] - }, - "Environment": { - "Variables": { - "CLUSTER_NAME": { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "SERVICE_NAME": { - "Fn::GetAtt": [ - "WorkerserviceService68C5A5C3", - "Name" - ] - }, - "NAMESPACE": "production-Worker", - "QUEUE_NAMES": { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "EventsQueueB96EB0D2", - "QueueName" - ] - }, - ",", - { - "Fn::GetAtt": [ - "signupqueue33AFF2E6", - "QueueName" - ] - } - ] - ] - } - } - }, - "Handler": "index.queue_handler", - "Runtime": "python3.9" - }, - "DependsOn": [ - "BackLogPerTaskCalculatorFunctionServiceRoleDefaultPolicyB6B10266", - "BackLogPerTaskCalculatorFunctionServiceRoleEFA723A4" - ] - }, - "BacklogPerTaskScheduledRuleB871DD15": { - "Type": "AWS::Events::Rule", - "Properties": { - "ScheduleExpression": "rate(1 minute)", - "State": "ENABLED", - "Targets": [ - { - "Arn": { - "Fn::GetAtt": [ - "BackLogPerTaskCalculatorFunction95AA21D5", - "Arn" - ] - }, - "Id": "Target0" - } - ] - } - }, - "BacklogPerTaskScheduledRuleAllowEventRuleawsecsintegBackLogPerTaskCalculatorFunctionEB2B91C7CCD725BB": { - "Type": "AWS::Lambda::Permission", - "Properties": { - "Action": "lambda:InvokeFunction", - "FunctionName": { - "Fn::GetAtt": [ - "BackLogPerTaskCalculatorFunction95AA21D5", - "Arn" - ] - }, - "Principal": "events.amazonaws.com", - "SourceArn": { - "Fn::GetAtt": [ - "BacklogPerTaskScheduledRuleB871DD15", - "Arn" - ] - } - } - }, - "WorkerBackLogPerTaskCalculatorLogsA4B5AF42": { - "Type": "AWS::Logs::LogGroup", - "Properties": { - "LogGroupName": { - "Fn::Join": [ - "", - [ - "/aws/lambda/", - { - "Ref": "BackLogPerTaskCalculatorFunction95AA21D5" - } - ] - ] - }, - "RetentionInDays": 3 - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - } - }, - "Parameters": { - "AssetParametersa820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91S3Bucket1FFDEA8D": { - "Type": "String", - "Description": "S3 bucket for asset \"a820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91\"" - }, - "AssetParametersa820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91S3VersionKeyA60C027B": { - "Type": "String", - "Description": "S3 key for asset version \"a820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91\"" - }, - "AssetParametersa820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91ArtifactHashC1953821": { - "Type": "String", - "Description": "Artifact hash for asset \"a820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91\"" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/publish-subscribe.integ.snapshot/cdk.out b/packages/@aws-cdk-containers/ecs-service-extensions/test/publish-subscribe.integ.snapshot/cdk.out deleted file mode 100644 index 588d7b269d34f..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/publish-subscribe.integ.snapshot/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/publish-subscribe.integ.snapshot/integ.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/publish-subscribe.integ.snapshot/integ.json deleted file mode 100644 index bff18dd3c507a..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/publish-subscribe.integ.snapshot/integ.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "version": "20.0.0", - "testCases": { - "integ.publish-subscribe": { - "stacks": [ - "aws-ecs-integ" - ], - "diffAssets": false, - "stackUpdateWorkflow": true - } - }, - "synthContext": {}, - "enableLookups": false -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/publish-subscribe.integ.snapshot/manifest.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/publish-subscribe.integ.snapshot/manifest.json deleted file mode 100644 index ea9a28cc5a1ec..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/publish-subscribe.integ.snapshot/manifest.json +++ /dev/null @@ -1,402 +0,0 @@ -{ - "version": "20.0.0", - "artifacts": { - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - }, - "aws-ecs-integ": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "aws-ecs-integ.template.json", - "validateOnSynth": false - }, - "metadata": { - "/aws-ecs-integ": [ - { - "type": "aws:cdk:asset", - "data": { - "path": "asset.a820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91", - "id": "a820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91", - "packaging": "zip", - "sourceHash": "a820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91", - "s3BucketParameter": "AssetParametersa820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91S3Bucket1FFDEA8D", - "s3KeyParameter": "AssetParametersa820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91S3VersionKeyA60C027B", - "artifactHashParameter": "AssetParametersa820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91ArtifactHashC1953821" - } - } - ], - "/aws-ecs-integ/production-environment-vpc/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcAEB47DF7" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet1/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet1/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet1/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet1RouteTableAssociationA8117374" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet1/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet1DefaultRoute524C894D" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet1/EIP": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet1EIP54BA88DB" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet1/NATGateway": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet1NATGateway6075E4CA" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet2/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet2/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet2RouteTable842A68D7" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet2/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet2RouteTableAssociation0A7549F3" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet2/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet2DefaultRoute92CD697D" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet2/EIP": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet2EIP14CA46AA" - } - ], - "/aws-ecs-integ/production-environment-vpc/PublicSubnet2/NATGateway": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPublicSubnet2NATGatewayE1850FCC" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet1/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet1/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet1/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet1RouteTableAssociation8BA32463" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet1/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet1DefaultRouteFBB3DE6C" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet2/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet2/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet2/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet2RouteTableAssociation09188261" - } - ], - "/aws-ecs-integ/production-environment-vpc/PrivateSubnet2/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcPrivateSubnet2DefaultRoute5F9AB6C1" - } - ], - "/aws-ecs-integ/production-environment-vpc/IGW": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcIGWE7C39890" - } - ], - "/aws-ecs-integ/production-environment-vpc/VPCGW": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentvpcVPCGW1B428D07" - } - ], - "/aws-ecs-integ/production-environment-cluster/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "productionenvironmentclusterC6599D2D" - } - ], - "/aws-ecs-integ/sign-up/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "signupD2AAA171" - } - ], - "/aws-ecs-integ/delete/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "delete1CCE71FF" - } - ], - "/aws-ecs-integ/Publisher-task-definition/TaskRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PublishertaskdefinitionTaskRoleE8655AA5" - } - ], - "/aws-ecs-integ/Publisher-task-definition/TaskRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PublishertaskdefinitionTaskRoleDefaultPolicyD6E49F15" - } - ], - "/aws-ecs-integ/Publisher-task-definition/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PublishertaskdefinitionA4324C64" - } - ], - "/aws-ecs-integ/Publisher-task-definition/ExecutionRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PublishertaskdefinitionExecutionRole5C00C542" - } - ], - "/aws-ecs-integ/Publisher-task-definition/ExecutionRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PublishertaskdefinitionExecutionRoleDefaultPolicy681FD8E6" - } - ], - "/aws-ecs-integ/Publisher-logs/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PublisherlogsDF0C1067" - } - ], - "/aws-ecs-integ/Publisher-service/Service": [ - { - "type": "aws:cdk:logicalId", - "data": "PublisherserviceService9EB00F60" - } - ], - "/aws-ecs-integ/Publisher-service/SecurityGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PublisherserviceSecurityGroupC7B0C0D0" - } - ], - "/aws-ecs-integ/sign-up-queue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "signupqueue33AFF2E6" - } - ], - "/aws-ecs-integ/sign-up-queue/Policy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "signupqueuePolicy185ADC00" - } - ], - "/aws-ecs-integ/sign-up-queue/awsecsintegsignup8DE00B29/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "signupqueueawsecsintegsignup8DE00B29CE828029" - } - ], - "/aws-ecs-integ/EventsDeadLetterQueue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "EventsDeadLetterQueue404572C7" - } - ], - "/aws-ecs-integ/EventsQueue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "EventsQueueB96EB0D2" - } - ], - "/aws-ecs-integ/EventsQueue/Policy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "EventsQueuePolicyF3E925EC" - } - ], - "/aws-ecs-integ/EventsQueue/awsecsintegdeleteF5680776/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "EventsQueueawsecsintegdeleteF56807768162F4C0" - } - ], - "/aws-ecs-integ/Worker-task-definition/TaskRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "WorkertaskdefinitionTaskRole1EBF20D6" - } - ], - "/aws-ecs-integ/Worker-task-definition/TaskRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "WorkertaskdefinitionTaskRoleDefaultPolicy45EAFD8C" - } - ], - "/aws-ecs-integ/Worker-task-definition/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "WorkertaskdefinitionBF93A675" - } - ], - "/aws-ecs-integ/Worker-task-definition/ExecutionRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "WorkertaskdefinitionExecutionRole3C1A1848" - } - ], - "/aws-ecs-integ/Worker-task-definition/ExecutionRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "WorkertaskdefinitionExecutionRoleDefaultPolicy6E199B19" - } - ], - "/aws-ecs-integ/Worker-logs/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Workerlogs2994AC4D" - } - ], - "/aws-ecs-integ/Worker-service/Service": [ - { - "type": "aws:cdk:logicalId", - "data": "WorkerserviceService68C5A5C3" - } - ], - "/aws-ecs-integ/Worker-service/SecurityGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "WorkerserviceSecurityGroup1CDDB904" - } - ], - "/aws-ecs-integ/Worker-service/TaskCount/Target/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "WorkerserviceTaskCountTarget6636D808" - } - ], - "/aws-ecs-integ/Worker-service/TaskCount/Target/EventsQueue-autoscaling-policy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "WorkerserviceTaskCountTargetEventsQueueautoscalingpolicyD12B62ED" - } - ], - "/aws-ecs-integ/Worker-service/TaskCount/Target/sign-up-queue-autoscaling-policy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "WorkerserviceTaskCountTargetsignupqueueautoscalingpolicyB7321DB7" - } - ], - "/aws-ecs-integ/BackLogPerTaskCalculatorFunction/ServiceRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "BackLogPerTaskCalculatorFunctionServiceRoleEFA723A4" - } - ], - "/aws-ecs-integ/BackLogPerTaskCalculatorFunction/ServiceRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "BackLogPerTaskCalculatorFunctionServiceRoleDefaultPolicyB6B10266" - } - ], - "/aws-ecs-integ/BackLogPerTaskCalculatorFunction/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "BackLogPerTaskCalculatorFunction95AA21D5" - } - ], - "/aws-ecs-integ/AssetParameters/a820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91/S3Bucket": [ - { - "type": "aws:cdk:logicalId", - "data": "AssetParametersa820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91S3Bucket1FFDEA8D" - } - ], - "/aws-ecs-integ/AssetParameters/a820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91/S3VersionKey": [ - { - "type": "aws:cdk:logicalId", - "data": "AssetParametersa820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91S3VersionKeyA60C027B" - } - ], - "/aws-ecs-integ/AssetParameters/a820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91/ArtifactHash": [ - { - "type": "aws:cdk:logicalId", - "data": "AssetParametersa820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91ArtifactHashC1953821" - } - ], - "/aws-ecs-integ/BacklogPerTaskScheduledRule/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "BacklogPerTaskScheduledRuleB871DD15" - } - ], - "/aws-ecs-integ/BacklogPerTaskScheduledRule/AllowEventRuleawsecsintegBackLogPerTaskCalculatorFunctionEB2B91C7": [ - { - "type": "aws:cdk:logicalId", - "data": "BacklogPerTaskScheduledRuleAllowEventRuleawsecsintegBackLogPerTaskCalculatorFunctionEB2B91C7CCD725BB" - } - ], - "/aws-ecs-integ/Worker-BackLogPerTaskCalculatorLogs/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "WorkerBackLogPerTaskCalculatorLogsA4B5AF42" - } - ] - }, - "displayName": "aws-ecs-integ" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/publish-subscribe.integ.snapshot/tree.json b/packages/@aws-cdk-containers/ecs-service-extensions/test/publish-subscribe.integ.snapshot/tree.json deleted file mode 100644 index 444bf4b24fee4..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/publish-subscribe.integ.snapshot/tree.json +++ /dev/null @@ -1,2350 +0,0 @@ -{ - "version": "tree-0.1", - "tree": { - "id": "App", - "path": "", - "children": { - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.78" - } - }, - "aws-ecs-integ": { - "id": "aws-ecs-integ", - "path": "aws-ecs-integ", - "children": { - "production": { - "id": "production", - "path": "aws-ecs-integ/production", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.78" - } - }, - "production-environment-vpc": { - "id": "production-environment-vpc", - "path": "aws-ecs-integ/production-environment-vpc", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/production-environment-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-integ/production-environment-vpc" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnVPC", - "version": "0.0.0" - } - }, - "PublicSubnet1": { - "id": "PublicSubnet1", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21" - }, - "subnetId": { - "Ref": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPublicSubnet1RouteTable6E9ABC21" - }, - "destinationCidrBlock": "0.0.0.0/0", - "gatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - }, - "EIP": { - "id": "EIP", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1/EIP", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::EIP", - "aws:cdk:cloudformation:props": { - "domain": "vpc", - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnEIP", - "version": "0.0.0" - } - }, - "NATGateway": { - "id": "NATGateway", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet1/NATGateway", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", - "aws:cdk:cloudformation:props": { - "subnetId": { - "Ref": "productionenvironmentvpcPublicSubnet1Subnet8D92C089" - }, - "allocationId": { - "Fn::GetAtt": [ - "productionenvironmentvpcPublicSubnet1EIP54BA88DB", - "AllocationId" - ] - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnNatGateway", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PublicSubnet", - "version": "0.0.0" - } - }, - "PublicSubnet2": { - "id": "PublicSubnet2", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPublicSubnet2RouteTable842A68D7" - }, - "subnetId": { - "Ref": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPublicSubnet2RouteTable842A68D7" - }, - "destinationCidrBlock": "0.0.0.0/0", - "gatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - }, - "EIP": { - "id": "EIP", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2/EIP", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::EIP", - "aws:cdk:cloudformation:props": { - "domain": "vpc", - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnEIP", - "version": "0.0.0" - } - }, - "NATGateway": { - "id": "NATGateway", - "path": "aws-ecs-integ/production-environment-vpc/PublicSubnet2/NATGateway", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", - "aws:cdk:cloudformation:props": { - "subnetId": { - "Ref": "productionenvironmentvpcPublicSubnet2Subnet298E6C31" - }, - "allocationId": { - "Fn::GetAtt": [ - "productionenvironmentvpcPublicSubnet2EIP14CA46AA", - "AllocationId" - ] - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnNatGateway", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PublicSubnet", - "version": "0.0.0" - } - }, - "PrivateSubnet1": { - "id": "PrivateSubnet1", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C" - }, - "subnetId": { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet1/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet1RouteTable2C6DFF0C" - }, - "destinationCidrBlock": "0.0.0.0/0", - "natGatewayId": { - "Ref": "productionenvironmentvpcPublicSubnet1NATGateway6075E4CA" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PrivateSubnet", - "version": "0.0.0" - } - }, - "PrivateSubnet2": { - "id": "PrivateSubnet2", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "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-integ/production-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2" - }, - "subnetId": { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-ecs-integ/production-environment-vpc/PrivateSubnet2/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "productionenvironmentvpcPrivateSubnet2RouteTable2F77D0D2" - }, - "destinationCidrBlock": "0.0.0.0/0", - "natGatewayId": { - "Ref": "productionenvironmentvpcPublicSubnet2NATGatewayE1850FCC" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PrivateSubnet", - "version": "0.0.0" - } - }, - "IGW": { - "id": "IGW", - "path": "aws-ecs-integ/production-environment-vpc/IGW", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::InternetGateway", - "aws:cdk:cloudformation:props": { - "tags": [ - { - "key": "Name", - "value": "aws-ecs-integ/production-environment-vpc" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnInternetGateway", - "version": "0.0.0" - } - }, - "VPCGW": { - "id": "VPCGW", - "path": "aws-ecs-integ/production-environment-vpc/VPCGW", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - }, - "internetGatewayId": { - "Ref": "productionenvironmentvpcIGWE7C39890" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnVPCGatewayAttachment", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.Vpc", - "version": "0.0.0" - } - }, - "production-environment-cluster": { - "id": "production-environment-cluster", - "path": "aws-ecs-integ/production-environment-cluster", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/production-environment-cluster/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ECS::Cluster", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.CfnCluster", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.Cluster", - "version": "0.0.0" - } - }, - "sign-up": { - "id": "sign-up", - "path": "aws-ecs-integ/sign-up", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/sign-up/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SNS::Topic", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sns.CfnTopic", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sns.Topic", - "version": "0.0.0" - } - }, - "delete": { - "id": "delete", - "path": "aws-ecs-integ/delete", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/delete/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SNS::Topic", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sns.CfnTopic", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sns.Topic", - "version": "0.0.0" - } - }, - "Publisher": { - "id": "Publisher", - "path": "aws-ecs-integ/Publisher", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.78" - } - }, - "Publisher-task-definition": { - "id": "Publisher-task-definition", - "path": "aws-ecs-integ/Publisher-task-definition", - "children": { - "TaskRole": { - "id": "TaskRole", - "path": "aws-ecs-integ/Publisher-task-definition/TaskRole", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/Publisher-task-definition/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/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "aws-ecs-integ/Publisher-task-definition/TaskRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/Publisher-task-definition/TaskRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": "sns:Publish", - "Effect": "Allow", - "Resource": [ - { - "Ref": "delete1CCE71FF" - }, - { - "Ref": "signupD2AAA171" - } - ] - } - ], - "Version": "2012-10-17" - }, - "policyName": "PublishertaskdefinitionTaskRoleDefaultPolicyD6E49F15", - "roles": [ - { - "Ref": "PublishertaskdefinitionTaskRoleE8655AA5" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/Publisher-task-definition/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ECS::TaskDefinition", - "aws:cdk:cloudformation:props": { - "containerDefinitions": [ - { - "cpu": 256, - "essential": true, - "image": "nathanpeck/name", - "memory": 512, - "name": "app", - "portMappings": [ - { - "containerPort": 80, - "protocol": "tcp" - } - ], - "ulimits": [ - { - "name": "nofile", - "softLimit": 1024000, - "hardLimit": 1024000 - } - ], - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-group": { - "Ref": "PublisherlogsDF0C1067" - }, - "awslogs-stream-prefix": "Publisher", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "environment": [ - { - "name": "PORT", - "value": "80" - }, - { - "name": "SIGN-UP_TOPIC_ARN", - "value": { - "Ref": "signupD2AAA171" - } - }, - { - "name": "DELETE_TOPIC_ARN", - "value": { - "Ref": "delete1CCE71FF" - } - } - ] - } - ], - "cpu": "256", - "executionRoleArn": { - "Fn::GetAtt": [ - "PublishertaskdefinitionExecutionRole5C00C542", - "Arn" - ] - }, - "family": "awsecsintegPublishertaskdefinitionD50610D0", - "memory": "512", - "networkMode": "awsvpc", - "requiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "taskRoleArn": { - "Fn::GetAtt": [ - "PublishertaskdefinitionTaskRoleE8655AA5", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.CfnTaskDefinition", - "version": "0.0.0" - } - }, - "app": { - "id": "app", - "path": "aws-ecs-integ/Publisher-task-definition/app", - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.ContainerDefinition", - "version": "0.0.0" - } - }, - "ExecutionRole": { - "id": "ExecutionRole", - "path": "aws-ecs-integ/Publisher-task-definition/ExecutionRole", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/Publisher-task-definition/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/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "aws-ecs-integ/Publisher-task-definition/ExecutionRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/Publisher-task-definition/ExecutionRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PublisherlogsDF0C1067", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "PublishertaskdefinitionExecutionRoleDefaultPolicy681FD8E6", - "roles": [ - { - "Ref": "PublishertaskdefinitionExecutionRole5C00C542" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.TaskDefinition", - "version": "0.0.0" - } - }, - "Publisher-logs": { - "id": "Publisher-logs", - "path": "aws-ecs-integ/Publisher-logs", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/Publisher-logs/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", - "aws:cdk:cloudformation:props": { - "logGroupName": "Publisher-logs", - "retentionInDays": 30 - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.CfnLogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.LogGroup", - "version": "0.0.0" - } - }, - "Publisher-service": { - "id": "Publisher-service", - "path": "aws-ecs-integ/Publisher-service", - "children": { - "Service": { - "id": "Service", - "path": "aws-ecs-integ/Publisher-service/Service", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ECS::Service", - "aws:cdk:cloudformation:props": { - "cluster": { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "deploymentConfiguration": { - "maximumPercent": 200, - "minimumHealthyPercent": 100 - }, - "desiredCount": 1, - "enableEcsManagedTags": false, - "launchType": "FARGATE", - "networkConfiguration": { - "awsvpcConfiguration": { - "assignPublicIp": "DISABLED", - "subnets": [ - { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - }, - { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - ], - "securityGroups": [ - { - "Fn::GetAtt": [ - "PublisherserviceSecurityGroupC7B0C0D0", - "GroupId" - ] - } - ] - } - }, - "taskDefinition": { - "Ref": "PublishertaskdefinitionA4324C64" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.CfnService", - "version": "0.0.0" - } - }, - "SecurityGroup": { - "id": "SecurityGroup", - "path": "aws-ecs-integ/Publisher-service/SecurityGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/Publisher-service/SecurityGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", - "aws:cdk:cloudformation:props": { - "groupDescription": "aws-ecs-integ/Publisher-service/SecurityGroup", - "securityGroupEgress": [ - { - "cidrIp": "0.0.0.0/0", - "description": "Allow all outbound traffic by default", - "ipProtocol": "-1" - } - ], - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSecurityGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.SecurityGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.FargateService", - "version": "0.0.0" - } - }, - "sign-up-queue": { - "id": "sign-up-queue", - "path": "aws-ecs-integ/sign-up-queue", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/sign-up-queue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - }, - "Policy": { - "id": "Policy", - "path": "aws-ecs-integ/sign-up-queue/Policy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/sign-up-queue/Policy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::QueuePolicy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": "sqs:SendMessage", - "Condition": { - "ArnEquals": { - "aws:SourceArn": { - "Ref": "signupD2AAA171" - } - } - }, - "Effect": "Allow", - "Principal": { - "Service": "sns.amazonaws.com" - }, - "Resource": { - "Fn::GetAtt": [ - "signupqueue33AFF2E6", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "queues": [ - { - "Ref": "signupqueue33AFF2E6" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueuePolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.QueuePolicy", - "version": "0.0.0" - } - }, - "awsecsintegsignup8DE00B29": { - "id": "awsecsintegsignup8DE00B29", - "path": "aws-ecs-integ/sign-up-queue/awsecsintegsignup8DE00B29", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/sign-up-queue/awsecsintegsignup8DE00B29/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SNS::Subscription", - "aws:cdk:cloudformation:props": { - "protocol": "sqs", - "topicArn": { - "Ref": "signupD2AAA171" - }, - "endpoint": { - "Fn::GetAtt": [ - "signupqueue33AFF2E6", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sns.CfnSubscription", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sns.Subscription", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "Worker": { - "id": "Worker", - "path": "aws-ecs-integ/Worker", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.78" - } - }, - "EventsDeadLetterQueue": { - "id": "EventsDeadLetterQueue", - "path": "aws-ecs-integ/EventsDeadLetterQueue", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/EventsDeadLetterQueue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": { - "messageRetentionPeriod": 1209600 - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "EventsQueue": { - "id": "EventsQueue", - "path": "aws-ecs-integ/EventsQueue", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/EventsQueue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": { - "redrivePolicy": { - "deadLetterTargetArn": { - "Fn::GetAtt": [ - "EventsDeadLetterQueue404572C7", - "Arn" - ] - }, - "maxReceiveCount": 3 - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - }, - "Policy": { - "id": "Policy", - "path": "aws-ecs-integ/EventsQueue/Policy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/EventsQueue/Policy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::QueuePolicy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": "sqs:SendMessage", - "Condition": { - "ArnEquals": { - "aws:SourceArn": { - "Ref": "delete1CCE71FF" - } - } - }, - "Effect": "Allow", - "Principal": { - "Service": "sns.amazonaws.com" - }, - "Resource": { - "Fn::GetAtt": [ - "EventsQueueB96EB0D2", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "queues": [ - { - "Ref": "EventsQueueB96EB0D2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueuePolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.QueuePolicy", - "version": "0.0.0" - } - }, - "awsecsintegdeleteF5680776": { - "id": "awsecsintegdeleteF5680776", - "path": "aws-ecs-integ/EventsQueue/awsecsintegdeleteF5680776", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/EventsQueue/awsecsintegdeleteF5680776/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SNS::Subscription", - "aws:cdk:cloudformation:props": { - "protocol": "sqs", - "topicArn": { - "Ref": "delete1CCE71FF" - }, - "endpoint": { - "Fn::GetAtt": [ - "EventsQueueB96EB0D2", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sns.CfnSubscription", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sns.Subscription", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "Worker-task-definition": { - "id": "Worker-task-definition", - "path": "aws-ecs-integ/Worker-task-definition", - "children": { - "TaskRole": { - "id": "TaskRole", - "path": "aws-ecs-integ/Worker-task-definition/TaskRole", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/Worker-task-definition/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/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "aws-ecs-integ/Worker-task-definition/TaskRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/Worker-task-definition/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": [ - "EventsQueueB96EB0D2", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "signupqueue33AFF2E6", - "Arn" - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "policyName": "WorkertaskdefinitionTaskRoleDefaultPolicy45EAFD8C", - "roles": [ - { - "Ref": "WorkertaskdefinitionTaskRole1EBF20D6" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/Worker-task-definition/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ECS::TaskDefinition", - "aws:cdk:cloudformation:props": { - "containerDefinitions": [ - { - "cpu": 256, - "essential": true, - "image": "nathanpeck/name", - "memory": 512, - "name": "app", - "portMappings": [ - { - "containerPort": 80, - "protocol": "tcp" - } - ], - "ulimits": [ - { - "name": "nofile", - "softLimit": 1024000, - "hardLimit": 1024000 - } - ], - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-group": { - "Ref": "Workerlogs2994AC4D" - }, - "awslogs-stream-prefix": "Worker", - "awslogs-region": { - "Ref": "AWS::Region" - } - } - }, - "environment": [ - { - "name": "PORT", - "value": "80" - }, - { - "name": "WORKER_QUEUE_URI", - "value": { - "Ref": "EventsQueueB96EB0D2" - } - } - ] - } - ], - "cpu": "256", - "executionRoleArn": { - "Fn::GetAtt": [ - "WorkertaskdefinitionExecutionRole3C1A1848", - "Arn" - ] - }, - "family": "awsecsintegWorkertaskdefinition32B60762", - "memory": "512", - "networkMode": "awsvpc", - "requiresCompatibilities": [ - "EC2", - "FARGATE" - ], - "taskRoleArn": { - "Fn::GetAtt": [ - "WorkertaskdefinitionTaskRole1EBF20D6", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.CfnTaskDefinition", - "version": "0.0.0" - } - }, - "app": { - "id": "app", - "path": "aws-ecs-integ/Worker-task-definition/app", - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.ContainerDefinition", - "version": "0.0.0" - } - }, - "ExecutionRole": { - "id": "ExecutionRole", - "path": "aws-ecs-integ/Worker-task-definition/ExecutionRole", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/Worker-task-definition/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/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "aws-ecs-integ/Worker-task-definition/ExecutionRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/Worker-task-definition/ExecutionRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "Workerlogs2994AC4D", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "WorkertaskdefinitionExecutionRoleDefaultPolicy6E199B19", - "roles": [ - { - "Ref": "WorkertaskdefinitionExecutionRole3C1A1848" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.TaskDefinition", - "version": "0.0.0" - } - }, - "Worker-logs": { - "id": "Worker-logs", - "path": "aws-ecs-integ/Worker-logs", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/Worker-logs/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", - "aws:cdk:cloudformation:props": { - "logGroupName": "Worker-logs", - "retentionInDays": 30 - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.CfnLogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.LogGroup", - "version": "0.0.0" - } - }, - "Worker-service": { - "id": "Worker-service", - "path": "aws-ecs-integ/Worker-service", - "children": { - "Service": { - "id": "Service", - "path": "aws-ecs-integ/Worker-service/Service", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ECS::Service", - "aws:cdk:cloudformation:props": { - "cluster": { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "deploymentConfiguration": { - "maximumPercent": 200, - "minimumHealthyPercent": 100 - }, - "enableEcsManagedTags": false, - "launchType": "FARGATE", - "networkConfiguration": { - "awsvpcConfiguration": { - "assignPublicIp": "DISABLED", - "subnets": [ - { - "Ref": "productionenvironmentvpcPrivateSubnet1Subnet53F632E6" - }, - { - "Ref": "productionenvironmentvpcPrivateSubnet2Subnet756FB93C" - } - ], - "securityGroups": [ - { - "Fn::GetAtt": [ - "WorkerserviceSecurityGroup1CDDB904", - "GroupId" - ] - } - ] - } - }, - "taskDefinition": { - "Ref": "WorkertaskdefinitionBF93A675" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.CfnService", - "version": "0.0.0" - } - }, - "SecurityGroup": { - "id": "SecurityGroup", - "path": "aws-ecs-integ/Worker-service/SecurityGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/Worker-service/SecurityGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", - "aws:cdk:cloudformation:props": { - "groupDescription": "aws-ecs-integ/Worker-service/SecurityGroup", - "securityGroupEgress": [ - { - "cidrIp": "0.0.0.0/0", - "description": "Allow all outbound traffic by default", - "ipProtocol": "-1" - } - ], - "vpcId": { - "Ref": "productionenvironmentvpcAEB47DF7" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSecurityGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.SecurityGroup", - "version": "0.0.0" - } - }, - "ScalingRole": { - "id": "ScalingRole", - "path": "aws-ecs-integ/Worker-service/ScalingRole", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "TaskCount": { - "id": "TaskCount", - "path": "aws-ecs-integ/Worker-service/TaskCount", - "children": { - "Target": { - "id": "Target", - "path": "aws-ecs-integ/Worker-service/TaskCount/Target", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/Worker-service/TaskCount/Target/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ApplicationAutoScaling::ScalableTarget", - "aws:cdk:cloudformation:props": { - "maxCapacity": 10, - "minCapacity": 1, - "resourceId": { - "Fn::Join": [ - "", - [ - "service/", - { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "/", - { - "Fn::GetAtt": [ - "WorkerserviceService68C5A5C3", - "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/aws-applicationautoscaling.CfnScalableTarget", - "version": "0.0.0" - } - }, - "EventsQueue-autoscaling-policy": { - "id": "EventsQueue-autoscaling-policy", - "path": "aws-ecs-integ/Worker-service/TaskCount/Target/EventsQueue-autoscaling-policy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/Worker-service/TaskCount/Target/EventsQueue-autoscaling-policy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ApplicationAutoScaling::ScalingPolicy", - "aws:cdk:cloudformation:props": { - "policyName": "awsecsintegWorkerserviceTaskCountTargetEventsQueueautoscalingpolicyDBD40B57", - "policyType": "TargetTrackingScaling", - "scalingTargetId": { - "Ref": "WorkerserviceTaskCountTarget6636D808" - }, - "targetTrackingScalingPolicyConfiguration": { - "customizedMetricSpecification": { - "dimensions": [ - { - "name": "QueueName", - "value": { - "Fn::GetAtt": [ - "EventsQueueB96EB0D2", - "QueueName" - ] - } - } - ], - "metricName": "BacklogPerTask", - "namespace": "production-Worker", - "statistic": "Average", - "unit": "Count" - }, - "targetValue": 15 - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-applicationautoscaling.CfnScalingPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-applicationautoscaling.TargetTrackingScalingPolicy", - "version": "0.0.0" - } - }, - "sign-up-queue-autoscaling-policy": { - "id": "sign-up-queue-autoscaling-policy", - "path": "aws-ecs-integ/Worker-service/TaskCount/Target/sign-up-queue-autoscaling-policy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/Worker-service/TaskCount/Target/sign-up-queue-autoscaling-policy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ApplicationAutoScaling::ScalingPolicy", - "aws:cdk:cloudformation:props": { - "policyName": "awsecsintegWorkerserviceTaskCountTargetsignupqueueautoscalingpolicyDF93FC37", - "policyType": "TargetTrackingScaling", - "scalingTargetId": { - "Ref": "WorkerserviceTaskCountTarget6636D808" - }, - "targetTrackingScalingPolicyConfiguration": { - "customizedMetricSpecification": { - "dimensions": [ - { - "name": "QueueName", - "value": { - "Fn::GetAtt": [ - "signupqueue33AFF2E6", - "QueueName" - ] - } - } - ], - "metricName": "BacklogPerTask", - "namespace": "production-Worker", - "statistic": "Average", - "unit": "Count" - }, - "targetValue": 30 - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-applicationautoscaling.CfnScalingPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-applicationautoscaling.TargetTrackingScalingPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-applicationautoscaling.ScalableTarget", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.ScalableTaskCount", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.FargateService", - "version": "0.0.0" - } - }, - "BackLogPerTaskCalculatorFunction": { - "id": "BackLogPerTaskCalculatorFunction", - "path": "aws-ecs-integ/BackLogPerTaskCalculatorFunction", - "children": { - "ServiceRole": { - "id": "ServiceRole", - "path": "aws-ecs-integ/BackLogPerTaskCalculatorFunction/ServiceRole", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/BackLogPerTaskCalculatorFunction/ServiceRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "managedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - ] - ] - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "aws-ecs-integ/BackLogPerTaskCalculatorFunction/ServiceRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/BackLogPerTaskCalculatorFunction/ServiceRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": "ecs:DescribeServices", - "Condition": { - "ArnEquals": { - "ecs:cluster": { - "Fn::GetAtt": [ - "productionenvironmentclusterC6599D2D", - "Arn" - ] - } - } - }, - "Effect": "Allow", - "Resource": { - "Ref": "WorkerserviceService68C5A5C3" - } - }, - { - "Action": [ - "sqs:GetQueueAttributes", - "sqs:GetQueueUrl" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "EventsQueueB96EB0D2", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "signupqueue33AFF2E6", - "Arn" - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "policyName": "BackLogPerTaskCalculatorFunctionServiceRoleDefaultPolicyB6B10266", - "roles": [ - { - "Ref": "BackLogPerTaskCalculatorFunctionServiceRoleEFA723A4" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Code": { - "id": "Code", - "path": "aws-ecs-integ/BackLogPerTaskCalculatorFunction/Code", - "children": { - "Stage": { - "id": "Stage", - "path": "aws-ecs-integ/BackLogPerTaskCalculatorFunction/Code/Stage", - "constructInfo": { - "fqn": "@aws-cdk/core.AssetStaging", - "version": "0.0.0" - } - }, - "AssetBucket": { - "id": "AssetBucket", - "path": "aws-ecs-integ/BackLogPerTaskCalculatorFunction/Code/AssetBucket", - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.BucketBase", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3-assets.Asset", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/BackLogPerTaskCalculatorFunction/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Lambda::Function", - "aws:cdk:cloudformation:props": { - "code": { - "s3Bucket": { - "Ref": "AssetParametersa820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91S3Bucket1FFDEA8D" - }, - "s3Key": { - "Fn::Join": [ - "", - [ - { - "Fn::Select": [ - 0, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParametersa820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91S3VersionKeyA60C027B" - } - ] - } - ] - }, - { - "Fn::Select": [ - 1, - { - "Fn::Split": [ - "||", - { - "Ref": "AssetParametersa820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91S3VersionKeyA60C027B" - } - ] - } - ] - } - ] - ] - } - }, - "role": { - "Fn::GetAtt": [ - "BackLogPerTaskCalculatorFunctionServiceRoleEFA723A4", - "Arn" - ] - }, - "environment": { - "variables": { - "CLUSTER_NAME": { - "Ref": "productionenvironmentclusterC6599D2D" - }, - "SERVICE_NAME": { - "Fn::GetAtt": [ - "WorkerserviceService68C5A5C3", - "Name" - ] - }, - "NAMESPACE": "production-Worker", - "QUEUE_NAMES": { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "EventsQueueB96EB0D2", - "QueueName" - ] - }, - ",", - { - "Fn::GetAtt": [ - "signupqueue33AFF2E6", - "QueueName" - ] - } - ] - ] - } - } - }, - "handler": "index.queue_handler", - "runtime": "python3.9" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-lambda.CfnFunction", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-lambda.Function", - "version": "0.0.0" - } - }, - "AssetParameters": { - "id": "AssetParameters", - "path": "aws-ecs-integ/AssetParameters", - "children": { - "a820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91": { - "id": "a820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91", - "path": "aws-ecs-integ/AssetParameters/a820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91", - "children": { - "S3Bucket": { - "id": "S3Bucket", - "path": "aws-ecs-integ/AssetParameters/a820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91/S3Bucket", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnParameter", - "version": "0.0.0" - } - }, - "S3VersionKey": { - "id": "S3VersionKey", - "path": "aws-ecs-integ/AssetParameters/a820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91/S3VersionKey", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnParameter", - "version": "0.0.0" - } - }, - "ArtifactHash": { - "id": "ArtifactHash", - "path": "aws-ecs-integ/AssetParameters/a820140ad8525b8ed56ad2a7bcd9da99d6afc2490e8c91e34620886c011bdc91/ArtifactHash", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnParameter", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.78" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.78" - } - }, - "BacklogPerTaskScheduledRule": { - "id": "BacklogPerTaskScheduledRule", - "path": "aws-ecs-integ/BacklogPerTaskScheduledRule", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/BacklogPerTaskScheduledRule/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Events::Rule", - "aws:cdk:cloudformation:props": { - "scheduleExpression": "rate(1 minute)", - "state": "ENABLED", - "targets": [ - { - "id": "Target0", - "arn": { - "Fn::GetAtt": [ - "BackLogPerTaskCalculatorFunction95AA21D5", - "Arn" - ] - } - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-events.CfnRule", - "version": "0.0.0" - } - }, - "AllowEventRuleawsecsintegBackLogPerTaskCalculatorFunctionEB2B91C7": { - "id": "AllowEventRuleawsecsintegBackLogPerTaskCalculatorFunctionEB2B91C7", - "path": "aws-ecs-integ/BacklogPerTaskScheduledRule/AllowEventRuleawsecsintegBackLogPerTaskCalculatorFunctionEB2B91C7", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", - "aws:cdk:cloudformation:props": { - "action": "lambda:InvokeFunction", - "functionName": { - "Fn::GetAtt": [ - "BackLogPerTaskCalculatorFunction95AA21D5", - "Arn" - ] - }, - "principal": "events.amazonaws.com", - "sourceArn": { - "Fn::GetAtt": [ - "BacklogPerTaskScheduledRuleB871DD15", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-lambda.CfnPermission", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-events.Rule", - "version": "0.0.0" - } - }, - "Worker-BackLogPerTaskCalculatorLogs": { - "id": "Worker-BackLogPerTaskCalculatorLogs", - "path": "aws-ecs-integ/Worker-BackLogPerTaskCalculatorLogs", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-ecs-integ/Worker-BackLogPerTaskCalculatorLogs/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", - "aws:cdk:cloudformation:props": { - "logGroupName": { - "Fn::Join": [ - "", - [ - "/aws/lambda/", - { - "Ref": "BackLogPerTaskCalculatorFunction95AA21D5" - } - ] - ] - }, - "retentionInDays": 3 - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.CfnLogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-logs.LogGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Stack", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.App", - "version": "0.0.0" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/queue-handler/Dockerfile b/packages/@aws-cdk-containers/ecs-service-extensions/test/queue-handler/Dockerfile deleted file mode 100644 index 8c87ab2f7179d..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/queue-handler/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM public.ecr.aws/lambda/python:latest - -ADD . /opt/lambda -WORKDIR /opt/lambda - -RUN pip3 install boto3 -RUN python3 test_index.py - -ENTRYPOINT [ "/bin/bash" ] \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/queue-handler/test.sh b/packages/@aws-cdk-containers/ecs-service-extensions/test/queue-handler/test.sh deleted file mode 100755 index 17ff0d950b21d..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/queue-handler/test.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -#--------------------------------------------------------------------------------------------------- -# executes unit tests -# -# prepares a staging directory with the requirements -set -e -script_dir=$(cd $(dirname $0) && pwd) - -# prepare staging directory -staging=$(mktemp -d) -mkdir -p ${staging} -cd ${staging} - -# copy src and overlay with test -cp ${script_dir}/../../lib/extensions/queue/lambda/queue_backlog_calculator.py $PWD -cp ${script_dir}/test_index.py $PWD -cp ${script_dir}/Dockerfile $PWD - -docker build . \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/queue-handler/test_index.py b/packages/@aws-cdk-containers/ecs-service-extensions/test/queue-handler/test_index.py deleted file mode 100644 index 1ff692292eaa1..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/queue-handler/test_index.py +++ /dev/null @@ -1,149 +0,0 @@ -import json -import io -import unittest -import unittest.mock as mock -import time -from botocore.exceptions import ClientError -from queue_backlog_calculator import QueueHandler - -mock_time = time.time() - -class TestQueueAutoscaling(unittest.TestCase): - maxDiff = None - ''' - Test for unexpected error. - ''' - def test_unexpected_error(self): - ecs_client = mock.Mock() - ecs_client.describe_services.side_effect = ClientError({'Error': {'Code': 'UnexpectedError'}}, 'DescribeServices') - - sqs_client = mock.Mock() - environ = { - 'CLUSTER_NAME': 'TEST_CLUSTER', - 'SERVICE_NAME': 'TEST_SERVICE', - 'NAMESPACE': 'TEST', - 'QUEUE_NAMES': 'queue1' - } - - queue_handler = QueueHandler(ecs_client, sqs_client, environ) - queue_handler.emit() - - self.assertRaisesRegex(Exception, r'UnexpectedError') - - ''' - Test for Exception when the service doesn't exist in cluster. - ''' - @mock.patch('sys.stdout', new_callable=io.StringIO) - def test_no_services_in_cluster(self, _): - ecs_client = mock.Mock() - ecs_client.describe_services.return_value = {'services': []} - - sqs_client = mock.Mock() - environ = { - 'CLUSTER_NAME': 'TEST_CLUSTER', - 'SERVICE_NAME': 'TEST_SERVICE', - 'NAMESPACE': 'TEST', - 'QUEUE_NAMES': 'queue1' - } - - queue_handler = QueueHandler(ecs_client, sqs_client, environ) - queue_handler.emit() - - self.assertRaisesRegex(Exception, r'There are no services with name {} in cluster: {}'.format(environ['SERVICE_NAME'], environ['CLUSTER_NAME'])) - - ''' - Test 'backPerTask' value is equal to 'ApproximateNumberOfMessages' in the queue when no tasks are running. - ''' - @mock.patch('time.time', mock.MagicMock(return_value=mock_time)) - @mock.patch('sys.stdout', new_callable=io.StringIO) - def test_backlog_with_no_running_tasks(self, mock_stdout): - ecs_client = mock.Mock() - ecs_client.describe_services.return_value = {'services': [{'runningCount': 0}]} - - sqs_client = mock.Mock() - sqs_client.get_queue_url.return_value = {'QueueUrl': 'queue1_url'} - sqs_client.get_queue_attributes.return_value = {'Attributes': {'ApproximateNumberOfMessages':100}} - environ = { - 'CLUSTER_NAME': 'TEST_CLUSTER', - 'SERVICE_NAME': 'TEST_SERVICE', - 'NAMESPACE': 'TEST', - 'QUEUE_NAMES': 'queue1' - } - - queue_handler = QueueHandler(ecs_client, sqs_client, environ) - queue_handler.emit() - - metric = json.dumps({ - "_aws": { - "Timestamp": int(mock_time*1000), - "CloudWatchMetrics": [{ - "Namespace": "TEST", - "Dimensions": [["QueueName"]], - "Metrics": [{"Name":"BacklogPerTask", "Unit": "Count"}] - }], - }, - "QueueName": "queue1", - "BacklogPerTask": 100, - }) - self.assertEqual(mock_stdout.getvalue(), metric+'\n') - - ''' - Test 'backPerTask' metric is generated correctly for each queue. - ''' - @mock.patch('time.time', mock.MagicMock(return_value=mock_time)) - @mock.patch('sys.stdout', new_callable=io.StringIO) - def test_metric_generation_per_queue(self, mock_stdout): - ecs_client = mock.Mock() - ecs_client.describe_services.return_value = {'services': [{'runningCount': 2}]} - - val1 = { - 'queue1': {'QueueUrl': 'queue1_url'}, - 'queue2': {'QueueUrl': 'queue2_url'} - } - val2 = { - 'queue1_url': {'Attributes': {'ApproximateNumberOfMessages':101}}, - 'queue2_url': {'Attributes': {'ApproximateNumberOfMessages':200}} - } - - sqs_client = mock.Mock() - sqs_client.get_queue_url.side_effect = [val1['queue1'], val1['queue2']] - sqs_client.get_queue_attributes.side_effect = [val2['queue1_url'], val2['queue2_url']] - environ = { - 'CLUSTER_NAME': 'TEST_CLUSTER', - 'SERVICE_NAME': 'TEST_SERVICE', - 'NAMESPACE': 'TEST', - 'QUEUE_NAMES': 'queue1,queue2' - } - - queue_handler = QueueHandler(ecs_client, sqs_client, environ) - queue_handler.emit() - - metric1 = json.dumps({ - "_aws": { - "Timestamp": int(mock_time*1000), - "CloudWatchMetrics": [{ - "Namespace": "TEST", - "Dimensions": [["QueueName"]], - "Metrics": [{"Name":"BacklogPerTask", "Unit": "Count"}] - }], - }, - "QueueName": "queue1", - "BacklogPerTask": 51, - }) - metric2 = json.dumps({ - "_aws": { - "Timestamp": int(mock_time*1000), - "CloudWatchMetrics": [{ - "Namespace": "TEST", - "Dimensions": [["QueueName"]], - "Metrics": [{"Name":"BacklogPerTask", "Unit": "Count"}] - }], - }, - "QueueName": "queue2", - "BacklogPerTask": 100, - }) - - self.assertEqual(mock_stdout.getvalue(), metric1+'\n'+metric2+'\n') - -if __name__ == "__main__": - unittest.main() \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/queue.lambda.test.ts b/packages/@aws-cdk-containers/ecs-service-extensions/test/queue.lambda.test.ts deleted file mode 100644 index c367e0cbb7715..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/queue.lambda.test.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { spawnSync } from 'child_process'; -import * as path from 'path'; - -test('queue handler', () => { - const testScript = path.join(__dirname, 'queue-handler', 'test.sh'); - const result = spawnSync(testScript, { stdio: 'inherit' }); - expect(result.status).toBe(0); -}); diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/queue.test.ts b/packages/@aws-cdk-containers/ecs-service-extensions/test/queue.test.ts deleted file mode 100644 index dfc6bd8a9bcdd..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/queue.test.ts +++ /dev/null @@ -1,835 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as sns from '@aws-cdk/aws-sns'; -import * as sqs from '@aws-cdk/aws-sqs'; -import * as cdk from '@aws-cdk/core'; -import { Container, Environment, QueueExtension, Service, ServiceDescription, TopicSubscription } from '../lib'; - -describe('queue', () => { - test('should only create a default queue when no input props are provided', () => { - // GIVEN - const stack = new cdk.Stack(); - - const environment = new Environment(stack, 'production'); - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - environment: { - PORT: '80', - }, - })); - - // WHEN - serviceDescription.add(new QueueExtension()); - - new Service(stack, 'my-service', { - environment, - serviceDescription, - }); - - // THEN - // Ensure creation of default queue and queue policy allowing SNS Topics to send message to the queue - Template.fromStack(stack).hasResourceProperties('AWS::SQS::Queue', { - MessageRetentionPeriod: 1209600, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::SQS::Queue', { - RedrivePolicy: { - deadLetterTargetArn: { - 'Fn::GetAtt': [ - 'EventsDeadLetterQueue404572C7', - 'Arn', - ], - }, - maxReceiveCount: 3, - }, - }); - - // Ensure the task role is given permissions to consume messages from the queue - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: [ - 'sqs:ReceiveMessage', - 'sqs:ChangeMessageVisibility', - 'sqs:GetQueueUrl', - 'sqs:DeleteMessage', - 'sqs:GetQueueAttributes', - ], - Effect: 'Allow', - Resource: { - 'Fn::GetAtt': [ - 'EventsQueueB96EB0D2', - 'Arn', - ], - }, - }, - ], - Version: '2012-10-17', - }, - }); - - // Ensure there are no SNS Subscriptions created - Template.fromStack(stack).resourceCountIs('AWS::SNS::Subscription', 0); - - // Ensure that the queue URL has been correctly appended to the environment variables - Template.fromStack(stack).hasResourceProperties('AWS::ECS::TaskDefinition', { - ContainerDefinitions: [ - { - Cpu: 256, - Environment: [ - { - Name: 'PORT', - Value: '80', - }, - { - Name: 'MY-SERVICE_QUEUE_URI', - Value: { - Ref: 'EventsQueueB96EB0D2', - }, - }, - ], - Image: 'nathanpeck/name', - Essential: true, - Memory: 512, - Name: 'app', - PortMappings: [ - { - ContainerPort: 80, - Protocol: 'tcp', - }, - ], - Ulimits: [ - { - HardLimit: 1024000, - Name: 'nofile', - SoftLimit: 1024000, - }, - ], - }, - ], - }); - }); - - test('should be able to subscribe default events queue created by the extension to given topics', () => { - // GIVEN - const stack = new cdk.Stack(); - - const environment = new Environment(stack, 'production'); - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - environment: { - PORT: '80', - }, - })); - - // WHEN - const topicSubscription1 = new TopicSubscription({ - topic: new sns.Topic(stack, 'topic1'), - }); - const topicSubscription2 = new TopicSubscription({ - topic: new sns.Topic(stack, 'topic2'), - }); - serviceDescription.add(new QueueExtension({ - subscriptions: [topicSubscription1, topicSubscription2], - })); - - new Service(stack, 'my-service', { - environment, - serviceDescription, - }); - - // THEN - // Ensure creation of default queue and queue policy allowing SNS Topics to send message to the queue - Template.fromStack(stack).hasResourceProperties('AWS::SQS::Queue', { - MessageRetentionPeriod: 1209600, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::SQS::Queue', { - RedrivePolicy: { - deadLetterTargetArn: { - 'Fn::GetAtt': [ - 'EventsDeadLetterQueue404572C7', - 'Arn', - ], - }, - maxReceiveCount: 3, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::SQS::QueuePolicy', { - PolicyDocument: { - Statement: [ - { - Action: 'sqs:SendMessage', - Condition: { - ArnEquals: { - 'aws:SourceArn': { - Ref: 'topic152D84A37', - }, - }, - }, - Effect: 'Allow', - Principal: { - Service: 'sns.amazonaws.com', - }, - Resource: { - 'Fn::GetAtt': [ - 'EventsQueueB96EB0D2', - 'Arn', - ], - }, - }, - { - Action: 'sqs:SendMessage', - Condition: { - ArnEquals: { - 'aws:SourceArn': { - Ref: 'topic2A4FB547F', - }, - }, - }, - Effect: 'Allow', - Principal: { - Service: 'sns.amazonaws.com', - }, - Resource: { - 'Fn::GetAtt': [ - 'EventsQueueB96EB0D2', - 'Arn', - ], - }, - }, - ], - Version: '2012-10-17', - }, - }); - - // Ensure the task role is given permissions to consume messages from the queue - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: [ - 'sqs:ReceiveMessage', - 'sqs:ChangeMessageVisibility', - 'sqs:GetQueueUrl', - 'sqs:DeleteMessage', - 'sqs:GetQueueAttributes', - ], - Effect: 'Allow', - Resource: { - 'Fn::GetAtt': [ - 'EventsQueueB96EB0D2', - 'Arn', - ], - }, - }, - ], - Version: '2012-10-17', - }, - }); - - // Ensure SNS Subscriptions for given topics - Template.fromStack(stack).hasResourceProperties('AWS::SNS::Subscription', { - Protocol: 'sqs', - TopicArn: { - Ref: 'topic152D84A37', - }, - Endpoint: { - 'Fn::GetAtt': [ - 'EventsQueueB96EB0D2', - 'Arn', - ], - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::SNS::Subscription', { - Protocol: 'sqs', - TopicArn: { - Ref: 'topic2A4FB547F', - }, - Endpoint: { - 'Fn::GetAtt': [ - 'EventsQueueB96EB0D2', - 'Arn', - ], - }, - }); - - // Ensure that the queue URL has been correctly appended to the environment variables - Template.fromStack(stack).hasResourceProperties('AWS::ECS::TaskDefinition', { - ContainerDefinitions: [ - { - Cpu: 256, - Environment: [ - { - Name: 'PORT', - Value: '80', - }, - { - Name: 'MY-SERVICE_QUEUE_URI', - Value: { - Ref: 'EventsQueueB96EB0D2', - }, - }, - ], - Image: 'nathanpeck/name', - Essential: true, - Memory: 512, - Name: 'app', - PortMappings: [ - { - ContainerPort: 80, - Protocol: 'tcp', - }, - ], - Ulimits: [ - { - HardLimit: 1024000, - Name: 'nofile', - SoftLimit: 1024000, - }, - ], - }, - ], - }); - }); - - test('should be able to subscribe user-provided queue to given topics', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const environment = new Environment(stack, 'production'); - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - const topicSubscription1 = new TopicSubscription({ - topic: new sns.Topic(stack, 'topic1'), - topicSubscriptionQueue: { - queue: new sqs.Queue(stack, 'myQueue'), - }, - }); - const topicSubscription2 = new TopicSubscription({ - topic: new sns.Topic(stack, 'topic2'), - }); - serviceDescription.add(new QueueExtension({ - subscriptions: [topicSubscription1, topicSubscription2], - eventsQueue: new sqs.Queue(stack, 'defQueue'), - })); - - new Service(stack, 'my-service', { - environment, - serviceDescription, - }); - - // THEN - // Ensure queue policy allows SNS Topics to send message to the queue - Template.fromStack(stack).hasResourceProperties('AWS::SQS::QueuePolicy', { - PolicyDocument: { - Statement: [ - { - Action: 'sqs:SendMessage', - Condition: { - ArnEquals: { - 'aws:SourceArn': { - Ref: 'topic152D84A37', - }, - }, - }, - Effect: 'Allow', - Principal: { - Service: 'sns.amazonaws.com', - }, - Resource: { - 'Fn::GetAtt': [ - 'myQueue4FDFF71C', - 'Arn', - ], - }, - }, - ], - Version: '2012-10-17', - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::SQS::QueuePolicy', { - PolicyDocument: { - Statement: [ - { - Action: 'sqs:SendMessage', - Condition: { - ArnEquals: { - 'aws:SourceArn': { - Ref: 'topic2A4FB547F', - }, - }, - }, - Effect: 'Allow', - Principal: { - Service: 'sns.amazonaws.com', - }, - Resource: { - 'Fn::GetAtt': [ - 'defQueue1F91A65B', - 'Arn', - ], - }, - }, - ], - Version: '2012-10-17', - }, - }); - - // Ensure the task role is given permissions to consume messages from the queue - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: [ - 'sqs:ReceiveMessage', - 'sqs:ChangeMessageVisibility', - 'sqs:GetQueueUrl', - 'sqs:DeleteMessage', - 'sqs:GetQueueAttributes', - ], - Effect: 'Allow', - Resource: { - 'Fn::GetAtt': [ - 'defQueue1F91A65B', - 'Arn', - ], - }, - }, - { - Action: [ - 'sqs:ReceiveMessage', - 'sqs:ChangeMessageVisibility', - 'sqs:GetQueueUrl', - 'sqs:DeleteMessage', - 'sqs:GetQueueAttributes', - ], - Effect: 'Allow', - Resource: { - 'Fn::GetAtt': [ - 'myQueue4FDFF71C', - 'Arn', - ], - }, - }, - ], - Version: '2012-10-17', - }, - }); - - // Ensure SNS Subscriptions for given topics - Template.fromStack(stack).hasResourceProperties('AWS::SNS::Subscription', { - Protocol: 'sqs', - TopicArn: { - Ref: 'topic152D84A37', - }, - Endpoint: { - 'Fn::GetAtt': [ - 'myQueue4FDFF71C', - 'Arn', - ], - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::SNS::Subscription', { - Protocol: 'sqs', - TopicArn: { - Ref: 'topic2A4FB547F', - }, - Endpoint: { - 'Fn::GetAtt': [ - 'defQueue1F91A65B', - 'Arn', - ], - }, - }); - - // Ensure that the queue URL has been correctly added to the environment variables - Template.fromStack(stack).hasResourceProperties('AWS::ECS::TaskDefinition', { - ContainerDefinitions: [ - { - Cpu: 256, - Environment: [ - { - Name: 'MY-SERVICE_QUEUE_URI', - Value: { - Ref: 'defQueue1F91A65B', - }, - }, - ], - Image: 'nathanpeck/name', - Essential: true, - Memory: 512, - Name: 'app', - PortMappings: [ - { - ContainerPort: 80, - Protocol: 'tcp', - }, - ], - Ulimits: [ - { - HardLimit: 1024000, - Name: 'nofile', - SoftLimit: 1024000, - }, - ], - }, - ], - }); - }); - - test('should error when providing both the subscriptionQueue and queue (deprecated) props for a topic subscription', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - // THEN - expect(() => { - new TopicSubscription({ - topic: new sns.Topic(stack, 'topic1'), - queue: new sqs.Queue(stack, 'delete-queue'), - topicSubscriptionQueue: { - queue: new sqs.Queue(stack, 'sign-up-queue'), - }, - }); - }).toThrow('Either provide the `subscriptionQueue` or the `queue` (deprecated) for the topic subscription, but not both.'); - }); - - test('should be able to add target tracking scaling policy for the Events Queue with no subscriptions', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const environment = new Environment(stack, 'production'); - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - serviceDescription.add(new QueueExtension({ - scaleOnLatency: { - acceptableLatency: cdk.Duration.minutes(5), - messageProcessingTime: cdk.Duration.seconds(20), - }, - })); - - new Service(stack, 'my-service', { - environment, - serviceDescription, - autoScaleTaskCount: { - maxTaskCount: 10, - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalableTarget', { - MaxCapacity: 10, - MinCapacity: 1, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalingPolicy', { - PolicyType: 'TargetTrackingScaling', - TargetTrackingScalingPolicyConfiguration: { - CustomizedMetricSpecification: { - Dimensions: [ - { - Name: 'QueueName', - Value: { - 'Fn::GetAtt': [ - 'EventsQueueB96EB0D2', - 'QueueName', - ], - }, - }, - ], - MetricName: 'BacklogPerTask', - Namespace: 'production-my-service', - Statistic: 'Average', - Unit: 'Count', - }, - TargetValue: 15, - }, - }); - }); - - test('should be able to add target tracking scaling policy for the SQS Queues', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const environment = new Environment(stack, 'production'); - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - const topicSubscription1 = new TopicSubscription({ - topic: new sns.Topic(stack, 'topic1'), - topicSubscriptionQueue: { - queue: new sqs.Queue(stack, 'myQueue'), - scaleOnLatency: { - acceptableLatency: cdk.Duration.minutes(10), - messageProcessingTime: cdk.Duration.seconds(20), - }, - }, - }); - const topicSubscription2 = new TopicSubscription({ - topic: new sns.Topic(stack, 'topic2'), - queue: new sqs.Queue(stack, 'tempQueue'), - }); - serviceDescription.add(new QueueExtension({ - subscriptions: [topicSubscription1, topicSubscription2], - eventsQueue: new sqs.Queue(stack, 'defQueue'), - scaleOnLatency: { - acceptableLatency: cdk.Duration.minutes(5), - messageProcessingTime: cdk.Duration.seconds(20), - }, - })); - - new Service(stack, 'my-service', { - environment, - serviceDescription, - autoScaleTaskCount: { - maxTaskCount: 10, - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalableTarget', { - MaxCapacity: 10, - MinCapacity: 1, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalingPolicy', { - PolicyType: 'TargetTrackingScaling', - TargetTrackingScalingPolicyConfiguration: { - CustomizedMetricSpecification: { - Dimensions: [ - { - Name: 'QueueName', - Value: { - 'Fn::GetAtt': [ - 'defQueue1F91A65B', - 'QueueName', - ], - }, - }, - ], - MetricName: 'BacklogPerTask', - Namespace: 'production-my-service', - Statistic: 'Average', - Unit: 'Count', - }, - TargetValue: 15, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalingPolicy', { - PolicyType: 'TargetTrackingScaling', - TargetTrackingScalingPolicyConfiguration: { - CustomizedMetricSpecification: { - Dimensions: [ - { - Name: 'QueueName', - Value: { - 'Fn::GetAtt': [ - 'myQueue4FDFF71C', - 'QueueName', - ], - }, - }, - ], - MetricName: 'BacklogPerTask', - Namespace: 'production-my-service', - Statistic: 'Average', - Unit: 'Count', - }, - TargetValue: 30, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalingPolicy', { - PolicyType: 'TargetTrackingScaling', - TargetTrackingScalingPolicyConfiguration: { - CustomizedMetricSpecification: { - Dimensions: [ - { - Name: 'QueueName', - Value: { - 'Fn::GetAtt': [ - 'tempQueueEF946882', - 'QueueName', - ], - }, - }, - ], - MetricName: 'BacklogPerTask', - Namespace: 'production-my-service', - Statistic: 'Average', - Unit: 'Count', - }, - TargetValue: 15, - }, - }); - }); - - test('should error when adding scaling policy if scaling target has not been configured', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const environment = new Environment(stack, 'production'); - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - const topicSubscription1 = new TopicSubscription({ - topic: new sns.Topic(stack, 'topic1'), - }); - - serviceDescription.add(new QueueExtension({ - subscriptions: [topicSubscription1], - scaleOnLatency: { - acceptableLatency: cdk.Duration.minutes(10), - messageProcessingTime: cdk.Duration.seconds(20), - }, - })); - - // THEN - expect(() => { - new Service(stack, 'my-service', { - environment, - serviceDescription, - }); - }).toThrow(/Auto scaling target for the service 'my-service' hasn't been configured. Please use Service construct to configure 'minTaskCount' and 'maxTaskCount'./); - }); - - test('should error when message processing time for the queue is greater than acceptable latency', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const environment = new Environment(stack, 'production'); - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - const topicSubscription1 = new TopicSubscription({ - topic: new sns.Topic(stack, 'topic1'), - topicSubscriptionQueue: { - queue: new sqs.Queue(stack, 'sign-up-queue'), - }, - }); - - serviceDescription.add(new QueueExtension({ - subscriptions: [topicSubscription1], - scaleOnLatency: { - acceptableLatency: cdk.Duration.seconds(10), - messageProcessingTime: cdk.Duration.seconds(20), - }, - })); - - // THEN - expect(() => { - new Service(stack, 'my-service', { - environment, - serviceDescription, - autoScaleTaskCount: { - maxTaskCount: 10, - }, - }); - }).toThrow('Message processing time (20s) for the queue cannot be greater acceptable queue latency (10s).'); - }); - - test('should error when configuring auto scaling only for topic-specific queue', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const environment = new Environment(stack, 'production'); - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - const topicSubscription1 = new TopicSubscription({ - topic: new sns.Topic(stack, 'topic1'), - topicSubscriptionQueue: { - queue: new sqs.Queue(stack, 'sign-up-queue'), - scaleOnLatency: { - acceptableLatency: cdk.Duration.minutes(10), - messageProcessingTime: cdk.Duration.seconds(20), - }, - }, - }); - - serviceDescription.add(new QueueExtension({ - subscriptions: [topicSubscription1], - })); - - // THEN - expect(() => { - new Service(stack, 'my-service', { - environment, - serviceDescription, - autoScaleTaskCount: { - maxTaskCount: 10, - }, - }); - }).toThrow(/Autoscaling for a topic-specific queue cannot be configured as autoscaling based on SQS Queues hasn’t been set up for the service 'my-service'. If you want to enable autoscaling for this service, please also specify 'scaleOnLatency' in the 'QueueExtension'/); - }); -}); \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/scale-on-cpu-utilization.test.ts b/packages/@aws-cdk-containers/ecs-service-extensions/test/scale-on-cpu-utilization.test.ts deleted file mode 100644 index bfcf67e394609..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/scale-on-cpu-utilization.test.ts +++ /dev/null @@ -1,175 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as cdk from '@aws-cdk/core'; -import { Container, Environment, ScaleOnCpuUtilization, Service, ServiceDescription } from '../lib'; - -describe('scale on cpu utilization', () => { - test('scale on cpu utilization extension with no parameters should create a default autoscaling setup', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const environment = new Environment(stack, 'production'); - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - serviceDescription.add(new ScaleOnCpuUtilization()); - - new Service(stack, 'my-service', { - environment, - serviceDescription, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ECS::Service', { - DeploymentConfiguration: { - MaximumPercent: 200, - MinimumHealthyPercent: 100, - }, - DesiredCount: 2, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalableTarget', { - MaxCapacity: 8, - MinCapacity: 2, - ResourceId: { - 'Fn::Join': [ - '', - [ - 'service/', - { - Ref: 'productionenvironmentclusterC6599D2D', - }, - '/', - { - 'Fn::GetAtt': [ - 'myserviceserviceServiceE9A5732D', - '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', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalingPolicy', { - PolicyName: 'myserviceserviceTaskCountTargetmyservicetargetcpuutilization50E6628660', - PolicyType: 'TargetTrackingScaling', - ScalingTargetId: { - Ref: 'myserviceserviceTaskCountTarget4268918D', - }, - TargetTrackingScalingPolicyConfiguration: { - PredefinedMetricSpecification: { - PredefinedMetricType: 'ECSServiceAverageCPUUtilization', - }, - ScaleInCooldown: 60, - ScaleOutCooldown: 60, - TargetValue: 50, - }, - }); - }); - - test('should be able to set a custom scaling policy as well', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const environment = new Environment(stack, 'production'); - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - serviceDescription.add(new ScaleOnCpuUtilization({ - initialTaskCount: 25, - minTaskCount: 15, - maxTaskCount: 30, - targetCpuUtilization: 75, - scaleInCooldown: cdk.Duration.minutes(3), - scaleOutCooldown: cdk.Duration.minutes(3), - })); - - new Service(stack, 'my-service', { - environment, - serviceDescription, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ECS::Service', { - DeploymentConfiguration: { - MaximumPercent: 200, - MinimumHealthyPercent: 100, - }, - DesiredCount: 25, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalableTarget', { - MaxCapacity: 30, - MinCapacity: 15, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalingPolicy', { - TargetTrackingScalingPolicyConfiguration: { - ScaleInCooldown: 180, - ScaleOutCooldown: 180, - TargetValue: 75, - }, - }); - }); - - test('should error if configuring autoscaling target both in the extension and the Service', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const environment = new Environment(stack, 'production'); - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - serviceDescription.add(new ScaleOnCpuUtilization()); - // THEN - expect(() => { - new Service(stack, 'my-service', { - environment, - serviceDescription, - autoScaleTaskCount: { - maxTaskCount: 5, - }, - }); - }).toThrow('Cannot specify \'autoScaleTaskCount\' in the Service construct and also provide a \'ScaleOnCpuUtilization\' extension. \'ScaleOnCpuUtilization\' is deprecated. Please only provide \'autoScaleTaskCount\'.'); - }); -}); \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/service.test.ts b/packages/@aws-cdk-containers/ecs-service-extensions/test/service.test.ts deleted file mode 100644 index 9879282f7e254..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/service.test.ts +++ /dev/null @@ -1,136 +0,0 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as cdk from '@aws-cdk/core'; -import { Container, Environment, Service, ServiceDescription } from '../lib'; - -describe('service', () => { - test('should error if a service is prepared with no addons', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const environment = new Environment(stack, 'production'); - const serviceDescription = new ServiceDescription(); - - // THEN - expect(() => { - new Service(stack, 'my-service', { - environment, - serviceDescription, - }); - }).toThrow(/Service 'my-service' must have a Container extension/); - }); - - test('allows scaling on a target CPU utilization', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const environment = new Environment(stack, 'production'); - const serviceDescription = new ServiceDescription(); - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - new Service(stack, 'my-service', { - environment, - serviceDescription, - desiredCount: 3, - autoScaleTaskCount: { - maxTaskCount: 5, - targetCpuUtilization: 70, - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ECS::Service', { - DesiredCount: Match.absent(), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalableTarget', { - MaxCapacity: 5, - MinCapacity: 1, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalingPolicy', { - PolicyType: 'TargetTrackingScaling', - TargetTrackingScalingPolicyConfiguration: { - PredefinedMetricSpecification: { PredefinedMetricType: 'ECSServiceAverageCPUUtilization' }, - TargetValue: 70, - }, - }); - }); - - test('allows scaling on a target memory utilization', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const environment = new Environment(stack, 'production'); - const serviceDescription = new ServiceDescription(); - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - new Service(stack, 'my-service', { - environment, - serviceDescription, - desiredCount: 3, - autoScaleTaskCount: { - maxTaskCount: 5, - targetMemoryUtilization: 70, - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ECS::Service', { - DesiredCount: Match.absent(), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalableTarget', { - MaxCapacity: 5, - MinCapacity: 1, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalingPolicy', { - PolicyType: 'TargetTrackingScaling', - TargetTrackingScalingPolicyConfiguration: { - PredefinedMetricSpecification: { PredefinedMetricType: 'ECSServiceAverageMemoryUtilization' }, - TargetValue: 70, - }, - }); - }); - - test('should error when no auto scaling policies have been configured after creating the auto scaling target', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const environment = new Environment(stack, 'production'); - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - // THEN - expect(() => { - new Service(stack, 'my-service', { - environment, - serviceDescription, - autoScaleTaskCount: { - maxTaskCount: 5, - }, - }); - }).toThrow(/The auto scaling target for the service 'my-service' has been created but no auto scaling policies have been configured./); - }); -}); \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/test/xray.test.ts b/packages/@aws-cdk-containers/ecs-service-extensions/test/xray.test.ts deleted file mode 100644 index f8f096369d50b..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/test/xray.test.ts +++ /dev/null @@ -1,118 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as cdk from '@aws-cdk/core'; -import { Container, Environment, XRayExtension, Service, ServiceDescription } from '../lib'; - -describe('xray', () => { - test('should be able to add AWS X-Ray to a service', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const environment = new Environment(stack, 'production'); - const serviceDescription = new ServiceDescription(); - - serviceDescription.add(new Container({ - cpu: 256, - memoryMiB: 512, - trafficPort: 80, - image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), - })); - - serviceDescription.add(new XRayExtension()); - - new Service(stack, 'my-service', { - environment, - serviceDescription, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ECS::TaskDefinition', { - ContainerDefinitions: [ - { - Cpu: 256, - DependsOn: [ - { - Condition: 'HEALTHY', - ContainerName: 'xray', - }, - ], - Essential: true, - Image: 'nathanpeck/name', - Memory: 512, - Name: 'app', - PortMappings: [ - { - ContainerPort: 80, - Protocol: 'tcp', - }, - ], - Ulimits: [ - { - HardLimit: 1024000, - Name: 'nofile', - SoftLimit: 1024000, - }, - ], - }, - { - Environment: [ - { - Name: 'AWS_REGION', - Value: { - Ref: 'AWS::Region', - }, - }, - ], - Essential: true, - HealthCheck: { - Command: [ - 'CMD-SHELL', - 'curl -s http://localhost:2000', - ], - Interval: 5, - Retries: 3, - StartPeriod: 10, - Timeout: 2, - }, - Image: 'amazon/aws-xray-daemon:latest', - LogConfiguration: { - LogDriver: 'awslogs', - Options: { - 'awslogs-group': { - Ref: 'myservicetaskdefinitionxrayLogGroupC0252525', - }, - 'awslogs-stream-prefix': 'xray', - 'awslogs-region': { - Ref: 'AWS::Region', - }, - }, - }, - MemoryReservation: 256, - Name: 'xray', - User: '1337', - }, - ], - Cpu: '256', - ExecutionRoleArn: { - 'Fn::GetAtt': [ - 'myservicetaskdefinitionExecutionRole0CE74AD0', - 'Arn', - ], - }, - Family: 'myservicetaskdefinition', - Memory: '512', - NetworkMode: 'awsvpc', - RequiresCompatibilities: [ - 'EC2', - 'FARGATE', - ], - TaskRoleArn: { - 'Fn::GetAtt': [ - 'myservicetaskdefinitionTaskRole92ACD903', - 'Arn', - ], - }, - }); - }); -}); \ No newline at end of file diff --git a/packages/@aws-cdk-containers/ecs-service-extensions/tsconfig.json b/packages/@aws-cdk-containers/ecs-service-extensions/tsconfig.json deleted file mode 100644 index 124a3ce0d3346..0000000000000 --- a/packages/@aws-cdk-containers/ecs-service-extensions/tsconfig.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "compilerOptions": { - "alwaysStrict": true, - "charset": "utf8", - "declaration": true, - "experimentalDecorators": true, - "inlineSourceMap": true, - "inlineSources": true, - "lib": [ - "es2018" - ], - "module": "CommonJS", - "noEmitOnError": true, - "noFallthroughCasesInSwitch": true, - "noImplicitAny": true, - "noImplicitReturns": true, - "noImplicitThis": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "resolveJsonModule": true, - "strict": true, - "strictNullChecks": true, - "strictPropertyInitialization": true, - "stripInternal": true, - "target": "ES2018", - "composite": true, - "incremental": true, - "tsBuildInfoFile": "./tsconfig.tsbuildinfo" - }, - "include": [ - "**/*.ts" - ], - "exclude": [ - "node_modules" - ], - "references": [ - { - "path": "../../@aws-cdk/aws-applicationautoscaling" - }, - { - "path": "../../@aws-cdk/aws-appmesh" - }, - { - "path": "../../@aws-cdk/aws-certificatemanager" - }, - { - "path": "../../@aws-cdk/aws-dynamodb" - }, - { - "path": "../../@aws-cdk/aws-ec2" - }, - { - "path": "../../@aws-cdk/aws-ecr" - }, - { - "path": "../../@aws-cdk/aws-ecs" - }, - { - "path": "../../@aws-cdk/aws-elasticloadbalancingv2" - }, - { - "path": "../../@aws-cdk/aws-events" - }, - { - "path": "../../@aws-cdk/aws-events-targets" - }, - { - "path": "../../@aws-cdk/aws-iam" - }, - { - "path": "../../@aws-cdk/aws-logs" - }, - { - "path": "../../@aws-cdk/aws-route53" - }, - { - "path": "../../@aws-cdk/aws-route53-targets" - }, - { - "path": "../../@aws-cdk/aws-servicediscovery" - }, - { - "path": "../../@aws-cdk/aws-sqs" - }, - { - "path": "../../@aws-cdk/core" - }, - { - "path": "../../@aws-cdk/region-info" - }, - { - "path": "../../@aws-cdk/assert" - }, - { - "path": "../../../tools/@aws-cdk/cdk-build-tools" - }, - { - "path": "../../../tools/@aws-cdk/cdk-integ-tools" - }, - { - "path": "../../../tools/@aws-cdk/cfn2ts" - }, - { - "path": "../../../tools/@aws-cdk/pkglint" - } - ], - "_generated_by_jsii_": "Generated by jsii - safe to delete, and ideally should be in .gitignore" -}