@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:38.738Z") @Stability(value=Stable) public enum NetworkMode extends Enum<NetworkMode>
Example:
Ec2TaskDefinition ec2TaskDefinition = Ec2TaskDefinition.Builder.create(this, "TaskDef")
.networkMode(NetworkMode.BRIDGE)
.build();
ContainerDefinition container = ec2TaskDefinition.addContainer("WebContainer", ContainerDefinitionOptions.builder()
// Use an image from DockerHub
.image(ContainerImage.fromRegistry("amazon/amazon-ecs-sample"))
.memoryLimitMiB(1024)
.build());
| Enum Constant and 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 NAT network mode required by Windows containers.
|
NONE
The task's containers do not have external connectivity and port mappings can't be specified in the container definition.
|
| Modifier and Type | Method and Description |
|---|---|
static NetworkMode |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static NetworkMode[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
@Stability(value=Stable) public static final NetworkMode NONE
@Stability(value=Stable) public static final NetworkMode BRIDGE
@Stability(value=Stable) public static final NetworkMode AWS_VPC
@Stability(value=Stable) public static final NetworkMode HOST
In this mode, you can't run multiple instantiations of the same task on a single container instance when port mappings are used.
@Stability(value=Stable) public static final NetworkMode NAT
This is the only supported network mode for Windows containers. For more information, see Task Definition Parameters.
public static NetworkMode[] values()
for (NetworkMode c : NetworkMode.values()) System.out.println(c);
public static NetworkMode valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullCopyright © 2022. All rights reserved.