@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:38.697Z") @Stability(value=Stable) 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");
newContainer.addSecret("API_KEY", Secret.fromSecretsManager(secret));
newContainer.addSecret("DB_PASSWORD", Secret.fromSecretsManager(secret, "password"));
| 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(software.constructs.Construct scope)
Called when the container is initialized to allow this object to bind to the stack.
|
static AssetEnvironmentFile |
fromAsset(String path)
Loads the environment file from a local disk path.
|
static AssetEnvironmentFile |
fromAsset(String path,
AssetOptions options)
Loads the environment file from a local disk path.
|
static S3EnvironmentFile |
fromBucket(IBucket bucket,
String key)
Loads the environment file from an S3 bucket.
|
static S3EnvironmentFile |
fromBucket(IBucket bucket,
String key,
String objectVersion)
Loads the environment file from an S3 bucket.
|
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetprotected EnvironmentFile(software.amazon.jsii.JsiiObjectRef objRef)
protected EnvironmentFile(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable) protected EnvironmentFile()
@Stability(value=Stable) @NotNull public static AssetEnvironmentFile fromAsset(@NotNull String path, @Nullable AssetOptions options)
path - Local disk path. This parameter is required.options - @Stability(value=Stable) @NotNull public static AssetEnvironmentFile fromAsset(@NotNull String path)
path - Local disk path. This parameter is required.@Stability(value=Stable) @NotNull public static S3EnvironmentFile fromBucket(@NotNull IBucket bucket, @NotNull String key, @Nullable String objectVersion)
bucket - The S3 bucket. This parameter is required.key - The object key. This parameter is required.objectVersion - Optional S3 object version.@Stability(value=Stable) @NotNull public static S3EnvironmentFile fromBucket(@NotNull IBucket bucket, @NotNull String key)
bucket - The S3 bucket. This parameter is required.key - The object key. This parameter is required.@Stability(value=Stable) @NotNull public abstract EnvironmentFileConfig bind(@NotNull software.constructs.Construct scope)
scope - The binding scope. This parameter is required.Copyright © 2022. All rights reserved.