# Set lambda function based on stage variable

**URL:** <https://forum.serverless.com/t/set-lambda-function-based-on-stage-variable/4749>\
**Category:** Serverless Framework\
**Tags:** aws, lambda\
**Created:** [June 13, 2018, 9:04am UTC](https://forum.serverless.com/t/set-lambda-function-based-on-stage-variable/4749 "2018-06-13T09:04:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![apokryfos](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/apokryfos/32/2085_2.png) [@apokryfos](https://forum.serverless.com/u/apokryfos)\
**Post date:** [June 13, 2018, 9:04am UTC](https://forum.serverless.com/t/set-lambda-function-based-on-stage-variable/4749/1 "2018-06-13T09:04:49Z")

</div>

I’ve followed the guide at [Using API Gateway stage variables to manage Lambda functions | AWS Compute Blog](https://aws.amazon.com/blogs/compute/using-api-gateway-stage-variables-to-manage-lambda-functions/) and manually set my Lambda function to be a stage variable like the following:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/serverless/original/2X/2/24d397bce068e87bb877d12bae0ad2584040e093.png)

However I can’t figure out how I can do the same from within my serverless configuration is there any way to do this?

---

<div class="post-metadata">

**Author:** ![buggy](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/buggy/32/177_2.png) [@buggy](https://forum.serverless.com/u/buggy)\
**Post date:** [June 13, 2018, 12:28pm UTC](https://forum.serverless.com/t/set-lambda-function-based-on-stage-variable/4749/2 "2018-06-13T12:28:01Z")

</div>

Stages in the Serverless Framework are very different to stages in the API Gateway. Unless you know what you’re doing and you have a very strong need for them I would stay away from API Gateway stages (beyond what serverless does automatically) and use the Serverless Framework stages instead.
