Class Ec2Config
java.lang.Object
io.floci.testcontainers.config.services.AbstractServiceConfig<Ec2Config.Builder>
io.floci.testcontainers.config.services.Ec2Config
Configuration for EC2-specific container settings.
Instances are created via Ec2Config.Builder:
Ec2Config config = Ec2Config.builder()
.appPortRange(30000, 10)
.build();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceConfiguration for EC2 Auto Scaling.static classBuilder forEc2Config. -
Field Summary
Fields inherited from class io.floci.testcontainers.config.services.AbstractServiceConfig
DEFAULT_ENABLED -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyEnvVarsToContainer(org.testcontainers.containers.Container<?> container) Applies this service configuration to the given container by setting the appropriate environment variables.voidapplyExposedPortsToContainer(org.testcontainers.containers.Container<?> container) Applies this service configuration to the given container by exposing the appropriate ports.static Ec2Config.Builderbuilder()Returns a newEc2Config.Builderfor this configuration.intReturns the highest host port in the range allocated for published security-group app ports.intReturns the lowest host port in the range allocated for published security-group app ports.intReturns the number of ports allocated for published security-group app ports, starting fromgetAppPortRangeStart().Returns the Auto Scaling configuration.intReturns the port on the Floci host for the IMDS HTTP server (169.254.169.254 equivalent).intReturns the upper bound on app ports published per instance.Returns the image used for the socat sidecar that forwards published security-group ports.intReturns the highest host port in the range published for EC2 instance SSH (port 22).intReturns the lowest host port in the range published for EC2 instance SSH (port 22).booleanisMock()Returns whether EC2 instances go straight to RUNNING without launching Docker containers.booleanReturns 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.Returns a newEc2Config.Builderfor this configuration, initialized with the current values of this instance.Methods inherited from class io.floci.testcontainers.config.services.AbstractServiceConfig
isEnabled
-
Method Details
-
builder
Returns a newEc2Config.Builderfor this configuration.- Returns:
- a new builder
-
toBuilder
Returns a newEc2Config.Builderfor this configuration, initialized with the current values of this instance.- Specified by:
toBuilderin classAbstractServiceConfig<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:
trueif 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. Whenfalse, security groups are metadata only.- Returns:
trueif 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 fromgetAppPortRangeStart().- 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
Returns the image used for the socat sidecar that forwards published security-group ports.- Returns:
- the socat image name
-
getAutoScaling
Returns the Auto Scaling configuration.- Returns:
- the Auto Scaling configuration
-
applyEnvVarsToContainer
public void applyEnvVarsToContainer(org.testcontainers.containers.Container<?> container) Description copied from class:AbstractServiceConfigApplies this service configuration to the given container by setting the appropriate environment variables.- Overrides:
applyEnvVarsToContainerin classAbstractServiceConfig<Ec2Config.Builder>- Parameters:
container- the container to configure
-
applyExposedPortsToContainer
public void applyExposedPortsToContainer(org.testcontainers.containers.Container<?> container) Description copied from class:AbstractServiceConfigApplies this service configuration to the given container by exposing the appropriate ports.- Overrides:
applyExposedPortsToContainerin classAbstractServiceConfig<Ec2Config.Builder>- Parameters:
container- the container to configure
-