Creating multiple stages for one api

By default whenever you deploy a stage it creates a whole new api endpoint.

So example would be:

https://cojn6cbcd9.execute-api.us-east-1.amazonaws.com/test/handler
https://uojn6cbce7.execute-api.us-east-1.amazonaws.com/dev/handler
https://abcn6cbce7.execute-api.us-east-1.amazonaws.com/prod/handler

This takes up space on aws and we just hit a 120 limit due to this problem. Me and my team were wondering if there is a way to make one api and for the stages to be put under that one api.

We can do this manually but cannot figure out how to do it from serverless if it is at all possibly.

There’s an apiGateway setting under provider that might help you with this.

We have already looked into this and could not get a solution going. It would not let us deploy the same gateway under a different stage.

Hi @tbaustin, I don’t think you can do that afaik, and this was done so by design to keep each stage standalone. This way each stage can be deployed to a different AWS account.

That said, is there a particular use case you have in mind? Perhaps we can suggest an alternative for your approach :slight_smile:

1 Like

Atm we are deploying one stage in serverless and then going into aws and manually creating the other stages. This is what we want to have so if it is not possible in serverless there may not be another approach haha.

I’m open for anything though :smiley: