This example creates a lambda that does a simple ToUpper
on the string input and returns it.
To deploy your infrastructure, follow the below steps.
After cloning this repo, run these commands from the working directory:
-
Build the handler:
-
For developers on Linux and macOS:
make build
-
For developers on Windows:
-
Get the
build-lambda-zip
tool: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\handler handler\handler.go %USERPROFILE%\Go\bin\build-lambda-zip.exe -o handler\handler.zip handler\handler
-
-
-
Create a new Pulumi stack, which is an isolated deployment target for this example:
pulumi stack init
-
Set the required configuration variables for this program:
pulumi config set aws:region us-east-1
-
Execute the Pulumi program to create our lambda:
pulumi up
-
Call our lambda function from the aws cli:
aws lambda invoke \ --function-name $(pulumi stack output lambda) \ --region $(pulumi config get aws:region) \ --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 lambda. -
Afterwards, destroy your stack and remove it:
pulumi destroy --yes pulumi stack rm --yes