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 Summary
Modifier and TypeMethodDescriptionReturns the EFS access point ID if EFS is available.default StringauthMode()Returns the configured authentication mode ("none","alb-oidc", or"application-oidc") — the same valueApplicationSpec.containerEnvironmentVariablesreceives for Fargate/ECS, so EC2 UserData can reach auth/env parity with the ECS task definition.default StringThe ARN of the initial-admin-password secretApplicationFactoryprovisions whenApplicationSpec.autoAdminPasswordEnvVar()is non-null, ornullif that method returnsnull(no such secret exists for this application) or the secret hasn't been provisioned yet at the pointconfigureUserDataruns.efsId()Returns the EFS filesystem ID if EFS is available.default Stringfqdn()Returns the fully-qualified domain name for this deployment, if a domain is configured.booleanhasEfs()Returns whether EFS is available in this deployment.Returns the runtime type as a string.Returns the security profile as a string.default booleanReturns whether TLS/SSL is enabled for this deployment (affects the scheme used when building a public URL for the application, e.g.Returns the CloudFormation stack name.
-
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
-
accessPointId
-
authMode
Returns the configured authentication mode ("none","alb-oidc", or"application-oidc") — the same valueApplicationSpec.containerEnvironmentVariablesreceives for Fargate/ECS, so EC2 UserData can reach auth/env parity with the ECS task definition.Default
"none"for implementations predating this method (source compatibility).- Returns:
- auth mode string, e.g. "none"
- Since:
- 3.2.0
-
fqdn
Returns the fully-qualified domain name for this deployment, if a domain is configured.- Returns:
- FQDN (e.g., "manager.example.com"), or
nullif no domain is configured - Since:
- 3.2.0
-
sslEnabled
default boolean sslEnabled()Returns whether TLS/SSL is enabled for this deployment (affects the scheme used when building a public URL for the application, e.g.https://vshttp://).- Returns:
- true if SSL is enabled
- Since:
- 3.2.0
-
autoAdminPasswordSecretArn
The ARN of the initial-admin-password secretApplicationFactoryprovisions whenApplicationSpec.autoAdminPasswordEnvVar()is non-null, ornullif that method returnsnull(no such secret exists for this application) or the secret hasn't been provisioned yet at the pointconfigureUserDataruns.UserData scripts that need this app's own generated admin password should fetch it via
aws secretsmanager get-secret-value --secret-id <this ARN>using the EC2 instance role's own IAM permissions (granted automatically byEc2Factorywhenever this is non-null) — not a guessed secret name/path, which will not match the provisioned secret.- Returns:
- the secret ARN, or
null - Since:
- 3.2.18
-