![](/having-fun-serverless/web-adapter-example/raw/main/images/logo.png)
AWS Lambda Adapter is the best kept secret that you can use in order to migrate non-lambda native application to the Lambda world.
The following repo shows an example of using a Nest based application created with Amplication which is connected to a RDS database and exposed
to the outside world using Lambda URL and a Lambda Web Adapter.
Report Bug
·
Request Feature
Table of Contents
- A NestJS application created with the Amplication development tool.
- The application runs inside a Lambda using a docker image created by Amplication.
- The Lambda is connected to the outside world using Lambda URL functionality.
- And it's located inside a private subnet with an access to an RDS database.
- Make sure your machine is ready to work with AWS SAM
- Clone this repository.
- Run
sam build
and thensam deploy --guided
. - Choose user name and password for the DB.
- Make sure you a key pair for the bastion station.
- The Lambda URL has no authentication on purpose, the authentication is being handled by NestJS.
- Access the Lambda URL end point and append
/api
, for examplehttps://****.lambda-url.us-east-1.on.aws/api
. - Authorize using
admin
as user and password, and make a call.
- Defining the extension to be part of your docker file - https://github.com/aws-hebrew-book/web-adapter-example/blob/f787c8c8689259132db70b48b817da16217a5b7b/server/Dockerfile#L28
- NestJS application runs on port 8080 - https://github.com/aws-hebrew-book/web-adapter-example/blob/f787c8c8689259132db70b48b817da16217a5b7b/server/template.yaml#L206
- Authentication handled by NestJS - https://github.com/aws-hebrew-book/web-adapter-example/blob/f787c8c8689259132db70b48b817da16217a5b7b/server/template.yaml#L210
- Initial DB migration - https://github.com/aws-hebrew-book/web-adapter-example/blob/f787c8c8689259132db70b48b817da16217a5b7b/server/template.yaml#L125
- Using secret manager to save credentials - https://github.com/aws-hebrew-book/web-adapter-example/blob/f787c8c8689259132db70b48b817da16217a5b7b/server/template.yaml#L164
- Anti Pattern Embedding the credentials as part of UserData, this solution is quick and dirty, use SecretsManager - https://github.com/aws-hebrew-book/web-adapter-example/blob/f787c8c8689259132db70b48b817da16217a5b7b/server/template.yaml#L124
Monitoring is done by using Lumigo
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the Apache License Version 2.0 License. See LICENSE
for more information.
Efi Merdler-Kravitz - @TServerless