Enum NetworkMode
The networking mode to use for the containers in the task.
Namespace: Amazon.CDK.AWS.ECS
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public enum NetworkMode
Syntax (vb)
Public Enum NetworkMode
Remarks
ExampleMetadata: infused
Examples
var ec2TaskDefinition = new Ec2TaskDefinition(this, "TaskDef", new Ec2TaskDefinitionProps {
NetworkMode = NetworkMode.BRIDGE
});
var container = ec2TaskDefinition.AddContainer("WebContainer", new ContainerDefinitionOptions {
// Use an image from DockerHub
Image = ContainerImage.FromRegistry("amazon/amazon-ecs-sample"),
MemoryLimitMiB = 1024
});
Synopsis
Fields
AWS_VPC | The task is allocated an elastic network interface. |
BRIDGE | The task utilizes Docker's built-in virtual network which runs inside each container instance. |
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. |
Fields
Name | Description |
---|---|
AWS_VPC | The task is allocated an elastic network interface. |
BRIDGE | The task utilizes Docker's built-in virtual network which runs inside each container instance. |
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. |