Skip to content

Endpoint url changing on deploy to aws lambda.

0

I am using serverless https://www.serverless.com/ to deploy lambda functions to aws. A problem ive encountered is that the endpoint url will sometimes change when the stack has been modified, breaking existing references. What determines when the url will change? What can i do to anticipate a change before it happens? What is the recommended workflow for when a change does happen?

asked a year ago698 views
2 Answers
2
Accepted Answer

The endpoint URL changes when the API Gateway REST API is updated, which can happen when:

  1. API Gateway configuration changes: Modifying API Gateway settings, such as integrating with a new Lambda function, updating resource paths, or changing authentication settings.
  2. Lambda function updates: Deploying a new version of a Lambda function can trigger an API Gateway update.
  3. Stack updates: Modifying the Serverless stack configuration, such as adding or removing resources, can lead to API Gateway changes.

To anticipate URL changes:

  1. Monitor API Gateway updates: Use AWS CloudWatch or (link unavailable)'s built-in monitoring to track API Gateway updates.
  2. Use API Gateway stages: Utilize API Gateway stages (e.g., dev, prod) to manage different environments and minimize URL changes.
  3. Implement a URL redirector: Set up a URL redirector, like an Amazon Route 53 alias record, to point to the latest API Gateway URL.

Recommended workflow when a URL change occurs:

  1. Update references: Update any external references to the new API Gateway URL.
  2. Test the new URL: Verify that the new URL works as expected.
  3. Monitor for issues: Closely monitor your application for any issues related to the URL change.
  4. Consider using a URL manager: Utilize a URL manager, like AWS API Gateway's Custom Domain Names, to manage URL changes and minimize disruptions.
EXPERT
answered a year ago
EXPERT
reviewed a year ago
EXPERT
reviewed a year ago
0

URL Changes When:

API Gateway resource is recreated or modified significantly.

Stage names are changed.

The CloudFormation stack is deleted and recreated.

Anticipate Changes:

Monitor changes in serverless.yml.

Inspect the generated CloudFormation template.

Use serverless deploy --verbose to track changes during deployment.

Recommended Workflow:

Use Custom Domain Names: Avoids dependency on default API Gateway URLs.

Automate URL Retrieval: Use Serverless outputs to fetch and update URLs.

Lock Stage Names: Maintain consistent stage names to minimize URL changes.

Communicate Changes: Update all references and notify stakeholders if URLs change.

Consider Rollback: Roll back if an unexpected URL change disrupts services.

AWS
EXPERT
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.