Created example for AWS Lambda in Go
ADD
aws-go-lambda/Gopkg.toml
+# Gopkg.toml example
+#
+# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
+# for detailed Gopkg.toml documentation.
+#
+# required = ["github.com/user/thing/cmd/thing"]
+# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
+#
+# [[constraint]]
+# name = "github.com/user/project"
+# version = "1.0.0"
+#
+# [[constraint]]
+# name = "github.com/user/project2"
+# branch = "dev"
+# source = "github.com/myfork/project2"
+#
+# [[override]]
+# name = "github.com/x/y"
+# version = "2.4.0"
+#
+# [prune]
+# non-go = false
+# go-tests = true
+# unused-packages = true
+
+
+[[constraint]]
+ name = "github.com/pulumi/pulumi"
+ version = "1.9.1"
+
+[[constraint]]
+ name = "github.com/pulumi/pulumi-aws"
+ version = "1.20.0"
+
+[prune]
+ go-tests = true
+ unused-packages = true

ADD
aws-go-lambda/Makefile
+build::
+ GOOS=linux GOARCH=amd64 go build -o ./handler/handler ./handler/handler.go
+ zip -j ./handler/handler.zip ./handler/handler
+ go build -o go-lambda main.go
\ No newline at end of file

ADD
aws-go-lambda/Pulumi.yaml
+name: go-lambda
+runtime: go
+description: Basic example of an AWS lambda
+template:
+ config:
+ aws:region:
+ description: The AWS region to deploy into
+ default: us-east-1

ADD
aws-go-lambda/README.md
+# AWS Golang Lambda
+This example creates a lambda 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](https://www.pulumi.com/docs/get-started/install/)
+2. [Configure AWS Credentials](https://www.pulumi.com/docs/intro/cloud-providers/aws/setup/)
+3. [Clone aws-go-lambda](https://github.com/aws/aws-lambda-go)
+
+### Steps
+
+After cloning this repo, run these commands from the working directory:
+
+1. Build the go files:
+
+```bash
+make build
+```
+
+2. Create a new Pulumi stack, which is an isolated deployment target for this example:
+
+```bash
+pulumi stack init
+```
+
+3. Set the required configuration variables for this program:
+```bash
+pulumi config set aws:region us-east-1
+```
+
+4. Execute the Pulumi program to create our lambda:
+
+```bash
+pulumi up
+```
+
+5. Call our lambda function from the aws cli
+
+```bash
+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"
+```
+
+6. From there, feel free to experiment. Simply making edits and running `make build` then `pulumi up` will update your lambda.
+
+7. Afterwards, destroy your stack and remove it:
+
+```bash
+pulumi destroy --yes
+pulumi stack rm --yes
+```
\ No newline at end of file

ADD
aws-go-lambda/handler/handler.go
+package main
+
+import (
+ "strings"
+
+ "github.com/aws/aws-lambda-go/lambda"
+)
+
+// handler is a simple function that takes a string and does a ToUpper.
+func handler(str string) (string, error) {
+ return strings.ToUpper(str), nil
+}
+
+func main() {
+ lambda.Start(handler)
+}

ADD
aws-go-lambda/main.go
+package main
+
+import (
+ "github.com/pulumi/pulumi-aws/sdk/go/aws/iam"
+ "github.com/pulumi/pulumi-aws/sdk/go/aws/lambda"
+ "github.com/pulumi/pulumi/sdk/go/pulumi"
+)
+
+func main() {
+ pulumi.Run(func(ctx *pulumi.Context) error {
+ // Create an IAM role.
+ role, err := iam.NewRole(ctx, "task-exec-role", &iam.RoleArgs{
+ AssumeRolePolicy: pulumi.String(`{
+ "Version": "2012-10-17",
+ "Statement": [{
+ "Sid": "",
+ "Effect": "Allow",
+ "Principal": {
+ "Service": "lambda.amazonaws.com"
+ },
+ "Action": "sts:AssumeRole"
+ }]
+ }`),
+ })
+ if err != nil {
+ return err
+ }
+
+ // Set arguments for constructing the function resource.
+ args := &lambda.FunctionArgs{
+ Handler: pulumi.String("handler"),
+ Role: role.Arn,
+ Runtime: pulumi.String("go1.x"),
+ Code: pulumi.NewFileArchive("./handler/handler.zip"),
+ }
+
+ // Create the lambda using the args.
+ function, err := lambda.NewFunction(ctx, "basicLambda", args)
+ if err != nil {
+ return err
+ }
+
+ // Export the lambda ARN.
+ ctx.Export("lambda", function.Arn)
+
+ return nil
+ })
+}

Created example for AWS Lambda in Go (#553)