Md. Parvez Alam
Md. Parvez Alam

Reputation: 4596

AWS lambda configuration in node.js

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

Upvotes: 1

Views: 362

Answers (1)

Ashok JayaPrakash
Ashok JayaPrakash

Reputation: 2293

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

Upvotes: 1

Related Questions