From b235815778eef6dd8538b9ba434624dc9ccf7d6f Mon Sep 17 00:00:00 2001 From: Mike Bland Date: Sun, 27 Aug 2023 12:42:43 -0400 Subject: [PATCH] Migrate to arm64 arch, provided.al2 runtime The previous go1.x runtime is deprecated, per: - https://aws.amazon.com/blogs/compute/migrating-aws-lambda-functions-from-the-go1-x-runtime-to-the-custom-runtime-on-amazon-linux-2/ See also: - https://aws.amazon.com/blogs/aws/update-on-amazon-linux-ami-end-of-life/ - https://docs.aws.amazon.com/lambda/latest/dg/runtime-support-policy.html --- Makefile | 5 +++-- template.yml | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 3d6088e..cdee7f6 100644 --- a/Makefile +++ b/Makefile @@ -8,9 +8,10 @@ SHELL := /bin/bash # https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-build.html#examples-makefile-identifier # https://docs.aws.amazon.com/lambda/latest/dg/golang-package.html # https://github.com/aws-samples/sessions-with-aws-sam/tree/master/go-al2 +# https://aws.amazon.com/blogs/compute/migrating-aws-lambda-functions-from-the-go1-x-runtime-to-the-custom-runtime-on-amazon-linux-2/ build-Function: - GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-s -w" \ - -o $(ARTIFACTS_DIR)/elistman-lambda lambda/main.go + GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="-s -w" \ + -tags lambda.norpc -o $(ARTIFACTS_DIR)/bootstrap lambda/main.go static-checks: go vet -tags=all_tests ./... diff --git a/template.yml b/template.yml index 2f51d40..e3085ba 100644 --- a/template.yml +++ b/template.yml @@ -55,8 +55,11 @@ Resources: BuildMethod: makefile DependsOn: FunctionLogs Properties: - Handler: elistman-lambda - Runtime: go1.x + Handler: bootstrap + # https://aws.amazon.com/blogs/compute/migrating-aws-lambda-functions-from-the-go1-x-runtime-to-the-custom-runtime-on-amazon-linux-2/ + Runtime: provided.al2 + Architectures: + - "arm64" Description: Coordinates between the API Gateway, DynamoDB, SES, and SNS Timeout: 300 FunctionName: !Sub "${AWS::StackName}-function"