Skip to content

Commit

Permalink
Migrate to arm64 arch, provided.al2 runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
mbland committed Aug 27, 2023
1 parent 1234ab0 commit b235815
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 ./...
Expand Down
7 changes: 5 additions & 2 deletions template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit b235815

Please sign in to comment.