Class Ec2Config


public class Ec2Config extends AbstractServiceConfig<Ec2Config.Builder>
Configuration for EC2-specific container settings.

Instances are created via Ec2Config.Builder:


 Ec2Config config = Ec2Config.builder()
     .appPortRange(30000, 10)
     .build();
 
  • Method Details

    • builder

      public static Ec2Config.Builder builder()
      Returns a new Ec2Config.Builder for this configuration.
      Returns:
      a new builder
    • toBuilder

      public Ec2Config.Builder toBuilder()
      Returns a new Ec2Config.Builder for this configuration, initialized with the current values of this instance.
      Specified by:
      toBuilder in class AbstractServiceConfig<Ec2Config.Builder>
      Returns:
      a new builder pre-populated with this configuration's values
    • isMock

      public boolean isMock()
      Returns whether EC2 instances go straight to RUNNING without launching Docker containers.
      Returns:
      true if mock mode is enabled
    • getImdsPort

      public int getImdsPort()
      Returns the port on the Floci host for the IMDS HTTP server (169.254.169.254 equivalent).
      Returns:
      the IMDS port
    • getSshPortRangeStart

      public int getSshPortRangeStart()
      Returns the lowest host port in the range published for EC2 instance SSH (port 22).
      Returns:
      the SSH port range start
    • getSshPortRangeEnd

      public int getSshPortRangeEnd()
      Returns the highest host port in the range published for EC2 instance SSH (port 22).
      Returns:
      the SSH port range end
    • isPublishSecurityGroupPorts

      public boolean isPublishSecurityGroupPorts()
      Returns whether TCP ports opened by an instance's security-group ingress rules are published on the host via a socat sidecar container, both at launch and on later authorize-security-group-ingress. When false, security groups are metadata only.
      Returns:
      true if published security-group ports are enabled
    • getAppPortRangeStart

      public int getAppPortRangeStart()
      Returns the lowest host port in the range allocated for published security-group app ports.
      Returns:
      the app port range start
    • getAppPortsCount

      public int getAppPortsCount()
      Returns the number of ports allocated for published security-group app ports, starting from getAppPortRangeStart().
      Returns:
      the number of app ports
    • getAppPortRangeEnd

      public int getAppPortRangeEnd()
      Returns the highest host port in the range allocated for published security-group app ports.
      Returns:
      the app port range end
    • getMaxPublishedPortsPerInstance

      public int getMaxPublishedPortsPerInstance()
      Returns the upper bound on app ports published per instance. Also bounds any single ingress rule's port span: wider ranges (e.g. an allow-all 0-65535 rule) are skipped so a single rule cannot spawn thousands of socat sidecars or exhaust the host-port range.
      Returns:
      the maximum published ports per instance
    • getSocatImage

      public String getSocatImage()
      Returns the image used for the socat sidecar that forwards published security-group ports.
      Returns:
      the socat image name
    • getAutoScaling

      public Ec2Config.AutoScaling getAutoScaling()
      Returns the Auto Scaling configuration.
      Returns:
      the Auto Scaling configuration
    • applyEnvVarsToContainer

      public void applyEnvVarsToContainer(org.testcontainers.containers.Container<?> container)
      Description copied from class: AbstractServiceConfig
      Applies this service configuration to the given container by setting the appropriate environment variables.
      Overrides:
      applyEnvVarsToContainer in class AbstractServiceConfig<Ec2Config.Builder>
      Parameters:
      container - the container to configure
    • applyExposedPortsToContainer

      public void applyExposedPortsToContainer(org.testcontainers.containers.Container<?> container)
      Description copied from class: AbstractServiceConfig
      Applies this service configuration to the given container by exposing the appropriate ports.
      Overrides:
      applyExposedPortsToContainer in class AbstractServiceConfig<Ec2Config.Builder>
      Parameters:
      container - the container to configure