From 554602fee5016b4ae5513473502eb0313f67b148 Mon Sep 17 00:00:00 2001 From: Eneko Alonso Date: Fri, 29 May 2020 16:00:42 -0700 Subject: [PATCH 1/4] S3 bucket name must be updated before deploying --- Examples/LambdaFunctions/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Examples/LambdaFunctions/README.md b/Examples/LambdaFunctions/README.md index dda328a9..b6a880d6 100644 --- a/Examples/LambdaFunctions/README.md +++ b/Examples/LambdaFunctions/README.md @@ -18,7 +18,9 @@ Steps to deploy this sample to AWS Lambda using the AWS CLI: ./scripts/deploy.sh ``` - Note: This script assumes you have AWS CLI installed and credentials setup in `~/.aws/credentials`. + Notes: + - This script assumes you have AWS CLI installed and credentials setup in `~/.aws/credentials`. + - Update `s3_bucket=swift-lambda-test` in `deploy.sh` before running (AWS S3 buckets require a unique global name) ### Deployment instructions using AWS SAM (Serverless Application Model) From 2b3307d78d73e141b4b1b586aaa0714f1a598edb Mon Sep 17 00:00:00 2001 From: Eneko Alonso Date: Sat, 6 Jun 2020 08:58:05 -0700 Subject: [PATCH 2/4] Document configuration variables in deploy.sh --- Examples/LambdaFunctions/scripts/deploy.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Examples/LambdaFunctions/scripts/deploy.sh b/Examples/LambdaFunctions/scripts/deploy.sh index b234ee6a..2f7e0a2c 100755 --- a/Examples/LambdaFunctions/scripts/deploy.sh +++ b/Examples/LambdaFunctions/scripts/deploy.sh @@ -15,8 +15,14 @@ set -eu +# Lambda Function name (must exist in AWS Lambda) lambda_name=SwiftSample + +# S3 bucket name to upload zip file (must exist in AWS S3) s3_bucket=swift-lambda-test + + + executables=( $(swift package dump-package | sed -e 's|: null|: ""|g' | jq '.products[] | (select(.type.executable)) | .name' | sed -e 's|"||g') ) if [[ ${#executables[@]} = 0 ]]; then From 3a2b4afcf411a3a63596915e9bd96e1dffe452e0 Mon Sep 17 00:00:00 2001 From: Eneko Alonso Date: Sat, 6 Jun 2020 09:00:17 -0700 Subject: [PATCH 3/4] Update notes for first time using `deploy.sh` --- Examples/LambdaFunctions/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Examples/LambdaFunctions/README.md b/Examples/LambdaFunctions/README.md index 68431976..9d42790f 100644 --- a/Examples/LambdaFunctions/README.md +++ b/Examples/LambdaFunctions/README.md @@ -22,7 +22,9 @@ Steps to deploy this sample to AWS Lambda using the AWS CLI: Notes: - This script assumes you have AWS CLI installed and credentials setup in `~/.aws/credentials`. + - The default lambda function name is `SwiftSample`. You can specify a different one updating `lambda_name` in `deploy.sh` - Update `s3_bucket=swift-lambda-test` in `deploy.sh` before running (AWS S3 buckets require a unique global name) + - Both lambda function and S3 bucket must exist before deploying for the first time. ### Deployment instructions using AWS SAM (Serverless Application Model) From 44e96b0f328b31f4ee9af5a80e0f9fc376b70dc6 Mon Sep 17 00:00:00 2001 From: Eneko Alonso Date: Sat, 6 Jun 2020 18:16:45 -0700 Subject: [PATCH 4/4] PR feedback --- Examples/LambdaFunctions/scripts/deploy.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/Examples/LambdaFunctions/scripts/deploy.sh b/Examples/LambdaFunctions/scripts/deploy.sh index 2f7e0a2c..19db4a25 100755 --- a/Examples/LambdaFunctions/scripts/deploy.sh +++ b/Examples/LambdaFunctions/scripts/deploy.sh @@ -21,8 +21,6 @@ lambda_name=SwiftSample # S3 bucket name to upload zip file (must exist in AWS S3) s3_bucket=swift-lambda-test - - executables=( $(swift package dump-package | sed -e 's|: null|: ""|g' | jq '.products[] | (select(.type.executable)) | .name' | sed -e 's|"||g') ) if [[ ${#executables[@]} = 0 ]]; then