• Type:

CH Show HN: Djambda – Django on Lambda with Terraform

Djambda is an example project setting up Django application in AWS Lambda managed by Terraform.

GitHub Actions create environments for master branch and pull requests.

Setup

Github auth

  • Generate a personal access token in github. Check out the docs in case you need help. Remember to check repo (repository public key) and workflow scopes.
  • Create organization in github. As of time of writing terraform doesn’t support setting secrets in individual user account. This may change when this pr gets upstreamed.

Terraform Cloud

Github repository

  • Fork this repo.
  • Set create_lambda_function input in django module (terraform/django.tf) to false. This will prevent terraform from creating lambda related resources before building application.
  • Set organization and workspaces in terraform/main.tf.
  • Set TF_API_TOKEN repository secret.
  • Re-run jobs.
  • Set create_lambda_function input in django module (terraform/django.tf) to true.
  • Re-run jobs.

AWS resources

Terraform sets up following AWS resources:

  • VPC with optional endpoints
  • Lambda with REST API Gateway
  • RDS for PostgreSQL
  • S3 bucket for static files behind CloudFront

Related Projects

TODO

  • Remove db and staticfiles after lambda destroy

Read More

Previous Post

CH Show HN: how our team at Google releases libraries

Next Post

CH Show HN: Health monitoring for loved ones on the cloud

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top