# S3EnvironmentFile

Environment file from S3.

Extends: EnvironmentFile › S3EnvironmentFile

- Source: [`aws-ecs/lib/environment-file.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-ecs/lib/environment-file.ts#L81)

## Example

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ecs as ecs } from 'aws-cdk-lib';
import { aws_s3 as s3 } from 'aws-cdk-lib';

declare const bucket: s3.Bucket;
const s3EnvironmentFile = new ecs.S3EnvironmentFile(bucket, 'key', /* all optional props */ 'objectVersion');
```

## Initializer

```ts
new S3EnvironmentFile(bucket: IBucket, key: string, objectVersion?: string)
```

## Methods

- `bind(_scope: Construct): EnvironmentFileConfig` — Called when the container is initialized to allow this object to bind to the stack.

- `fromAsset(path: string, options?: AssetOptions): AssetEnvironmentFile` (static) — Loads the environment file from a local disk path.

  **Parameters**

  - `path` — Local disk path.

- `fromBucket(bucket: IBucket, key: string, objectVersion?: string): S3EnvironmentFile // chainable` (static) — Loads the environment file from an S3 bucket.

  **Parameters**

  - `bucket` — The S3 bucket.
  - `key` — The object key.
  - `objectVersion` — Optional S3 object version.

  **Returns:** `S3EnvironmentFile` associated with the specified S3 object.
