How to maintain multiple AWS profiles for Serverless


I have started using serverless.com for building and deploying my serverless functions to aws lambda.
I have a different set of IAM credentials for this, When i try to configure those credentials i am getting following message from serverless

$serverless config credentials --provider aws --key BxxxxxxxxkeyxxxxxG --secret nxxxxxxxxxxxxxxxxxxxxxxxxx8
Serverless: Setting up AWS...
Serverless: Failed! ~/.aws/credentials already has a "default" profile. Use the overwrite flag ("-o" or "--overwrite") to force the update

How can i manage a different profile to manage the serverless?

1 Answer

5 years ago by

You can maintain multiple aws profiles at this location ~/.aws/credentials
If you open it, you should see something like following

[default]
aws_access_key_id = AxxxxxxxxxxxxxxxQ
aws_secret_access_key = mxxxxxxxxxxxxxxxxxxxxxxx9

You can add multiple profiles here for example like following

[default]
aws_access_key_id = AxxxxxxxxxxxxxxxQ
aws_secret_access_key = mxxxxxxxxxxxxxxxxxxxxxxx9

[serverless-project1]
aws_access_key_id = AxxxxxxxxxxxxxxxQ
aws_secret_access_key = mxxxxxxxxxxxxxxxxxxxxxxx9

[s3-sync]
aws_access_key_id = AxxxxxxxxxxxxxxxQ
aws_secret_access_key = mxxxxxxxxxxxxxxxxxxxxxxx9
5 years ago by Karthik Divi