aws-go-lambda

command module
v0.0.0-...-7801cb1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

README

Deploy this example with Pulumi Deploy this example with Pulumi

AWS Golang Lambda

This example creates an AWS Lambda function that does a simple ToUpper on the string input and returns it.

Deploying the App

To deploy your infrastructure, follow the below steps.

Prerequisites
  1. Install Pulumi
  2. Configure AWS Credentials
  3. Clone aws-go-lambda
Steps

After cloning this repo, run these commands from the working directory:

  1. 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\bootstrap handler\handler.go
        %USERPROFILE%\Go\bin\build-lambda-zip.exe -o handler\handler.zip handler\bootstrap
        
  2. Create a new Pulumi stack, which is an isolated deployment target for this example:

    pulumi stack init
    
  3. Set the required configuration variables for this program:

    pulumi config set aws:region us-east-1
    
  4. Execute the Pulumi program to create our lambda:

    pulumi up
    
  5. Call our 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"
    
  6. From there, feel free to experiment. Simply making edits, rebuilding your handler, and running pulumi up will update your function.

  7. Afterwards, destroy your stack and remove it:

    pulumi destroy --yes
    pulumi stack rm --yes
    

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL