A Lambda function built with SAM (Serverless Application Module)

AWS SAM Lambda Function

© Israel Pereira Tavares da Silva

The AWS Serverless Application Model (SAM) is an open-source framework for building serverless applications. It provides shorthand syntax to express functions, APIs, databases, and event source mappings. With just a few lines per resource, you can define the application you want and model it using YAML. During deployment, SAM transforms and expands the SAM syntax into AWS CloudFormation syntax, enabling you to build serverless applications faster.

Setup

Clone the project:

> git clone https://github.com/israelptdasilva/AWS-SAM-Lambda
> cd AWS-SAM-Lambda

Conda

You may want to use conda or another environment manager to have a separate environment to install awscli and aws-sam-cli.

> conda create -n lambda
> conda activate lambda
> conda install -c conda-forge awscli
> pip install aws-sam-cli

After installing awscli and aws-sam-cli you'll need to configure awscli with your access keys:

> aws configure

Docker

It is necessay to have Docker installed if you want o test the lambda function locally.

Basic SAM Usage

Run Locally

Executing the command bellow builds a docker image (golang) in which the function will be ran in.

> sam local invoke GoLambdaFunction -e event.json

Validate & Deploy

A successfull deploy will create a S3 bucket with the lambda function, the lambda function itself, a cloudformation stack and the necessay roles.

> sam validate
> sam build
> sam deploy --guided (or just sam deploy)

Delete Stack

Delete the deployed stack if you don't want to keep it around anymore.

> sam delete

Quem florestas e mares foi rasgando e entre raios, pedradas e metralhas, ficou gemendo, mas ficou sonhando! (João da Cruz e Sousa)

Owner
Israel P. T. da Silva
Software Developer
Israel P. T. da Silva
Similar Resources

Lambda Extension for iamlive

iamlive Lambda Extension The iamlive Lambda Extension helps generate a least-privilege IAM policy by monitoring the AWS calls made within the Lambda e

Dec 17, 2022

Go lambda ffprobe executable

Execute SAM locally $ cd build $ GOARCH=amd64 GOOS=linux go build ../main.go $ c

Dec 18, 2021

Lambda microservice triggered by API Gateway to lookup ip address, domain or hash (md5, sha1, sha256)

lambdaGatewayAPI Lambda microservice triggered by API Gateway to lookup ip address, domain or hash (md5, sha1, sha256) How to deploy Build the lambdaG

Dec 21, 2021

Go-xrayprofile - Selective profiling of AWS Lambda functions

go-xrayprofile AWS X-Ray is handy for understanding the overall performance of y

May 18, 2022

Startpage - Lambda for reading rss feeds and generating a minimal start page for a static site

startpage generate a startpage of links for a static site hosted via AWS What It

Sep 6, 2022

Mrrobot - A simple greetings bot for Slack that uses events api and hosted on AWS Lambda

Mr. Robot a greeter bot for your slack community build_docker

Aug 21, 2022

Serverless SOAR (Security Orchestration, Automation and Response) framework for automatic inspection and evaluation of security alert

Serverless SOAR (Security Orchestration, Automation and Response) framework for automatic inspection and evaluation of security alert

DeepAlert DeepAlert is a serverless framework for automatic response of security alert. Overview DeepAlert receives a security alert that is event of

Jan 3, 2023

A serverless teeny-tiny version of Diomedes which sends alerts to Telegram. Written in Go.

A serverless teeny-tiny version of Diomedes which sends alerts to Telegram. Written in Go.

diomedes-search Get a notification on Telegram whenever your movie opens bookings in a theater of your choice. Pre-requisites Install AWS CLI (v2) by

Oct 11, 2022

Una prueba técnica: Servicio Golang REST API local, sobre Docker, gRPC, AWS Serverless y sobre Kubernetes en AWS EC2

Una prueba técnica: Servicio Golang REST API local, sobre Docker, gRPC, AWS Serverless y sobre Kubernetes en AWS EC2

May 7, 2022
Api-waf-example-cdk - Demo using sam to drive a CDK serverless api

CDK SAM Demo Demo using sam to drive a CDK serverless api Stack Setup go build -

Feb 5, 2022
Simple CRUD API written in Go, built using AWS SAM tool and using the AWS' infrastructure.
Simple CRUD API written in Go, built using AWS SAM tool and using the AWS' infrastructure.

tutor-pet API Simple CRUD API written in Go, built using AWS SAM tool and using the AWS' infrastructure. Macro architecture: Code architecture: Pre-Re

Aug 17, 2022
lambda-go-api-proxy makes it easy to port APIs written with Go frameworks such as Gin to AWS Lambda and Amazon API Gateway.

aws-lambda-go-api-proxy makes it easy to run Golang APIs written with frameworks such as Gin with AWS Lambda and Amazon API Gateway.

Jan 6, 2023
This repository shows how can we use `AWS Lambda` to build serverless applications in golang.

Serverless Api in Go with AWS Lambda Here we are going to use AWS Lambda to build serverless applications in golang. Prerequisites You’ll need an AWS

Nov 3, 2021
Prueba de concepto: Boletia, una aplicación para venta de boletos, basada en microservicios event-driven. Desarrollada sobre AWS Serverless: Api Gateway, Lambda, DynamoDB, DynamoDB Streams
Prueba de concepto: Boletia, una aplicación para venta de boletos, basada en microservicios event-driven. Desarrollada sobre AWS Serverless: Api Gateway, Lambda, DynamoDB, DynamoDB Streams

Prueba de concepto: Boletia, una aplicación para venta de boletos, basada en microservicios event-driven. Desarrollada sobre AWS Serverless: Api Gatew

May 7, 2022
Go-serverless-eth-event-listener - Go serverless, ethereum contract event listener with a sample contract

go-serverless-eth-event-listener This repository is for showing how to listen sm

May 19, 2022
Lambda service function

openfaas-lambda These are sets of example that i've used when migrating aws lambda to openfaas platform. A part of documenting on how it works, I'm op

Oct 26, 2022
A serverless sync server for Santa, built on AWS

Rudolph Rudolph is the control server counterpart of Santa, and is used to rapidly deploy configurations to Santa agents. Rudolph is built in Amazon W

Dec 5, 2022
Sample serverless application written in Golang
Sample serverless application written in Golang

Serverless Go Demo This is a simple serverless application built in Golang. It consists of an API Gateway backed by four Lambda functions and a Dynamo

Dec 15, 2022
Lambda stack to turn off and destroy all resources from your personal AWS Account to avoid billing surprises
Lambda stack to turn off and destroy all resources from your personal AWS Account to avoid billing surprises

AWS, Turn off my Account, please Lambda stack to turn off and destroy all resources from your personal AWS Account to avoid billing surprises Resource

Oct 25, 2022