awsdocs / amazon-ecs-developer-guide

The open source version of the Amazon ECS developer guide. You can submit feedback & requests for changes by submitting issues in this repo or by making proposed changes & submitting a pull request.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fargate Environment Variables

Stephen3443 opened this issue · comments

Documentation outlining the environment variables available within a Fargate hosted environment that are preset by AWS. For example, there is the following page for Lambda:

https://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html#lambda-environment-variables

Three years later and this is still a problem. In case it's useful to anyone, below is the list of environment variables set by Fargate at the time of this comment. (Up to you to decide if you want to rely on them though as they're not [all] documented!)

var comment
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI mentioned here: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html#task-iam-role-considerations
AWS_DEFAULT_REGION
AWS_EXECUTION_ENV Stack Overflow says the values are AWS_ECS_EC2 for EC2 launch type and AWS_ECS_FARGATE for Fargate. I can confirm the latter.
AWS_REGION
ECS_CONTAINER_METADATA_URI mentioned here: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-metadata-endpoint-v3.html
ECS_CONTAINER_METADATA_URI_V4 mentioned here: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-metadata-endpoint-v4.html

Closing this issue or pull request in advance of archiving this repo. For more information about the decision to archive this repo (and others in the 'awsdocs' org), see the announcement on the AWS News Blog.