enum NetworkMode
| Language | Type name | 
|---|---|
|  .NET | Amazon.CDK.AWS.ECS.NetworkMode | 
|  Go | github.com/aws/aws-cdk-go/awscdk/v2/awsecs#NetworkMode | 
|  Java | software.amazon.awscdk.services.ecs.NetworkMode | 
|  Python | aws_cdk.aws_ecs.NetworkMode | 
|  TypeScript (source) | aws-cdk-lib»aws_ecs»NetworkMode | 
The networking mode to use for the containers in the task.
Example
const ec2TaskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef', {
  networkMode: ecs.NetworkMode.BRIDGE,
});
const container = ec2TaskDefinition.addContainer("WebContainer", {
  // Use an image from DockerHub
  image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"),
  memoryLimitMiB: 1024,
  // ... other options here ...
});
Members
| Name | Description | 
|---|---|
| NONE | The task's containers do not have external connectivity and port mappings can't be specified in the container definition. | 
| BRIDGE | The task utilizes Docker's built-in virtual network which runs inside each container instance. | 
| AWS_VPC | The task is allocated an elastic network interface. | 
| HOST | The task bypasses Docker's built-in virtual network and maps container ports directly to the EC2 instance's network interface directly. | 
| NAT | The task utilizes Docker's built-in virtual network which runs inside each Windows container instance. | 
NONE
The task's containers do not have external connectivity and port mappings can't be specified in the container definition.
BRIDGE
The task utilizes Docker's built-in virtual network which runs inside each container instance.
AWS_VPC
The task is allocated an elastic network interface.
HOST
The task bypasses Docker's built-in virtual network and maps container ports directly to the EC2 instance's network interface directly.
In this mode, you can't run multiple instantiations of the same task on a single container instance when port mappings are used.
NAT
The task utilizes Docker's built-in virtual network which runs inside each Windows container instance.
