1
- #! /bin/sh
1
+ #! /bin/bash
2
+ # #===----------------------------------------------------------------------===##
3
+ # #
4
+ # # This source file is part of the SwiftAWSLambdaRuntime open source project
5
+ # #
6
+ # # Copyright (c) 2017-2024 Apple Inc. and the SwiftAWSLambdaRuntime project authors
7
+ # # Licensed under Apache License v2.0
8
+ # #
9
+ # # See LICENSE.txt for license information
10
+ # # See CONTRIBUTORS.txt for the list of SwiftAWSLambdaRuntime project authors
11
+ # #
12
+ # # SPDX-License-Identifier: Apache-2.0
13
+ # #
14
+ # #===----------------------------------------------------------------------===##
2
15
3
16
# Stop the script execution if an error occurs
4
17
set -e -o pipefail
@@ -19,7 +32,7 @@ You must have an AWS account and know an AWS access key, secret access key, and
19
32
These values are read from '~/.aws/credentials'.
20
33
"
21
34
22
- read -p " Are you ready to create your first Lambda function in Swift? [y/n] " continue
35
+ read -r - p " Are you ready to create your first Lambda function in Swift? [y/n] " continue
23
36
if [[ ! $continue =~ ^[Yy]$ ]]; then
24
37
echo " OK, try again later when you feel ready"
25
38
exit 1
@@ -84,7 +97,8 @@ echo "🚀 Deploy to AWS Lambda"
84
97
85
98
# retrieve your AWS Account ID
86
99
echo " 🔑 Retrieve your AWS Account ID"
87
- export AWS_ACCOUNT_ID=$( aws sts get-caller-identity --query Account --output text)
100
+ AWS_ACCOUNT_ID=$( aws sts get-caller-identity --query Account --output text)
101
+ export AWS_ACCOUNT_ID
88
102
89
103
# Check if the role already exists
90
104
echo " 🔍 Check if a Lambda execution IAM role already exists"
@@ -97,8 +111,8 @@ aws lambda create-function \
97
111
--zip-file fileb://.build/plugins/AWSLambdaPackager/outputs/AWSLambdaPackager/MyLambda/MyLambda.zip \
98
112
--runtime provided.al2 \
99
113
--handler provided \
100
- --architectures $( uname -m) \
101
- --role arn:aws:iam::${AWS_ACCOUNT_ID} :role/lambda_basic_execution > /dev/null 2>&1
114
+ --architectures " $( uname -m) " \
115
+ --role arn:aws:iam::" ${AWS_ACCOUNT_ID} " :role/lambda_basic_execution > /dev/null 2>&1
102
116
103
117
echo " ⏰ Waiting 10 secs for the Lambda function to be ready..."
104
118
sleep 10
0 commit comments