I recently had the opportunity to develop a serverless application with the use of AWS Lambda and API Gateway. It was my first introduction to the technology. My coworker suggested the solution as a way to keep cost down for for hosting a relatively simple REST API needed for multiple other services in our main application. We started with a Spring Boot Java application connected to DynamoDB in a docker container. Then we created a Lambda file to define the API endpoints. A Lambda file in this case is was a single Java class with methods for each endpoint which is basically the same thing as a traditional Spring Boot Controller. The Lambda file called an additional service file to do the core logic which also depended on a CRUD Repository file that integrates to DynamoDB. This Lambda project is deployed to AWS via a serverless.yml file that defines the paths and parameters for the Lambda file. The challenges I faced were mostly learning to use AWS API Gateway and serverless.yml. We used the original spring controller to debug during development. Once we got it working it seemed rather simple though.
AWS Lambda is a serverless computing service provided by Amazon Web Services (AWS) that enables you to run code in response to events without the need to provision or manage servers. With AWS Lambda, you can build and deploy applications using a "pay-as-you-go" model, where you only pay for the compute time that your code actually consumes.
Key features and concepts of AWS Lambda include:
Serverless Architecture: With AWS Lambda, you don't need to worry about server provisioning, scaling, or maintenance. AWS takes care of the underlying infrastructure, allowing you to focus on writing and deploying code.
Event-Driven Execution: AWS Lambda functions are triggered by events from various AWS services or custom sources. These events can include changes in data, HTTP requests, database updates, file uploads, and more.