Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit 348d7be

Browse files
author
CodingNagger
committed
Adding lambda layer upload via S3
1 parent 4a4e13d commit 348d7be

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ LAYER_ZIP=swift-lambda-runtime-$(LAYER_VERSION).zip
3737
LAMBDA_BUILD_PATH=./.build
3838
IAM_ROLE_NAME=lambda_sprinter_basic_execution
3939
DATETIME=$(shell date +'%y%m%d-%H%M%S')
40+
AWS_LAYER_BUCKET=aws-lambda-swift-sprinter-layers
4041

4142
# use this for local development
4243
MOUNT_ROOT=$(shell pwd)/..
@@ -140,6 +141,14 @@ package_layer: create_build_directory clean_layer
140141
upload_build_to_s3: create_lambda_s3_key
141142
aws s3 cp --acl public-read "$(LAMBDA_BUILD_PATH)/$(LAMBDA_ZIP)" s3://$(AWS_BUCKET)/$(LAMBDA_S3_UPLOAD_PATH)/$(LAMBDA_ZIP) --profile $(AWS_PROFILE)
142143

144+
create_layer_s3_key:
145+
$(eval LAYER_S3_UPLOAD_PATH := $(SWIFT_LAMBDA_LIBRARY)/$(DATETIME))
146+
147+
upload_lambda_layer_with_s3: create_layer_s3_key
148+
aws s3 cp --acl public-read "$(LAMBDA_BUILD_PATH)/$(LAYER_ZIP)" s3://$(AWS_LAYER_BUCKET)/$(LAYER_S3_UPLOAD_PATH)/$(LAYER_ZIP) --profile $(AWS_PROFILE)
149+
aws lambda publish-layer-version --layer-name $(SWIFT_LAMBDA_LIBRARY) --description "AWS Custom Runtime Swift Shared Libraries with NIO" --content "S3Bucket=$(AWS_LAYER_BUCKET),S3Key=$(LAYER_S3_UPLOAD_PATH)/$(LAYER_ZIP)" --output text --query LayerVersionArn --profile $(AWS_PROFILE) > $(LAMBDA_BUILD_PATH)/$(SWIFT_LAMBDA_LIBRARY)-arn.txt
150+
cat $(LAMBDA_BUILD_PATH)/$(SWIFT_LAMBDA_LIBRARY)-arn.txt
151+
143152
upload_lambda_layer:
144153
aws lambda publish-layer-version --layer-name $(SWIFT_LAMBDA_LIBRARY) --description "AWS Custom Runtime Swift Shared Libraries with NIO" --zip-file fileb://$(LAMBDA_BUILD_PATH)/$(LAYER_ZIP) --output text --query LayerVersionArn --profile $(AWS_PROFILE) > $(LAMBDA_BUILD_PATH)/$(SWIFT_LAMBDA_LIBRARY)-arn.txt
145154
cat $(LAMBDA_BUILD_PATH)/$(SWIFT_LAMBDA_LIBRARY)-arn.txt

0 commit comments

Comments
 (0)