[Grafana] Issue with Cloudwatch datasource

Hi there :wave:

I hope I’m in the good channel!? I have an issue with the AWS “CloutWatch” datasource in Grafana 8.3.4.
I’m trying to create a cloudwatch datasource using configmap provisioning (using Grafana on Kubernetes/EKS with the official Helm Chart).

Here’s my datasource configuration:

    type: cloudwatch
    access: proxy
    editable: yes
    secureJsonData:
      authType: keys
      defaultRegion: us-east-1
      accessKey: ${AWS_ACCESS_KEY}
      secretKey: ${AWS_SECRET_KEY}```
The datasource gets created but doesn't contain the `accessKey` / `secretKey` and `Authentification Provider` is not set to `Access & secret key` like expected with `authType: keys`

Is this a bug or a configuration problem?

Documentation link : [https://grafana.com/docs/grafana/latest/administration/provisioning/#datasources](https://grafana.com/docs/grafana/latest/administration/provisioning/#datasources)

Thank you :slightly_smiling_face:

Had a similar issue with the Postgres datasource. It was missing enpoints, users and passwords among other things, ended up doing it manually but not a great solution…

Try:

    type: cloudwatch
    access: proxy
    editable: yes
    jsonData:
      authType: keys
      defaultRegion: us-east-1
    secureJsonData:
      accessKey: ${AWS_ACCESS_KEY}
      secretKey: ${AWS_SECRET_KEY}```

https://grafana.com/docs/grafana/latest/datasources/aws-cloudwatch/provision-cloudwatch/#using-accesskey-and-secretkey

Are those variables actually populated?

The variables are well populated, checking logs and sending them

Should work
https://grafana.com/docs/grafana/latest/administration/provisioning/#using-environment-variables

t=2022-01-25T14:48:39+0000 lvl=warn msg="Unrecognized AWS authentication type" logger=tsdb.cloudwatch type=

Is that the full line or did you cut the end?

This is the full line

Here’s the full block :

t=2022-01-25T14:48:25+0000 lvl=info msg="inserting datasource from configuration " logger=provisioning.datasources name=cloudwatch uid=XXXXXXXXXXXXX
t=2022-01-25T14:48:36+0000 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=GET path=/api/live/ws status=0 remote_addr=10.200.132.217 time_ms=2 size=0 referer=
t=2022-01-25T14:48:39+0000 lvl=warn msg="Unrecognized AWS authentication type" logger=tsdb.cloudwatch type=```

Doc says :
authType string Cloudwatch Auth provider. default/credentials/keys

Try setting them by hand and checking the browser console, one of the requests will return the datasource in json format (without the keys)

Just tried fields name are the same

I don’t know then :disappointed:

I use it with assume role

Thanks for the help :slightly_smiling_face:

https://github.com/grafana/helm-charts/issues/995