Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Error] Cannot fetch region variable from config file, environment variables, ecs metadata, or ec2 metadata. #191

Open
jcquiles opened this issue Feb 20, 2023 · 1 comment

Comments

@jcquiles
Copy link

Hello I cant seem to figure out exactly what is being asked here. I am just trying to run a test locally to get a clear idea of how to get a django application configured with xray before even applying it to an ecs fargate cluster, which is the primary goal.

I tried setting credentials and region as environment variables locally and inside .aws/credentials but am still getting the same result. The container exits as soon as docker-compose file is ran.

Here is the full error.

➜  mysite git:(main) ✗ docker logs -f e8e58775c8ff
2023-02-20T23:50:51Z [Info] Initializing AWS X-Ray daemon 3.3.6
2023-02-20T23:50:51Z [Info] Using buffer memory limit of 78 MB
2023-02-20T23:50:51Z [Info] 1248 segment buffers allocated
2023-02-20T23:50:51Z [Error] Cannot fetch region variable from config file, environment variables, ecs metadata, or ec2 metadata. Use local-mode to use the local session region

Here is the docker-compose file.

`version: '3'

services:
    web:
        build: .
        command: python manage.py runserver 0.0.0.0:8000
        ports:
            - 8000:8000
        links:
            - xray
        environment:
            XRAY_DAEMON_ADDRESS: xray:2000
            AWS_REGION: us-east-2


    xray:
        image: amazon/aws-xray-daemon
        entrypoint: /usr/bin/xray --local-mode -o`

Is there another solution here if the problem is not the credentials? Thank you!

@jj22ee
Copy link
Contributor

jj22ee commented Mar 6, 2023

Hi, I have 2 different suggestions

  1. The environment variables may be isolated between the 2 containers. You have to define the env variable AWS_REGION for the xray container as well.
  2. If first option doesn't work, try changing /usr/bin/xray --local-mode -o to /usr/bin/xray --local-mode -o -n us-east-2

Also, you do not need both --local-mode and -o, as they are both the same command line option

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants