Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Pull request Compare This branch is 1 commit behind WajahatAliAbid:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Deploy Go on AWS Lambda

It is quite simple to deploy the go function on the AWS Lambda using Aws Lambda Go. I'll demonstrate the lambda function using a simple request as input for lambda and return Ok response for this example.


  1. Get the aws lambda tool using.

       go get -u
  2. Create your lambda function.

    // main.go
    package main
    import (
    type Request struct {
    	ID    float64 `json:"id"`
    	Value string  `json:"value"`
    type Response struct {
    	Message string `json:"message"`
    	Ok      bool   `json:"ok"`
    func Handler(request Request) (Response, error) {
    	return Response{
    		Message: fmt.Sprintf("Process Request ID %f", request.ID),
    		Ok:      true,
    	}, nil
    func main() {
    	// Make the handler available for Remote Procedure Call by AWS Lambda
  3. Build your lambda function for linux

    GOOS=linux go build -o main
  4. Set required permission for execution

    sudo chmod +x main
  5. Zip the build

    zip -9 main
  6. Upload to lambda and test using the following event argument.

    	"id": 123,
    	"value": "This is a test value"

    It gives us the following response.

      "message": "Process Request ID 123.000000",
      "ok": true

Further Reading

TLDR; The link to my medium article.

You can’t perform that action at this time.