7

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?

Sunny
  • 754
  • 6
  • 19

1 Answers1

12

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.
Noel Llevares
  • 11,823
  • 2
  • 41
  • 72
  • Thanks for the answer. I assumed the same , service name and re-deploy. Is there a doc link for this. – Sunny May 21 '19 at 11:30
  • @Sunny I am not aware of any documentation for that. But that's how CloudFormation behaves when you change the stack name and `serverless deploy` uses CloudFormation behind-the-scenes. – Noel Llevares May 21 '19 at 17:49