menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Cloud News

>

Local Deve...
source image

Dev

1M

read

427

img
dot

Image Credit: Dev

Local Development Server for AWS SAM Lambda Projects

  • A developer has written a script to address the lack of a simple and quick way to locally test REST API built using AWS lambdas as request handlers, which can be heavy for quick iterations during development.
  • The solution enables developers to test business logic and data validations, provides a local server for frontend developers to test against, and avoids adding overheads for rebuilding Docker images on every change. The python script creates a local Flask server, mapping the API Gateway routes to the Flask routes.
  • The SAM template can be read to support Functions specific for SAM with added constructors for Ref as a reference to another object, Sub as method to substitute, and GetAtt to get attributes. Add Layers dynamically to path by reading Layers definitions.
  • Creating Flask routes with each endpoint by looping throughout resources and finding all Functions.
  • Potential issues highlighted: Lambda memory limitations and CPU; testing in a real environment is recommended. Approach should be used only to speed up the development process.
  • Overall, the solution enables quick setup, direct execution, hot reload, and shortens the development feedback loop.
  • Developers have been urged to share insights and feedback to improve the solution for everyone.
  • The code is available on github, which developers can access to try this solution.
  • Future updates are expected on the author’s blog.
  • The author assures readers the script is very helpful and is looking for feedback to improve the solution for others.

Read Full Article

like

25 Likes

For uninterrupted reading, download the app