Answers: <p>Environment variables are defined inside the container and some are passed in the task definition. So you can use <a href="http://docs.aws.amazon.com/cli/latest/reference/ecs/describe-task-definition.html" rel="noreferrer">describe-task-definition</a> to see the extra variables.</p>
  
  <p>To get the default environment of the container image, you can <a href="http://docs.aws.amazon.com/cli/latest/reference/ecs/register-task-definition.html" rel="noreferrer">register-task-definition</a> for task with command 'env' and the specific container image for which you want to find out and then <a href="http://docs.aws.amazon.com/cli/latest/reference/ecs/run-task.html" rel="noreferrer">run-task</a> this task.</p>
  
Answers: CC BY-SA 3.0
Answers: 2017-05-03T19:09:58.510Z
Answers: 2017-05-03T19:09:58.510Z
Answers: Jiri Klouda
Body: <p>What AWS CLI command should I be using to access the environment variables in an AWS ECS cluster's task's container? </p>
  
  <p>I've seen <code>describe-cluster</code>, <code>list-tasks</code>, <code>describe-tasks</code>, <code>describe-container-instances</code>, etc... I can't seem to find one that lets me look at environment variables.</p>
  
  <p>Is this doable via the AWS CLI? </p>
  
Tags: <amazon-ecs><aws-cli>
Title: How to get environment variables in ECS container?
UserDisplayName: Alex
ThreadText: # How to get environment variables in ECS container?
  
  (Asked by: username_0 on 2017-05-02)
  
  What AWS CLI command should I be using to access the environment variables in an AWS ECS cluster's task's container?
  
  I've seen `describe-cluster`, `list-tasks`, `describe-tasks`, `describe-container-instances`, etc... I can't seem to find one that lets me look at environment variables.
  
  Is this doable via the AWS CLI?
  
  **Tags:** amazon-ecs, aws-cli
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-05-03. Score: 11 | Accepted answer
  
  Environment variables are defined inside the container and some are passed in the task definition. So you can use [describe-task-definition](http://docs.aws.amazon.com/cli/latest/reference/ecs/describe-task-definition.html) to see the extra variables.
  
  To get the default environment of the container image, you can [register-task-definition](http://docs.aws.amazon.com/cli/latest/reference/ecs/register-task-definition.html) for task with command 'env' and the specific container image for which you want to find out and then [run-task](http://docs.aws.amazon.com/cli/latest/reference/ecs/run-task.html) this task.
  
  
  ---
  
  