Let’s deploy the lab before we dig into the details of the architecture. First we need to start with a fresh Fauna database.
From the Fauna dashboard, create a new database.
Generate an API Key: In the new database you just created, run the following command in the web shell:
Key.create({
role: 'admin',
data: {
name: 'workshop-admin'
}
})
From the output of the above, copy the value of secret and temporarily save it somewhere for the next step.
Back at your workstation/IDEs terminal, cd to /Lab2/scripts. Locate the .env file and edit in the values for FAUNA_API_KEY
Run the following command to initialize the lab. Make sure to pass an email address that will be used to email you the credentials needed to login into the admin application.
cd Lab2/scripts/
./deployment.sh -s -c --email <<provide your email to receive the Admin login credentials>>
The script will take a few minutes to complete. Once done, we need to perform a manual step to add a Fauna secret into Parameter Store.
Navigate to the Systems Manager Console, by searching for “systems manager” in the console search bar:
Notice an existing parameter /serverless-saas-fauna/faunadb/config/appConfig. It was provisioned by the deployment script
We’ll come back and discuss what this in detail later on in the Lab. For now, just note that it is for storing
plain text parameters, and was something we could automatically provision.
To store secrets, we need to manually create the parameter:
Click the Create parameter button to add a new parameter. Enter the following values into the form:
{ "secret": "FAUNA_API_KEY" }
(Copy the value of FAUNA_API_KEY from the .env file and enter it here as the secret value)Be sure to Save the parameter. Then let’s move on to the next section.