Profile key not respected in serverless.yml

In my serverless.yml I’ve got:

provider:
  name: aws
  runtime: java8
  profile: test

Seems like it’s using my AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables instead of this profile. Is this expected?

Do you have a profile named test in the /Users/xxxx/.aws/credentials file?

The aws credentials file should look like:

[default]
aws_access_key_id=xxxxxxxxxxx
aws_secret_access_key=aaaaaaaaaaaaaaaaaa
[test]
aws_access_key_id=yyyyyyyyyyyyyyy
aws_secret_access_key=zzzzzzzzzzzzzzzzzzz

While I haven’t tested it extensively, I think I’ve seen the AWS SDK (which Serverless uses) prioritise the AWS_ACCESS_KEY_ID and AWS_ACCESS_KEY_ID variables over a specific profile, which would explain what you’re seeing (assuming your profiles are setup correctly, as per @DavidWells’s question).

1 Like

Yeah, that must be it. Thanks.

1 Like