This is a minimal starting point for create a Lambda container go image.
-
Create a new repository from lambda-container-go-template By Clicking "Use this template".
-
Clone the repository to your workspace.
-
Write some code for your program.
-
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"}.
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.