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

Commit 690f453

Browse files
Merge pull request #13 from CodingNagger/feature/nuke
Nuclear option
2 parents 60dc09b + b560bf4 commit 690f453

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,17 @@ invoke_lambda:
190190
create_s3_bucket:
191191
aws s3 mb "s3://$(AWS_BUCKET)" --profile $(AWS_PROFILE)
192192

193+
delete_s3_bucket:
194+
aws s3 ls "s3://$(AWS_BUCKET)" 2>/dev/null >/dev/null && aws s3 rb "s3://$(AWS_BUCKET)" --force
195+
196+
delete_layer:
197+
aws lambda list-layer-versions --layer-name nio-swift-lambda-runtime-5-1 --output text | \
198+
awk '{ print $$NF }' | \
199+
xargs aws lambda delete-layer-version --layer-name $(SWIFT_LAMBDA_LIBRARY) --version-number
200+
201+
nuke: clean_layer clean_lambda delete_layer
202+
-aws lambda get-function --function-name $(LAMBDA_FUNCTION_NAME) 2>/dev/null >/dev/null && aws lambda delete-function --function-name $(LAMBDA_FUNCTION_NAME)
203+
193204
#quick commands - no clean
194205
quick_build_lambda: build_lambda create_build_directory
195206
zip -r -j $(LAMBDA_BUILD_PATH)/$(LAMBDA_ZIP) $(SWIFT_PROJECT_PATH)/.build/$(SWIFT_CONFIGURATION)/$(SWIFT_EXECUTABLE)

README.md

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ Steps:
212212

213213
There are many ways to achieve a lambda deployment (AWS Console, SAM, CloudFormation ...), please refer to the latest [AWS Lambda documentation](https://docs.aws.amazon.com/lambda/latest/dg/welcome.html) to know more.
214214

215-
#### Requirements
215+
## Requirements
216216

217217
- an AWS account for test purpose.
218218
- aws cli: Install the aws cli. Here the [instructions](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html).
@@ -244,7 +244,7 @@ Datetime based versions are created and uploaded to S3 every time your version i
244244
make upload_lambda_layer
245245
```
246246

247-
#### 2) Create the Lambda
247+
### 2) Create the Lambda
248248

249249
You can create a new lambda which might take a few minutes using one of the options below:
250250

@@ -277,7 +277,7 @@ The lambda is created with the following parameters:
277277

278278
This step is required once, if you need to update the lambda use the step 5.
279279

280-
#### 4) Invoke the Lambda
280+
### 4) Invoke the Lambda
281281
Now the lambda function is ready for testing. The following command invokes the lambda with using the file **event.json** contained in the project folder.
282282

283283
```console
@@ -301,7 +301,7 @@ Note:
301301

302302
The lambda invocation may require some policy to access other AWS Resources. Check the `S3Test` example to know more.
303303

304-
#### 5) Update the Lambda (optional)
304+
### 5) Update the Lambda (optional)
305305

306306
If needed, you will also be able to update your Lambda using one of the commands below:
307307

@@ -317,6 +317,24 @@ make update_lambda_with_s3
317317
make update_lambda
318318
```
319319

320+
### 6) Nuclear option
321+
322+
Sometimes you want to go back to a clean slate and we have a command for that which will rely on the parameters you use.
323+
324+
```console
325+
make nuke
326+
```
327+
328+
That command will clean your local build folders then delete lambdas and layers created based off the configuration you use.
329+
330+
### 7) Delete S3 bucket
331+
332+
You can delete the S3 bucket where you hold your lambdas and layers with the command below:
333+
334+
```console
335+
make delete_s3_bucket
336+
```
337+
320338
# Update the lambda layer
321339

322340
The docker image could require security updates or could require updates.

0 commit comments

Comments
 (0)