Interface Ec2Context

All Known Implementing Classes:
Ec2ContextImpl

public interface Ec2Context
Runtime context information for EC2 UserData configuration.

This interface provides applications with the runtime information they need to make decisions during UserData script generation, such as:

  • Whether to use EFS or EBS for storage
  • Stack name for resource naming and logging
  • Runtime environment (EC2 vs Fargate)
  • Security profile for compliance requirements

Applications use this context to adapt their configuration based on the deployment environment.

See Also:
  • Method Details

    • stackName

      String stackName()
      Returns the CloudFormation stack name. Used for resource naming and CloudWatch log group names.
      Returns:
      stack name (e.g., "jenkins-prod")
    • runtimeType

      String runtimeType()
      Returns the runtime type as a string. Typically "EC2" or "FARGATE".
      Returns:
      runtime type in lowercase (e.g., "ec2")
    • securityProfile

      String securityProfile()
      Returns the security profile as a string. Used for compliance-aware logging and configuration.
      Returns:
      security profile in lowercase (e.g., "dev", "staging", "production")
    • hasEfs

      boolean hasEfs()
      Returns whether EFS is available in this deployment. If true, applications should use EFS for storage. If false, applications should use EBS for storage.
      Returns:
      true if EFS is configured and available
    • efsId

      Optional<String> efsId()
      Returns the EFS filesystem ID if EFS is available.
      Returns:
      EFS filesystem ID (e.g., "fs-12345678"), or empty if EFS is not available
    • accessPointId

      Optional<String> accessPointId()
      Returns the EFS access point ID if EFS is available.
      Returns:
      EFS access point ID (e.g., "fsap-12345678"), or empty if EFS is not available