Introduction
We’ll use a pre-built NodeJS app for this example, but you can follow along using your own application as well.Prerequisites
- An AWS account
- A PlanetScale account
Set up the database
NoteIf you already have a database with a production branch, skip to the next section.

SELECT * FROM Tasks
to ensure the data was properly added from the console.




.env
section of the guide. These details will be required to connect to the database.
Configure the Lambda function
Secrets in AWS Lambda functions, which include database connection strings, are often stored as environment variables with the Lambda function. We’ll be uploading a sample NodeJS app that has been provided and storing the connection string from the previous section as an environment variable to test. Start by cloning the following Git repository:





Configure environment variables
Next, you need to set the PlanetScaleDATABASE_URL
environment variable that you copied earlier. Select the Configuration tab, and click Edit.



