Test serverless locally

Nadtakan Jones
Jan 11 · 1 min read

I have been working with serverless framework for 6 months. I wrote code and deploy every single time to check if it’s working properly. I don’t think that is a good idea to do it so I found a really interesting way to do it. Are you ready?

Here is steps :

serverless invoke [local] --function functionName

But my problem was what if I have a lot of of projects that I’m working on which different AWS account. So I figured out that you have to added a profile to yml file.

provider:
environment:
AWS_PROFILE: PROFILE_NAME

PROFILE_NAME is a profile that you add on credentials file which contain

[PROFILE_NAME]
aws_access_key_id = XXXXXXXXXXXXXX
aws_secret_access_key = 1111111111111

and that’s it. Thank you for reading!