mathisve / docker-on-lambda

AWS Lambda with docker containers!

Home Page:https://youtu.be/EYqFbRsh_RM

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Golang Docker

docker-on-lambda

This repository contains the project files of this video. Read this article for a more in depth text-based tutorial.

commands

Golang

go mod init lambda-function
go mod tidy

ECR

optionally you can create the container repository via the AWS Console

aws ecr create-repository --repository-name lambda-function

Base docker image building and pushing

docker build -t lambda-function:latest .

aws ecr get-login-password --region {region} | docker login --username AWS --password-stdin {account-number}.dkr.ecr.{region}.amazonaws.com

docker tag lambda-function:latest {account-number}.dkr.ecr.{region}.amazonaws.com/lambda-function:latest

docker push {account-number}.dkr.ecr.{region}.amazonaws.com/lambda-function:latest

RIE (Runtime Interface Emulator)

mkdir -p ~/.aws-lambda-rie && curl -Lo ~/.aws-lambda-rie/aws-lambda-rie \
https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie \
&& chmod +x ~/.aws-lambda-rie/aws-lambda-rie

docker run -d -v ~/.aws-lambda-rie:/aws-lambda --entrypoint /aws-lambda/aws-lambda-rie  -p 9000:8080 lambda-function:latest /main

curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}'

About

AWS Lambda with docker containers!

https://youtu.be/EYqFbRsh_RM


Languages

Language:Go 53.9%Language:Dockerfile 46.1%