title: How can an ECS task know in which region is runs?
body: <p>I have a python application using boto3 in a task launched by ECS (in a docker container). The boto3 command I use need a region to work properly, but I only know the region at runtime (multi-region application). The idea was then to define the <code>AWS_DEFAULT_REGION</code> environment variable by retrieving the region in the dynamic document provided by Amazon from URI <a href="http://169.254.169.254" rel="nofollow noreferrer">http://169.254.169.254</a>. However, whereas the call works fine from the instance, I cannot access the endpoint from within the task container.</p>
  
  <p>Is there a clean way to know in which region the task actually runs ?</p>
  
  <p><strong>[SOLUTION]</strong></p>
  
  <p>Have a look at the issue <a href="https://github.com/aws/aws-cdk/issues/8664" rel="nofollow noreferrer">enter link description here</a></p>