Skip to content

Commit 0f4586c

Browse files
Use provided.al2 AWS Go Lambda runtime to fix build process (#1677)
## What? This PR updates this example to use the now required `provided.al2` AWS Go Lambda runtime, along with necessary related changes. ## Why? Running `pulumi up` in this example results in the following error: ``` InvalidParameterValueException: The runtime parameter of go1.x is no longer supported for creating or updating AWS Lambda functions. We recommend you use a supported runtime while creating or updating functions. ``` `go1.x` runtime Lambdas [must now be migrated](https://docs.aws.amazon.com/lambda/latest/dg/lambda-golang.html#golang-al1) to `provided.al2023` or `provided.al2` runtimes.
1 parent 05a82a0 commit 0f4586c

File tree

8 files changed

+39
-3947
lines changed

8 files changed

+39
-3947
lines changed

aws-go-lambda/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
build::
2-
GOOS=linux GOARCH=amd64 go build -o ./handler/handler ./handler/handler.go
3-
zip -j ./handler/handler.zip ./handler/handler
2+
GOOS=linux GOARCH=amd64 go build -o ./handler/bootstrap ./handler/handler.go
3+
zip -j ./handler/handler.zip ./handler/bootstrap

aws-go-lambda/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ After cloning this repo, run these commands from the working directory:
4141
set GOOS=linux
4242
set GOARCH=amd64
4343
set CGO_ENABLED=0
44-
go build -o handler\handler handler\handler.go
45-
%USERPROFILE%\Go\bin\build-lambda-zip.exe -o handler\handler.zip handler\handler
44+
go build -o handler\bootstrap handler\handler.go
45+
%USERPROFILE%\Go\bin\build-lambda-zip.exe -o handler\handler.zip handler\bootstrap
4646
```
4747

4848

aws-go-lambda/go.mod

+13-954
Large diffs are not rendered by default.

aws-go-lambda/go.sum

+20-2,987
Large diffs are not rendered by default.

aws-go-lambda/handler/bootstrap

9.53 MB
Binary file not shown.

aws-go-lambda/handler/handler

-5.44 MB
Binary file not shown.

aws-go-lambda/handler/handler.zip

2.43 MB
Binary file not shown.

aws-go-lambda/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ func main() {
4848

4949
// Set arguments for constructing the function resource.
5050
args := &lambda.FunctionArgs{
51-
Handler: pulumi.String("handler"),
51+
Handler: pulumi.String("bootstrap"),
5252
Role: role.Arn,
53-
Runtime: pulumi.String("go1.x"),
53+
Runtime: pulumi.String("provided.al2"),
5454
Code: pulumi.NewFileArchive("./handler/handler.zip"),
5555
}
5656

0 commit comments

Comments
 (0)