by Samuel Bucheli, Stefan Friedli and Lukas Akermann
Goal: Implement an AWS Lambda application architecture on code from Garfolo's Book «Practical Microservices».
- Practical Microservices by Ethan Garofolo
Create an access key on AWS IAM, then add the following to ~/.aws/config
[profile camp-lambda-in-action]
region = us-east-1
output = json
and the following to ~/.aws/credentials
[camp-lambda-in-action]
aws_access_key_id=<id>
aws_secret_access_key=<secret>
(replacing the placeholders with the actual access key values, of course).
We have used Terraform 1.3.3 while we have experimented with this code. So, this will most likely be the most suitable version to use.
Hint: You can use tfenv https://github.com/tfutils/tfenv to manage Terraform versions. Install with
brew install tfenv
on Mac and then activate the Terraform version using
tfenv use
(this will use the .terraform-version file).
We have used Node v16.18.0 while we have experimented with this code. So, this will most likely be the most suitable version to use.
Hint: You can use nvm https://github.com/nvm-sh/nvm to manage Node installations. Install with
brew install nvm
on Mac and then activate the Node version using
nvm use
To use nvm, you may have to configure some additional steps, see https://formulae.brew.sh/formula/nvm
First, ensure you have all dependencies installed by running
npm install
in the infrastructure folder.
Then, run
npx cdktf get
It should show something like this
Generated typescript constructs in the output directory: .gen
Generates a diff by running Terraform plan:
npx cdktf diff
Deploy:
npx cdktf deploy
I get the following error. What should I do? Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?
Update dependency:
"pg": "^8.0.3"