Code Monkey home page Code Monkey logo

terraform-aws-lambda-networking's Introduction

Terraform/AWS Lambda Networking Boilerplate

This project is aimed at outlining a small AWS project in which a simple NodeJS application is deployed to a Lambda function. An API Gateway will forward requests to the Lambda, which will then do a sanity check that it can access a Redis database in the private subnet. Additionally, it will check that it can initiate an HTTP request out to the public internet to verify the networking is correctly configured.

Getting Started

Updating Application Code

The application code that is deployed to Lambda lives in the ./app directory in the index.js file. Currently, this code does two checks:

  • Test whether connections over the private AWS subnet are successful to talk to the Redis database
  • Test whether public HTTP requests on the public internet can be initiated from the Lambda successfully

This repository is configured to use VSCode's devcontainer support to allow for local, containerized testing a development. Once VSCode has started the container, exectute the following commands on the container CLI to start Redis:

apt-get update
apt-get install redis
redis-server

In VSCode, you can now press F5 to launch the application or run cd app && npm start from a separate CLI window.

Updating Infrastructure

The infrastructure that manages the AWS Cloud Resources lives in the ./terraform directory. This infrastructure can be deployed in the Actions tab of the repository. If it is the first time the infrastructure is being provisioned, a dummy Hello World application will be deployed to AWS as a placeholder.

All subsequent infrastructure changes can be deployed in the same way.

CI/CD

This repository has two main ways to facilitate CI/CD built-in to GitHub-native workflows:

  • Deploy Application: this workflow will package up the application code into a .zip file and deploy it to the running Lambda function via the AWS CLI
  • Deploy Infrastructure: this workflow will utilize Terraform to apply the latest version of the infrastructure to the AWS Cloud

Architecture

terraform-aws-lambda-networking's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar xsalazar avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.