/lambda-container-go-template

A minimal template for AWS Lambda Container Go

Primary LanguageGoApache License 2.0Apache-2.0

lambda-container-go-template

This is a minimal starting point for create a Lambda container go image.

Usage

  1. Create a new repository from lambda-container-go-template By Clicking "Use this template".

  2. Clone the repository to your workspace.

  3. Write some code for your program.

  4. Build the container image and run it to make sure the program works.

# Build the Docker image
$ docker build -t hello-lambda-container-go .

# Run the Container
$ docker run -it -p 9000:8080  hello-lambda-container-go:latest

# Test a function invocation with cURL. Here, I am passing an JSON payload.
$ curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"name":"world"}'

If you haven't modified the code, you'll see a response that says {"message":"Hello, world"}.

so what now?

Bring in your own code and start writing programs.

When you're done writing the code, build your container image and upload it to the AWS ECR Repository.

Then Create a Lambda function with container image option in AWS Lambda Console.

If you prefer, you can start with the SAM created by AWS, or the serverless framework popular in the community.

references