@Generated(value="jsii-pacmak/1.58.0 (build f8ba112)",
date="2022-05-20T22:20:05.432Z")
public abstract class EnvironmentFile
extends software.amazon.jsii.JsiiObject
Example:
Secret secret; Secret dbSecret; StringParameter parameter; TaskDefinition taskDefinition; Bucket s3Bucket; ContainerDefinition newContainer = taskDefinition.addContainer("container", ContainerDefinitionOptions.builder() .image(ContainerImage.fromRegistry("amazon/amazon-ecs-sample")) .memoryLimitMiB(1024) .environment(Map.of( // clear text, not for sensitive data "STAGE", "prod")) .environmentFiles(List.of(EnvironmentFile.fromAsset("./demo-env-file.env"), EnvironmentFile.fromBucket(s3Bucket, "assets/demo-env-file.env"))) .secrets(Map.of( // Retrieved from AWS Secrets Manager or AWS Systems Manager Parameter Store at container start-up. "SECRET", Secret.fromSecretsManager(secret), "DB_PASSWORD", Secret.fromSecretsManager(dbSecret, "password"), // Reference a specific JSON field, (requires platform version 1.4.0 or later for Fargate tasks) "API_KEY", Secret.fromSecretsManagerVersion(secret, SecretVersionInfo.builder().versionId("12345").build(), "apiKey"), // Reference a specific version of the secret by its version id or version stage (requires platform version 1.4.0 or later for Fargate tasks) "PARAMETER", Secret.fromSsmParameter(parameter))) .build()); newContainer.addEnvironment("QUEUE_NAME", "MyQueue");
Modifier | Constructor and Description |
---|---|
protected |
EnvironmentFile() |
protected |
EnvironmentFile(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
EnvironmentFile(software.amazon.jsii.JsiiObjectRef objRef) |
Modifier and Type | Method and Description |
---|---|
abstract EnvironmentFileConfig |
bind(Construct scope)
Called when the container is initialized to allow this object to bind to the stack.
|
static AssetEnvironmentFile |
fromAsset(java.lang.String path)
Loads the environment file from a local disk path.
|
static AssetEnvironmentFile |
fromAsset(java.lang.String path,
AssetOptions options)
Loads the environment file from a local disk path.
|
static S3EnvironmentFile |
fromBucket(IBucket bucket,
java.lang.String key)
Loads the environment file from an S3 bucket.
|
static S3EnvironmentFile |
fromBucket(IBucket bucket,
java.lang.String key,
java.lang.String objectVersion)
Loads the environment file from an S3 bucket.
|
protected EnvironmentFile(software.amazon.jsii.JsiiObjectRef objRef)
protected EnvironmentFile(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
protected EnvironmentFile()
public static AssetEnvironmentFile fromAsset(java.lang.String path, AssetOptions options)
path
- Local disk path. This parameter is required.options
- public static AssetEnvironmentFile fromAsset(java.lang.String path)
path
- Local disk path. This parameter is required.public static S3EnvironmentFile fromBucket(IBucket bucket, java.lang.String key, java.lang.String objectVersion)
bucket
- The S3 bucket. This parameter is required.key
- The object key. This parameter is required.objectVersion
- Optional S3 object version.public static S3EnvironmentFile fromBucket(IBucket bucket, java.lang.String key)
bucket
- The S3 bucket. This parameter is required.key
- The object key. This parameter is required.public abstract EnvironmentFileConfig bind(Construct scope)
scope
- The binding scope. This parameter is required.