I'm using serverless framework for my aws lambda function. Suppose my function name is 'service1' ‘function1’ in my serverless.yml file. When i deploy it, my lambda function name becomes: ‘service1-dev-function1’. I understand dev is because default stage is dev, but i dont want any stage related name in my lambda function. I just want my function to be ‘function1’. How can i do that?
There is a reason for that. If you ever wanted to deploy that function into production you can add --stage prod
which will change the name of the function to match the stage. If you handled naming yourself, you could end up with a conflict later where the deployment will tell you it cannot complete because that Lambda function with the name function1
already exists.
After saying all that, you can control the name of the function in AWS explicitly as well. Just add a name
parameter to your function definition the same way you do handle
. You can see this on this serverless.yml reference page which is usually my first port of call for these kinds of questions I usually have as well as that reference contains pretty much every configuration option available to you:
https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml/#serverlessyml-reference/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With