Install jq Run: aws ecs describe-task-definition \ --task-definition <task_arn> \ --query "taskDefinition.containerDefinitions[0].environment[]" | jq -r '.[] | "-e \(.name)=\"\(.value)\" \\"'