Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 741
Sunny Avatar asked May 21 '19 07:05

Sunny


People also ask

Does API gateway change URL?

Added to that if you need to completely re-deploy your stack your API urls will change.

Does serverless deploy to API gateway?

By default, Serverless creates automatically an API Gateway for each Serverless stack or service (i.e. serverless. yml ) you deploy.

How does API gateway interact with Lambda?

A Lambda integration maps a path and HTTP method combination to a Lambda function. You can configure API Gateway to pass the body of the HTTP request as-is (custom integration), or to encapsulate the request body in a document that includes all of the request information including headers, resource, path, and method.

How do I get an API gateway URL in Lambda?

Copy your API's invoke URL, and enter it in a web browser. Append the name of your Lambda function to your invoke URL to call your Lambda function. By default, the API Gateway console creates a route with the same name as your Lambda function, my-function . The full URL should look like https:// abcdef123 .


1 Answers

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.
like image 102
Noel Llevares Avatar answered Oct 11 '22 05:10

Noel Llevares