Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.
/ phim-api Public archive

🍿 The movie search engine back-end API uses AWS Lambda, Amazon API Gateway, and Terraform.

Notifications You must be signed in to change notification settings

phake-app/phim-api

Repository files navigation

🍿 Serverless Movie Search Engine

A movie search engine that utilises Terraform for provisioning cloud resources and hosted on the AWS Cloud with AWS Lambda function and Amazon API Gateway stack.

Techstack

  • Terraform is an open-source infrastructure as code software tool that provides a consistent CLI workflow to manage hundreds of cloud services.
  • Typescript is an open-source language which builds on JavaScript, one of the world’s most used tools, by adding static type definitions.
  • AWS Lambda is a serverless compute service that lets you run code without provisioning or managing servers, creating workload-aware cluster scaling logic, maintaining event integrations, or managing runtimes.
  • Amazon API Gateway is a fully managed service that makes it easy for developers to create, publish, maintain, monitor, and secure APIs at any scale.

Prepare before deploy 🚀

Before going to deploy step, you need to request an ACM Public Cerfiticate, read the AWS docs for more details:

After that, you need to create API Gateway > Custom domain name with the ACM Public Certificate on the previous step, read the AWS Docs for more details:

Deployment 🚀

  • Run yarn lint to lint TS code using both ESLint and Prettier working together
  • Run yarn script:build-dependency-layer this will run a bash script to zip up production dependencies and add them to the lamba as a layer
  • Run yarn build to run TSC to compile TS code to plain JS
  • Run yarn cleanup to remove generated files after deployment steps
  • Run yarn tf:init to get aws provider plugin downloaded
  • Run yarn tf:plan to see changes that will be made
  • Run yarn tf:apply to actually make those changes to your provider
  • Visit AWS and see all your services provisioned via terraform
  • Run yarn tf:destroy to destroy all the services that were built

You can also simply call yarn deploy:all to both zip up an archive and provision the resources together. Similarly you could run yarn update:all to destroy all resources and re-provision them.

Inspiration & References

  • Terraform Lambda Typescript Starter This is a basic Hello World starter template that utilises terraform for provisioning cloud resources. It is an opionanted starter which uses TypeScript, ESlint, Prettier and Husky.