Docker CloudWatch NoCredentialProviders: no valid providers in chain

What happened:

Grafana CloudWatch datasource unable to find a credentials provider.

I see the following error in the docker container logs when I test the CloudWatch datasource.

“Failed to get regions” logger=tsdb.cloudwatch error=“NoCredentialProviders: no valid providers in chain. Deprecated.\n\tFor verbose messaging see aws.Config.CredentialsChainVerboseErrors”

What you expected to happen:

Grafana CloudWatch datasource running in docker should read the volume mounted credentials file in ~/.aws. I also tried /usr/share/grafana/.aws

How to reproduce it (as minimally and precisely as possible):

Dockerfile

FROM grafana/grafana:6.4.0

WORKDIR /etc/grafana

COPY conf .
COPY datasources provisioning/datasources/

ENV GF_AUTH_DISABLE_LOGIN_FORM "true"
ENV GF_AUTH_ANONYMOUS_ENABLED "true"
ENV GF_AUTH_ANONYMOUS_ORG_ROLE "Admin"
ENV AWS_SDK_LOAD_CONFIG "true"

datasources/aws-cloudwatch.yaml

---
apiVersion: 1

datasources:
  - name: cloudwatch-data-prod
    isDefault: true
    type: cloudwatch
    database: xilution-prod
    jsonData:
      authType: credentials
      defaultRegion: us-east-1

conf/custom.ini

# default section
instance_name = xilution-grafana

To Build Image
docker build -t xilution/xilution-grafana .

To Run
docker run --name xilution-grafana -d -p 3000:3000 -v $(HOME)/.aws/:/home/grafana/.aws xilution/xilution-grafana

To See Logs
docker logs -f xilution-grafana

Anything else we need to know?:

Environment:

  • Grafana version: 6.4.0
  • Data source type & version: CloudWatch
  • OS Grafana is installed on: Docker
  • User OS & Browser: Mac OS/Chrome
  • Grafana plugins: None
  • Others: I use credentials and a config files for AWS authentication.