Enum NetworkMode
- All Implemented Interfaces:
Serializable
,Comparable<NetworkMode>
,java.lang.constant.Constable
@Generated(value="jsii-pacmak/1.104.0 (build e79254c)",
date="2024-12-17T21:37:30.563Z")
@Stability(Stable)
public enum NetworkMode
extends Enum<NetworkMode>
The networking mode to use for the containers in the task.
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());
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionThe task is allocated an elastic network interface.The task utilizes Docker's built-in virtual network which runs inside each container instance.The task bypasses Docker's built-in virtual network and maps container ports directly to the EC2 instance's network interface directly.The task utilizes NAT network mode required by Windows containers.The task's containers do not have external connectivity and port mappings can't be specified in the container definition. -
Method Summary
Modifier and TypeMethodDescriptionstatic NetworkMode
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.
-
Enum Constant Details
-
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 NAT network mode required by Windows containers.This is the only supported network mode for Windows containers. For more information, see Task Definition Parameters.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-