aws / aws/containers-roadmap

[ECS/Fargate] [request]: Reset environmentFiles using containerOverrides

Open
#1,564 0 comments 2 reactions 0 assignees View on GitHub
ECS 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**

Let's say that there is a task definition with the below configuration:
```
(...)
"environmentFiles": [
{
"value": "arn:aws:s3:::BUCKET_NAME/environment.env",
"type": "s3"
}
(...)
```
If [this doc](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/taskdef-envfiles.html) was correctly followed, the ECS task will start and the variable(s) will be available.

Let's also say that while calling the [RunTask](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_RunTask.html) API, the command provided is trying to reset the `environmentFiles` parameter.

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

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

I tried it with different approaches and none of them were able to remove the `environmentFiles` from the Task Definition. Please follow below the commands and the respective outcome:

```
$ aws ecs run-task --platform-version 1.4.0 --launch-type FARGATE --cluster Fargate --task-definition TASK_DEFINITION:VERSION_NUMBER --network-configuration 'awsvpcConfiguration={subnets=["SUBNET_ID"],securityGroups=["SG_ID"],assignPublicIp=ENABLED}' --overrides='{ "containerOverrides": [ { "name": "nginx-container", "environmentFiles": [ { "value": "", "type": "" } ] } ] }'

An error occurred (InvalidParameterException) when calling the RunTask operation: An unsupported environment file type was used. Specify a valid environment file type and try again.
```

```
$ aws ecs run-task --platform-version 1.4.0 --launch-type FARGATE --cluster Fargate --task-definition TASK_DEFINITION:VERSION_NUMBER --network-configuration 'awsvpcConfiguration={subnets=["SUBNET_ID"],securityGroups=["SG_ID"],assignPublicIp=ENABLED}' --overrides='{ "containerOverrides": [ { "name": "nginx-container", "environmentFiles": [ { } ] } ] }'

Parameter validation failed:
Missing required parameter in overrides.containerOverrides[0].environmentFiles[0]: "value"
Missing required parameter in overrides.containerOverrides[0].environmentFiles[0]: "type"
```

```
$ aws ecs run-task --platform-version 1.4.0 --launch-type FARGATE --cluster Fargate --task-definition TASK_DEFINITION:VERSION_NUMBER --network-configuration 'awsvpcConfiguration={subnets=["SUBNET_ID"],securityGroups=["SG_ID"],assignPublicIp=ENABLED}' --overrides='{ "containerOverrides": [ { "name": "nginx-container", "environmentFiles": [ ] } ] }'

Task runs with the previous configured `environmentFiles`. In other words, the `environmentFiles` is not `null`.
```

```
$ aws ecs run-task --platform-version 1.4.0 --launch-type FARGATE --cluster Fargate --task-definition TASK_DEFINITION:VERSION_NUMBER --network-configuration 'awsvpcConfiguration={subnets=["SUBNET_ID"],securityGroups=["SG_ID"],assignPublicIp=ENABLED}' --overrides='{ "containerOverrides": [ { "name": "nginx-container", "environmentFiles": null } ] }'

Parameter validation failed:
Invalid type for parameter overrides.containerOverrides[0].environmentFiles, value: None, type: , valid types: ,
```

**Are you currently working around this issue?**
Manually remove it from the Task Definition.

**Additional context**
Anything else we should know?

Let me know if it is supported and what would be the correct command in order to reset the `environmentFiles`.

Contributor guide

Open the contributing guide

Research direction

Start with the ECS RunTask API documentation and the containerOverrides and environmentFiles parameters described in the issue. Compare the reported CLI outcomes with the documented override semantics; done would be a confirmed supported reset behavior or a clearly documented limitation and workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws
Domain
api, 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.