From 0940dc481879cfe6ba3ca47b42db5b292d97ad25 Mon Sep 17 00:00:00 2001 From: Josh Kellendonk Date: Thu, 25 Feb 2021 10:26:47 -0700 Subject: [PATCH] docs: add comment above both examples --- packages/@aws-cdk/aws-ecs/README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/@aws-cdk/aws-ecs/README.md b/packages/@aws-cdk/aws-ecs/README.md index e3e88e967e966..91ba382cee4b6 100644 --- a/packages/@aws-cdk/aws-ecs/README.md +++ b/packages/@aws-cdk/aws-ecs/README.md @@ -237,18 +237,22 @@ const container = ec2TaskDefinition.addContainer("WebContainer", { You can specify container properties when you add them to the task definition, or with various methods, e.g.: +To add add port mappings when adding to the task definition, specify the `portMappings` option: + ```ts taskDefinition.addContainer("WebContainer", { image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), memoryLimitMiB: 1024, portMappings: [{ containerPort: 3000 }] -}) +}); ``` +To add port mappings directly to a container definition, call `addPortMappings()`: + ```ts container.addPortMappings({ containerPort: 3000 -}) +}); ``` To add data volumes to a task definition, call `addVolume()`: