To begin creating the Lambda function, follow the given steps:
- Create a new project with the following structure:
- We will use the easiest Hello world example. The function folder contains a Go-based Lambda function that displays a simple message:
package mainimport "github.com/aws/aws-lambda-go/lambda"func handler() (string, error) { return "First Lambda function with Terraform", nil}func main() { lambda.Start(handler)}
- You can build a Linux-based binary and generate a deployment package with the following commands:
GOOS=linux go build -o main main.gozip deployment.zip main
- Now that the function code is ...