Search code examples
aws-lambdaaws-cloudformationserverless-frameworkaws-serverlessserverless-plugins

Serverless-framework, when does the API Gateway URL change?


I am using serverless-framework to deploy a lambda with http endpoints on AWS. This works fine and returns a API Gateway endpoint.

I wanted to know under what scenarios does the endpoint URL change. I need the URL to be constant, know deleting and redeploying the service will change the URL.

In what other cases does the URL change?


Solution

  • The URL of your API Gateway Endpoint will change when you recreate the CloudFormation for your service.

    This can happen when:

    1. You remove the stack (sls remove) and recreate it (sls deploy).

    2. You rename your service name in your serverless.yml.

      • In this case, your old API Gateway endpoint will still be there and will keep hosting the last version of the code that you deployed using the old service name and you'll have a new API Gateway endpoint that will point to your updated Lambdas.