Skip to content

Commit c3dbefe

Browse files
author
Eldyn Castillo
committed
..
1 parent 71dcf0f commit c3dbefe

File tree

3 files changed

+3
-11
lines changed

3 files changed

+3
-11
lines changed

python/appmesh-ecs/README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ To add additional dependencies, for example other CDK libraries, just add
4747
them to your `setup.py` file and rerun the `pip install -r requirements.txt`
4848
command.
4949

50-
## Deploying this sample
51-
To deploy this sample, navigate to app.py and uncomment lines 19-20, then run `cdk deploy --all`
52-
5350
## Useful commands
5451

5552
* `cdk ls` list all stacks in the app
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
aws-cdk-lib==2.147.1
22
constructs>=10.0.0,<11.0.0
3-
cdk-ecr-deployment

python/appmesh-ecs/task_definitions/color_app_task_definition_stack.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,9 @@ def create_color_task_definition(self, color, environment_name):
130130
)
131131
return task_definition
132132
# This function creates the ECS service for each corresponding color
133-
def create_color_service(self, color, namespace, taskdef, ):
133+
def create_color_service(self, color, namespace, taskdef, imported_vpc ):
134134
environment_name ="appmesh-env"
135-
vpc_id = core.Fn.import_value(f"{environment_name}:VPCID")
136-
137-
availability_zones = core.Fn.split(',', f"{environment_name}:VpcAvailabilityZones")
138-
private_subnet_ids = core.Fn.split(',', core.Fn.import_value(f"{environment_name}:MyPrivateSubnetIds"))
139-
imported_vpc = ec2.Vpc.from_vpc_attributes(self, f"ImportedVPC-{color}", vpc_id=vpc_id, availability_zones=availability_zones, private_subnet_ids=private_subnet_ids)
135+
140136
cluster = ecs.Cluster.from_cluster_attributes(self, f"Cluster-{color}",
141137
cluster_name=core.Fn.import_value(f"{environment_name}:ECSCluster"),
142138
vpc=imported_vpc,
@@ -249,7 +245,7 @@ def __init__(self, scope: Construct, id: str, **kwargs, ) -> None:
249245
# Loop through all the colors to create their task definitions and ECS services
250246
for color in color_teller_colors:
251247
task_definition = self.create_color_task_definition(color, environment_name)
252-
service = self.create_color_service(color, namespace, taskdef=task_definition)
248+
service = self.create_color_service(color, namespace, taskdef=task_definition, imported_vpc=imported_vpc)
253249

254250
core.CfnOutput(
255251
self, f"ColorTellerTaskDefinitionArn-{color}",

0 commit comments

Comments
 (0)