All Projects β†’ TailorDev β†’ Hello Lambda

TailorDev / Hello Lambda

Licence: mit
πŸ”₯ An example of a Python (AWS) Lambda exposed with API Gateway, configured with Terraform.

Projects that are alternatives of or similar to Hello Lambda

Lambda Deployment Example
Automated Lambda Deployments with Terraform & CodePipeline
Stars: ✭ 25 (-78.07%)
Mutual labels:  aws-lambda, lambda, terraform, hcl
Serverless Express
Run Node.js web applications and APIs using existing application frameworks on AWS #serverless technologies such as Lambda, API Gateway, Lambda@Edge, and ALB.
Stars: ✭ 4,265 (+3641.23%)
Mutual labels:  api-gateway, aws-lambda, lambda
Serverless Sharp
Serverless image optimizer for S3, Lambda, and Cloudfront
Stars: ✭ 102 (-10.53%)
Mutual labels:  api-gateway, aws-lambda, lambda
Terraform Sqs Lambda Trigger Example
Example on how to create a AWS Lambda triggered by SQS in Terraform
Stars: ✭ 31 (-72.81%)
Mutual labels:  aws-lambda, terraform, hcl
Zappa
Serverless Python
Stars: ✭ 224 (+96.49%)
Mutual labels:  api-gateway, aws-lambda, lambda
Aegis
Serverless Golang deploy tool and framework for AWS Lambda
Stars: ✭ 277 (+142.98%)
Mutual labels:  api-gateway, aws-lambda, lambda
Mangum
AWS Lambda & API Gateway support for ASGI
Stars: ✭ 475 (+316.67%)
Mutual labels:  api-gateway, aws-lambda, lambda
Apilogs
Easy logging and debugging for Amazon API Gateway and AWS Lambda Serverless APIs
Stars: ✭ 216 (+89.47%)
Mutual labels:  api-gateway, aws-lambda, lambda
Terraform Nextjs Plugin
A plugin to generate terraform configuration for Nextjs 8 and 9
Stars: ✭ 41 (-64.04%)
Mutual labels:  api-gateway, lambda, terraform
Corgi
AWS Lambda / API Gateway native, fast and simple web framework
Stars: ✭ 44 (-61.4%)
Mutual labels:  api-gateway, aws-lambda, lambda
Serverless Es Logs
A Serverless plugin to transport logs to ElasticSearch
Stars: ✭ 51 (-55.26%)
Mutual labels:  api-gateway, aws-lambda, lambda
hyperform
⚑ Lightweight serverless framework for NodeJS
Stars: ✭ 156 (+36.84%)
Mutual labels:  lambda, aws-lambda, api-gateway
super-serverless-sample
Backend serverless que simula o sistema de votação do BBB
Stars: ✭ 30 (-73.68%)
Mutual labels:  lambda, aws-lambda, api-gateway
Vandium Node
AWS Lambda framework for building functions using Node.js for API Gateway, IoT applications, and other AWS events.
Stars: ✭ 377 (+230.7%)
Mutual labels:  api-gateway, aws-lambda, lambda
shim
HTTP Handler shim for Go projects running on AWS Lambda
Stars: ✭ 64 (-43.86%)
Mutual labels:  lambda, aws-lambda, api-gateway
Up
Up focuses on deploying "vanilla" HTTP servers so there's nothing new to learn, just develop with your favorite existing frameworks such as Express, Koa, Django, Golang net/http or others.
Stars: ✭ 8,439 (+7302.63%)
Mutual labels:  api-gateway, aws-lambda, lambda
Zappa
Serverless Python
Stars: ✭ 11,859 (+10302.63%)
Mutual labels:  api-gateway, aws-lambda, lambda
Serverless Sinatra Sample
Demo code for running Ruby Sinatra on AWS Lambda
Stars: ✭ 195 (+71.05%)
Mutual labels:  api-gateway, aws-lambda, lambda
Ebs bckup
Stars: ✭ 32 (-71.93%)
Mutual labels:  lambda, terraform, hcl
Bastions On Demand
Create and destroy bastions on demand with Fargate.
Stars: ✭ 54 (-52.63%)
Mutual labels:  lambda, terraform, hcl

Hello (AWS) Lambda with Terraform

CircleCI

This project is an example of a Python (AWS) Lambda exposed with API Gateway, configured with Terraform. This demo project is related to the following blog post: A Tour of AWS Lambda.

Introduction

This demo project creates a /hello endpoint with two methods (GET and POST). Both methods are bound to a single file containing two handlers (a.k.a. lambda functions, one for each method). This is defined by a handler parameter. The code for each lambda function is written in Python (method names are just a convention):

def handler(event, context):
    return { "message": "Hello, World!" }

def post_handler(event, context):
    return { "message": "I should have created something..." }

The Terraform configuration relies on two modules: lambda and api_method. See the Terraform Modules section for further information. This configuration creates two lambda functions on AWS Lambda, a (deployed) REST API with a single endpoint and two HTTP methods on API Gateway, and takes care of the permissions and credentials. The figure below is an example of what you get in the API Gateway dashboard:

Getting started

You must have an AWS account. Next, you must install Terraform first.

Clone this repository, then run:

$ make bootstrap

Create a terraform.tfvars file with the content below. This step is optional as Terraform will ask you to fill in the different values, but it is convenient.

aws_account_id = "account-id"
aws_access_key = "access-key"
aws_secret_key = "secret-key"
aws_region     = "eu-west-1"

You are now ready to use Terraform!

$ terraform plan

If everything is OK, you can build the whole infrastructure:

$ terraform apply

You can destroy all the components by running:

$ terraform destroy

For more information, please read the Terraform documentation.

Terraform Modules

lambda

module "lambda" {
  source  = "github.com/TailorDev/hello-lambda/lambda"
  name    = "my-lambda"
  handler = "handler"
  runtime = "python2.7" # could be nodejs | nodejs4.3 | java8 | python2.7
  role    = "my-role"
}

Important: this module assumes that the source file, the lambda (in AWS), and the zip file have the same name. For example, we use hello_lambda in this project. The handler parameter distinguishes the different lambda functions that can be invoked.

api_method

module "hello_post" {
  source      = "github.com/TailorDev/hello-lambda/api_method"
  rest_api_id = "rest-api-id"
  resource_id = "resource-id"
  method      = "POST"
  path        = "resource-path"
  lambda      = "my-lambda"
  region      = "eu-west-1"
  account_id  = "account-id"
}

License

This project and its Terraform modules are released under the MIT License. See the bundled LICENSE file for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].