Issue with setting environment variables for AWS source config in CloudQuery

Hey, it’s me again.

Just checking how the environment variables for the AWS source config.yaml file should be set.

I am facing a major issue with regards to this since I set the keys as environment variables in my PowerShell, and then when I try to run the sync, it shows this error:

ERR error retrieving credentials error="failed to refresh cached credentials, no EC2 IMDS role found, operation error ec2imds: GetMetadata, canceled, context deadline exceeded" account=111 module=aws-src
2023-11-07T08:25:59Z WRN Could not retrieve credentials for account error="error retrieving AWS credentials (see logs for details). Please verify your credentials and try again" account=111 module=aws-src

Any help would be appreciated!

Information about the environment variables in the config file can be found here: CloudQuery Environment Variable Substitution.

Based on the error you shared, it seems like the AWS SDK isn’t able to find any credentials in environment variables, the ~/.aws/config, or ~/.aws/credentials files, and therefore is falling back to the IMDSv2 endpoint, which is the last option.

Does this look right?
@ben Whenever I try to give the connection string, it shows that the credential string is an additional property.
And the JSON schema isn’t able to get the credentials.
The credentials.yaml file is in the root .aws directory as instructed.
@kemal Can you please help me?

Hi @valued-garfish!

The issue you see is pointing at the required configuration for the AWS auth. Basically, if you are able to run AWS CLI, the error should be gone.

You can pass (or export) AWS CLI auth environment variables before running cloudquery sync. See the docs. AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY should be sufficient. You could also verify that AWS CLI config is present as discussed in the AWS CLI docs.

Thanks, it’s done.
The local profile line was creating a problem.