Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ciaransweet/localstack_and_lambda_layers
An example on how to implement Lambda Layers within the free LocalStack offering
https://github.com/ciaransweet/localstack_and_lambda_layers
Last synced: 3 months ago
JSON representation
An example on how to implement Lambda Layers within the free LocalStack offering
- Host: GitHub
- URL: https://github.com/ciaransweet/localstack_and_lambda_layers
- Owner: ciaransweet
- License: mit
- Created: 2020-02-21T10:27:27.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-02-27T16:04:39.000Z (over 4 years ago)
- Last Synced: 2024-07-15T13:04:16.823Z (4 months ago)
- Language: Shell
- Homepage:
- Size: 4.88 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Lambda Layers in LocalStack (The free version)
*Using the free version of LocalStack? Need to use Lambda Layers? Look no further!*
## Prequisites
* Python 3+
* Docker ComposeInstall the required pip packages for the project with:
```
$ pip3 install -r requirements.txt
```# Run LocalStack
Run the LocalStack container in the background with:
```
$ docker-compose up -d
# If you're a MacOS user like me, you might need to do:
$ mkdir lstmp
$ TMPDIR=./lstmp docker-compose up -d
```After a while it will be ready, you can double check this by seeing if `Ready.` is in the logs:
```
$ docker logs -f localstack
...
...
Ready.
```# Create the Layer, deploy the Lambda and test it:
```
$ cd lambda
$ bash test-lambda.sh
Build Layer and extract zip of dependencies
ac038acb524c360a5b8a4e47277abea58919e4ad2eaee33aed7c2b6c44b2fd92
-----------------------
Creating lambda layer
-----------------------
Remove lambda python packages
Remove useless files
Remove uncompiled python scripts
Strip shared libraries
Create archives
cogeo
cogeo
Unzip Layer and move all items up one directory
Copy in Lambda code and zip up new 'uber' Lambda
========= test session starts =========
platform darwin -- Python 3.7.6, pytest-5.3.5, py-1.8.1, pluggy-0.13.1
rootdir: /Users/ciaran/dev/localstack_and_lambda_layers/lambda
collected 1 itemtest_lambda.py .
========= 1 passed in 28.79s =========
```