set GO111MODULE=on
go.exe get -u github.com/aws/aws-lambda-go/cmd/build-lambda-zip
Use the tool from your GOPATH:
set GOOS=linux
set GOARCH=amd64
set CGO_ENABLED=0
go build -o handler\bootstrap handler\handler.go
%USERPROFILE%\Go\bin\build-lambda-zip.exe -o handler\handler.zip handler\bootstrap
Create a new stack, which is an isolated deployment target for this example:
pulumi stack init
Install dependencies:
go mod download
Set the AWS region to deploy into:
pulumi config set aws:region us-east-1
Deploy the stack:
pulumi up
Call the Lambda function from the AWS CLI with "foo" as the payload:
aws lambda invoke \
--function-name $(pulumi stack output lambda) \
--region $(pulumi config get aws:region) \
--cli-binary-format raw-in-base64-out \
--payload '"foo"' \
output.json
cat output.json # view the output file with your tool of choice
# "FOO"
From there, feel free to experiment. Simply making edits, rebuilding your handler, and running pulumi up will update your function.
Cleaning up
Once you're finished experimenting, tear down your stack's resources by destroying and removing it: