Enum NetworkMode

java.lang.Object
java.lang.Enum<NetworkMode>
software.amazon.awscdk.services.ecs.NetworkMode
All Implemented Interfaces:
Serializable, Comparable<NetworkMode>, java.lang.constant.Constable

@Generated(value="jsii-pacmak/1.97.0 (build 729de35)", date="2024-04-24T21:00:29.336Z") @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 Constants
    Enum Constant
    Description
    The 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 Type
    Method
    Description
    Returns the enum constant of this type with the specified name.
    static NetworkMode[]
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • NONE

      @Stability(Stable) public static final NetworkMode NONE
      The task's containers do not have external connectivity and port mappings can't be specified in the container definition.
    • BRIDGE

      @Stability(Stable) public static final NetworkMode BRIDGE
      The task utilizes Docker's built-in virtual network which runs inside each container instance.
    • AWS_VPC

      @Stability(Stable) public static final NetworkMode AWS_VPC
      The task is allocated an elastic network interface.
    • HOST

      @Stability(Stable) public static final NetworkMode 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

      @Stability(Stable) public static final NetworkMode 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

      public static NetworkMode[] 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

      public static NetworkMode valueOf(String name)
      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 name
      NullPointerException - if the argument is null