Unveiling the AWS SAM Magic for Serverless Restful APIs: Architecting with ALB Path-Based Routing in AWS
DOI:
https://doi.org/10.47941/ijce.1734Keywords:
AWS SAM CLI, AWS Lambda, ALB Path-Based Routing, AWS Powertools, AWS ObservabilityAbstract
Purpose: This paper provides a thorough roadmap for developers, architects, and cloud enthusiasts who want to use the AWS Serverless Application Model (AWS SAM) to create a REST API and use the power of serverless computing. To handle HTTP requests effectively, the article focuses on deploying the API behind an Application Load Balancer (ALB) using path-based routing. The hands-on approach offers detailed instructions and valuable insights on planning, creating, and implementing serverless REST APIs. The focus is on the details of AWS SAM, examining its benefits and complexities. The paper makes the procedure easier to understand by providing thorough code excerpts, explanations, and pictures.
Methodology: The methodology covers local testing using the SAM CLI, allowing developers to validate the API's functionality before deployment.
Findings: The process also includes local testing with the SAM CLI, which enables developers to confirm the functioning of the API before deployment. To target the Lambda function, this paper will discuss AWS Lambda behind an ALB using a path-based listener rule on the ALB. The article's conclusions cover essential topics like path-based routing, ALB integration, AWS SAM template structure, and recommended security and performance optimization practices.
Unique Contributor to Theory, Policy and Practice: Based on these findings, recommendations offer information on optimizing templates, ensuring secure deployment, and using local testing to speed up development. Finally, the article walks readers through deploying the built API to AWS via the SAM CLI, facilitating a seamless transfer from a local development environment to an environment in production. Ultimately, this paper provides readers with the know-how and abilities to successfully negotiate AWS SAM's complexities and build reliable serverless REST APIs.
Downloads
References
AWS (n.d.). Using the AWS SAM CLI. AWS Serverless Application Model Developer Guide. https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/using-sam-cli.html
AWS (2019, March 27). New – Advanced Request Routing for AWS Application Load Balancers. AWS News Blog. https://aws.amazon.com/blogs/aws/new-advanced-request-routing-for-aws-application-load-balancers/
AWS (n.d.). What are Amazon CloudWatch Logs? Amazon CloudWatch Logs. https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/WhatIsCloudWatchLogs.html
AWS (n.d.). What is AWS X-Ray? AWS X-Ray. https://docs.aws.amazon.com/xray/latest/devguide/aws-xray.html
ducaale / xh (n.d.). Xh. GitHub. https://github.com/ducaale/xh
AWS (n.d.). What is Amazon API Gateway? Amazon API Gateway Developer Guide. https://docs.aws.amazon.com/apigateway/latest/developerguide/welcome.html
AWS (n.d.). Working with routes for HTTP APIs. Amazon API Gateway Developer Guide. https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-routes.html
AWS (n.d.). AWS SAM. Amazon ECR Public Gallery. https://gallery.ecr.aws/sam?operatingSystems=Linux
Balasubrahmanya Balakrishna, Comparative Analysis of Amazon Api Gateway and Application Load Balancer for Serverless Architectures, Journal of Software Engineering (JSE), 2(1), 2024, pp. 1–6
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2024 Balasubrahmanya Balakrishna
This work is licensed under a Creative Commons Attribution 4.0 International License.
Authors retain copyright and grant the journal right of first publication with the work simultaneously licensed under a Creative Commons Attribution (CC-BY) 4.0 License that allows others to share the work with an acknowledgment of the work's authorship and initial publication in this journal.