You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 19, 2024. It is now read-only.
aws iam create-role --role-name $(IAM_ROLE_NAME) --description "Allows Lambda functions to call AWS services on your behalf." --assume-role-policy-document '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["sts:AssumeRole"],"Principal":{"Service":["lambda.amazonaws.com"]}}]}' --profile $(AWS_PROFILE)||true
148
165
aws iam attach-role-policy --role-name $(IAM_ROLE_NAME) --policy-arn "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" --profile $(AWS_PROFILE)||true
149
166
$(eval IAM_ROLE_ARN := $(shell aws iam list-roles --query "Roles[? RoleName == '$(IAM_ROLE_NAME)'].Arn" --output text --profile $(AWS_PROFILE)))
Copy file name to clipboardExpand all lines: README.md
+37-6Lines changed: 37 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -171,6 +171,8 @@ make invoke_lambda \
171
171
| Key | Usage | Default |
172
172
| --- | --- | --- |
173
173
| AWS_PROFILE | An AWS AIM profile you create to authenticate to your account. | default |
174
+
| IAM_ROLE_NAME | The execution role created that will be assumed by the Lambda. | lambda_sprinter_basic_execution |
175
+
| AWS_BUCKET | The AWS S3 bucket where the layer and lambdas zip files get uploaded. | aws-lambda-swift-sprinter |
174
176
| SWIFT_VERSION | Version of Swift used / Matches Dockerfile location too from `docker/` folder. | 5.1 |
175
177
| LAYER_VERSION | Version of the Swift layer that will be created and uploaded for the Lambda to run on. | 5-1 |
176
178
| SWIFT_EXECUTABLE | Name of the binary file. | HelloWorld |
@@ -215,6 +217,8 @@ There are many ways to achieve a lambda deployment (AWS Console, SAM, CloudForma
215
217
- an AWS account for test purpose.
216
218
- aws cli: Install the aws cli. Here the [instructions](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html).
217
219
220
+
- If you want to deploy your lambdas and layers using S3 you need to make sure the bucket in the Makefile already exists. If it doesn't you can create it using the command `make create_s3_bucket` which will use the value of the variable `AWS_BUCKET` as a name.
221
+
218
222
- if your AWS account it doesn't have admin priviledges:
219
223
- Review(*) the policy contained in the file **LambdaDeployerPolicyExample.json**
220
224
- Attach the policy to your user. [Here](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_manage-attach-detach.html) is the official documentation.
@@ -224,17 +228,36 @@ It would be better to restrict the policy to the function and layer you want to
224
228
It's suggested to test the following scripts before using in production.
225
229
226
230
#### 1) Upload the Lambda layer
227
-
Create a new lambda layer using the `swift-lambda-runtime.zip` file:
231
+
Create a new lambda layer using the `swift-lambda-runtime.zip` file. This step is required once, however you are free to run it if you need to update your layer.
232
+
233
+
##### Upload the Lambda using S3
228
234
229
235
```console
230
-
make upload_lambda_layer
236
+
make upload_lambda_layer_with_s3
231
237
```
232
238
233
-
This step is required once, or if you need to update the layer.
239
+
Datetime based versions are created and uploaded to S3 every time your version is created.
240
+
241
+
##### Upload the Lambda directly
242
+
243
+
```console
244
+
make upload_lambda_layer
245
+
```
234
246
235
247
#### 2) Create the Lambda
236
248
237
-
Create a new lambda, this might take a few minutes:
249
+
You can create a new lambda which might take a few minutes using one of the options below:
250
+
251
+
##### Create the Lambda using S3
252
+
253
+
```console
254
+
make create_lambda_with_s3
255
+
```
256
+
257
+
Datetime based versions are created and uploaded to S3 every time your version is created.
258
+
259
+
##### Create the Lambda directly
260
+
238
261
```console
239
262
make create_lambda
240
263
```
@@ -248,7 +271,7 @@ The lambda is created with the following parameters:
248
271
- HelloWorld.helloWorld
249
272
- role: `"$(IAM_ROLE_ARN)"`
250
273
- a new role will be created with the name: `lambda_sprinter_basic_execution`
0 commit comments