Skip to content

Commit

Permalink
docs: add comment above both examples
Browse files Browse the repository at this point in the history
  • Loading branch information
misterjoshua committed Feb 25, 2021
1 parent fd39858 commit 0940dc4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/@aws-cdk/aws-ecs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()`:
Expand Down

0 comments on commit 0940dc4

Please sign in to comment.