1

I use below command to configure aws lambda

serverless config credentials --provider aws --key xxxx --secret xxxx

It says updated in '.aws/credentials', But I could not find such file or directory.

How can I make it configurable to read from config file as it will be different for dev , qa or prod

I run below command to deploy

sls deploy

THanks

1 Answer 1

1

Location for aws credential file in your machine

~/.aws

In Windows machine file path for credential file is C:\Users\.aws. Make sure .aws folder is not hidden

Credential information inside the credential file in .aws directory

[default]
aws_access_key_id = xxxxxxxxx
aws_secret_access_key = yyyyy

[qa]
aws_access_key_id = xxxxxxxxx
aws_secret_access_key = yyyyy

[prod]
aws_access_key_id = xxxxxxxxx
aws_secret_access_key = yyyyy

You can manually add multiple profiles [dev/test/preprod/qa] in the following file.

Also you can add aws profile using the following command when aws cli is installed in your machine.

aws configure --profile prod

AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: us-west-2
Default output format [None]: ENTER

In order to deploy serverless in AWS, use the following command

serverless deploy //Use default profile and proceed deployment
serverless deploy --aws-profile qa //Deploy in QA environment  
serverless deploy --aws-profile prod //Deploy in Production environment  

For more detailed information about serverless deployment, kindly go through the following documentation Serverless Deployment

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.