GithubHelp home page GithubHelp logo

robertcuadra / example-serverless-internet-gateway Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 4 KB

Example of deploying a lambda behind an internet gateway with an elastic IP

JavaScript 11.73% HCL 88.27%

example-serverless-internet-gateway's Introduction

example-serverless-internet-gateway

Example of deploying a lambda behind an internet gateway with an elastic IP. Credit to @darvein for help with the CF template.

VPC with NAT and an EIP

This will deploy via Cloud Formation:

  • 1 VPC
  • 1 Public Subnet and associated routes
  • 1 Private Subnet and associated routes
  • 1 NAT Gateway
  • 1 Internet Gateway
  • 1 Elastic IP Address

There is a terraform version as well, but because it does not use Cloud Formation, the outputs cannot be directly referenced from serverless.yml.

Create the stack

AWS_ACCESS_KEY_ID="xxx" AWS_SECRET_ACCESS_KEY="yyy" aws --region us-east-1 cloudformation create-stack \
	--stack-name serverless-internet-gateway \
	--template-body file://esig-vpc.json \
	--parameters ParameterKey=Project,ParameterValue=serverless-internet-gateway \
	ParameterKey=Environment,ParameterValue=dev \
	ParameterKey=VpcCIDR,ParameterValue="10.0.0.0/16" \
	ParameterKey=PublicSubnet1Param,ParameterValue="10.0.0.0/24" \
	ParameterKey=PrivateSubnet1Param,ParameterValue="10.0.1.0/24"

Lambda + API Gateway

The serverless.yml references the VPC stack for security group and subnet.

Deploy

AWS_ACCESS_KEY_ID=xxx AWS_SECRET_ACCESS_KEY="yyy" node_modules/.bin/serverless deploy

To test, curl the endpoint and it should respond with the same IP as your NAT Gateway.

example-serverless-internet-gateway's People

Contributors

robertcuadra avatar

Watchers

 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.