Metadata-Version: 2.1
Name: awslayer-manager
Version: 1.0.6
Summary: A simple, per-project AWS Lambda Layer manager.
Home-page: https://www.example.com
Author: Ramazan Elsunkaev
Author-email: relsunkaev@outlook.com
License: MIT
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Description-Content-Type: text/markdown

# awslayer-manager

This a simple tool to build and upload your project requirements as an AWS Lambda Layer. It extracts the requirements
from your Pipfile and installs them into a separate directory which it's deployed from. This package also supports
working with the high performance `mysqlclient` library by compiling it inside a docker container that closely mimics
the AWS Lambda environment and deploying it with the layer.

## Installation

To install this package, run

```bash
pip install awslayer-manager
```

### Requirements

- Requires your project to be using the `Serverless` framework.
- This package requires `Docker` if you're planning to work with `mysqlclient`. If not, you can omit it.

## Running

To initialize the layer run

```bash
awslayer
```

in the project directory. This will extract requirements from your Pipfile and create a serverless.yml inside the layer
directory. Once the layer is initialized, it will install all the requirements inside the `layers/package` directory and
deploy it using `sls deploy` the layer to the specified environment (dev by default).

To change the environment add use the `--env` option. Supports `dev` and `prod` environments.

Once that is done, add the following for each function in your project's serverless.yml:

```YAML
functions:
  func-name:
    handler: src/handler.func-name
    layers:
      - "${cf:stack-name.ServiceNameLayerLambdaLayerQualifiedArn}"
```

where you can find the "ServiceNameLayerLambdaLayerQualifiedArn" identifier in the CloudFormation stack.

**NOTE:** This package will create a `layer` directory inside your project which I recommend adding to your .gitignore
file as it is fairly heavy (depending on the size of your requirements)

## Contributing

Pull requests are welcome.


