From b361a9b3d429a9df200029cd9b75f97013304a38 Mon Sep 17 00:00:00 2001 From: Mathias Lafeldt Date: Fri, 20 Aug 2021 20:33:59 +0200 Subject: [PATCH] Switch to Amazon Linux 2 Lambda runtime --- Makefile | 11 +++++++++-- index.ts | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 2dd90a7..93053be 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,13 @@ lint: test: go test -v -cover ./... +# https://github.com/messense/homebrew-macos-cross-toolchains +TARGET := x86_64-unknown-linux-gnu +export CC_x86_64_unknown_linux_gnu = $(TARGET)-gcc +export CXX_x86_64_unknown_linux_gnu = $(TARGET)-g++ +export AR_x86_64_unknown_linux_gnu = $(TARGET)-ar +export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER = $(TARGET)-gcc + RUST_FUNCS := $(subst /,,$(dir $(wildcard */lambda.rs))) rust_funcs := $(RUST_FUNCS:%=rust-%) @@ -40,6 +47,6 @@ rust_funcs := $(RUST_FUNCS:%=rust-%) rust: $(rust_funcs) $(rust_funcs): - RUSTFLAGS="-C link-arg=-s" cargo build --release --target x86_64-unknown-linux-musl --bin $(@:rust-%=%) + RUSTFLAGS="-C link-arg=-s" cargo build --release --target $(TARGET) --bin $(@:rust-%=%) mkdir -p bin/$(@:rust-%=%) - cp -f target/x86_64-unknown-linux-musl/release/$(@:rust-%=%) bin/$(@:rust-%=%)/bootstrap + cp -f target/$(TARGET)/release/$(@:rust-%=%) bin/$(@:rust-%=%)/bootstrap diff --git a/index.ts b/index.ts index faab76f..dcc22e3 100644 --- a/index.ts +++ b/index.ts @@ -62,7 +62,7 @@ export class DilbertFeedStack extends cdk.Stack { functionName: `${id}-heartbeat`, code: lambda.Code.fromAsset('bin/heartbeat'), handler: 'bootstrap', - runtime: lambda.Runtime.PROVIDED, + runtime: lambda.Runtime.PROVIDED_AL2, memorySize: 128, timeout: cdk.Duration.seconds(10), logRetention: logs.RetentionDays.ONE_MONTH,