File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- # localstack_and_lambda_layers
2- An example on how to implement Lambda Layers within the free LocalStack offering
1+ # Lambda Layers in LocalStack (The free version)
2+
3+ * Using the free version of LocalStack? Need to use Lambda Layers? Look no further!*
4+
5+ ## Prequisites
6+ * Python 3+
7+ * Docker Compose
8+
9+ Install the required pip packages for the project with:
10+ ```
11+ $ pip3 install -r requirements.txt
12+ ```
13+
14+ # Run LocalStack
15+
16+ Run the LocalStack container in the background with:
17+ ```
18+ $ docker-compose up -d
19+ # If you're a MacOS user like me, you might need to do:
20+ $ mkdir lstmp
21+ $ TMPDIR=./lstmp docker-compose up -d
22+ ```
23+
24+ After a while it will be ready, you can double check this by seeing if ` Ready. ` is in the logs:
25+ ```
26+ $ docker logs -f localstack
27+ ...
28+ ...
29+ Ready.
30+ ```
31+
32+ # Create the Layer, deploy the Lambda and test it:
33+
34+ ```
35+ $ cd lambda
36+ $ bash test-lambda.sh
37+ Build Layer and extract zip of dependencies
38+ ac038acb524c360a5b8a4e47277abea58919e4ad2eaee33aed7c2b6c44b2fd92
39+ -----------------------
40+ Creating lambda layer
41+ -----------------------
42+ Remove lambda python packages
43+ Remove useless files
44+ Remove uncompiled python scripts
45+ Strip shared libraries
46+ Create archives
47+ cogeo
48+ cogeo
49+ Unzip Layer and move all items up one directory
50+ Copy in Lambda code and zip up new 'uber' Lambda
51+ ========= test session starts =========
52+ platform darwin -- Python 3.7.6, pytest-5.3.5, py-1.8.1, pluggy-0.13.1
53+ rootdir: /Users/ciaran/dev/localstack_and_lambda_layers/lambda
54+ collected 1 item
55+
56+ test_lambda.py .
57+
58+ ========= 1 passed in 28.79s =========
59+ ```
You can’t perform that action at this time.
0 commit comments