aws / aws/containers-roadmap

[Fargate] [request]: Support environment files (EnvironmentFile) with Windows containers

Open
#2,475 0 comments 1 reaction 0 assignees View on GitHub
Fargate Proposed
Dominant language
Shell
Stars
5.4k
Forks
334
PR merge metrics
No merged PRs in 30d

Description

### Community Note

* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment

**Tell us about your request**
Support environment files for Windows containers on Fargate, as described in: [Pass environment variables to an Amazon ECS container](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/use-environment-file.html).

**Which service(s) is this request for?**
Fargate

**Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?**

We want to use environment variables inside of Windows containers for non-sensitive configuration values.

Passing a reference to an S3-hosted `.env` file is more convenient than specifying an array of "inline" environment variable objects. This is particularly the case when using CFN, where we try to reuse a single template to create many stacks, and therefore need to "parameterize" aspects that vary among stacks. There is no straightforward means of parameterizing an array of key/value pairs, as is required by [the Environment property](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinition.html#cfn-ecs-taskdefinition-containerdefinition-environment). Frankly, [the EnvironmentFile property](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-environmentfile.html) has the same issue (it's an array of key/value pairs), but we can get away with parameterizing a reference to a single S3 location, given that single location can contain all needed environment variables (see the example snippet below).

**Are you currently working around this issue?**
We're not yet using environment variables with Windows containers. If we must do so, we'll likely have to create service-specific CFN templates, rather than reusing a common CFN template.

**Additional context**

Though there are 2 existing issues about this (#1626 and #1627), discrepancies remain in the documentation.

Here is a CFN snippet we're using with Linux containers on Fargate, where a reference to an S3-hosted `.env` file is "parameterized".

```YAML
EcsTaskDefinition:
Type: AWS::ECS::TaskDefinition
Properties:
ContainerDefinitions:
- Image: !Ref Image
EnvironmentFiles: !If
- IsEnvironmentFileSpecified
-
-
Type: s3
Value: !Ref EnvironmentFile
- !Ref AWS::NoValue
```

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the linked Amazon ECS environment-file documentation and the related issues #1626 and #1627, focusing on the remaining Windows-container discrepancies. Done means Fargate supports S3-hosted EnvironmentFile references for Windows containers, with the documentation accurately describing the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws
Domain
cloud
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.