Profile default does not exist

I have removed (and re-added, it doesn’t make a difference) the profile: default from my serverless.yml (was living under provider:). I have set the environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY. Why does it still complain about the profile?

sls -v

Here is my serverless.yml:

service: screenshot

  name: aws
  runtime: nodejs6.10
  memorySize: 256
  timeout: 30
  region: ap-southeast-2
  role: arn:aws:iam::XXXXXXXXX:role/XXXXXXXXX

    handler: lambda.screenshot

Running serverless deploy and running into this error:

build	06-Nov-2017 17:46:24	Serverless: Packaging service...
build	06-Nov-2017 17:46:24	Serverless: Excluding development dependencies...
build	06-Nov-2017 17:46:37	Serverless: Creating Stack...
build	06-Nov-2017 17:46:37	 
build	06-Nov-2017 17:46:37	  Error --------------------------------------------------
build	06-Nov-2017 17:46:37	 
build	06-Nov-2017 17:46:37	  Profile default does not exist

What’s happening is you’re telling Serverless to loook for a profile you haven’t set up, which is why it’s complaining.

If you’re setting your environment variables, then you don’t need to use a profile - profiles refer to saved credentials in your ~/.aws/credentials file.