Import lambda package by running go get -u github.com/aws/aws-lambda-go/lambda. Make the handler available for remote procedure call by AWS lambda and utilizing lambda.start method as depicted in the image below:
Building – For Windows 10 users
- set GO111MODULE=on
- RUN go get -u github.com/aws/aws-lambda-go/cmd/build-lambda-zip
- set GOOS=linux
- set GOARCH=amd64
- set CGO_ENABLED=0
- RUN go build -o main main.go
- COPY main and PASTE in build-lambda-zip directory
- RUN build-lambda-zip.exe -o main.zip main
Assuming that the above steps were followed one should end up with a main.zip file. Browse to AWS lambda from AWS console, create function and upload the new zip file. Make sure that the code does not require any permissions that needs access to other AWS services.
Give it a try
Configure the test events and run a test.
The below shows a successful attempt where “finished” is returned from the code that we built above.