Skip to main content

AWS Python Lambda Packager

Project description

Provides a quick command line utility for packaging and publishing Python AWS Lambda functions. This is a work in progress and pull requests are always welcome.

Installation

The latest release of lambda-uploader can be installed via pip:

pip install lambda-uploader

An alternative install method would be manually installing it leveraging setup.py:

git clone https://github.com/rackerlabs/lambda-uploader
cd lambda-uploader
python setup.py install

Configuration File

The lambda uploader expects a directory with, at a minimum, your lambda function and a lambda.json file. It is not necessary to set requirements in your config file since the lambda uploader will also check for and use a requirements.txt file.

Please note that you can leave the “vpc” object out of your config if you want your lambda function to use your default VPC and subnets. If you wish to use your lambda function inside a specific VPC, make sure you set up the role correctly to allow this.

Example lambda.json file:

{
  "name": "myFunction",
  "description": "It does things",
  "region": "us-east-1",
  "handler": "function.lambda_handler",
  "role": "arn:aws:iam::00000000000:role/lambda_basic_execution",
  "requirements": ["pygithub"],
  "ignore": [
    "circle.yml",
    ".git",
    "/*.pyc"
  ],
  "timeout": 30,
  "memory": 512,
  "vpc": {
    "subnets": [
      "subnet-00000000"
    ],
    "security_groups": [
      "sg-00000000"
    ]
  }
}

Command Line Usage

To package and upload simply run the command from within your lambda directory or with the directory as an option.

lambda-uploader ./myfunc

To specify an alternative profile that has been defined in ~/.aws/credentials use the --profile parameter.

lambda-uploader --profile=alternative-profile

To specify an alternative, prexisting virtualenv use the --virtualenv parameter.

lambda-uploader --virtualenv=~/.virtualenv/my_custom_virtualenv

To omit using a virtualenv use the --no-virtualenv parameter.

lambda-uploader --no-virtualenv

To inject any other additional files, use the --extra-file EXTRA_FILE parameter.

lambda-uploader --extra-file ~/stuff_for_lambda_packages

If you would prefer to upload another way you can tell the uploader to ignore the upload. This will create a package and leave it in the project directory.

lambda-uploader --no-upload ./myfunc

To publish a version without an alias you would pass the the publish flag.

lambda-uploader -p ./myfunc

If you would like to alias your upload you can pass the alias with the alias flag. The function description will be used when an alias-description is not provided.

lambda-uploader --alias myAlias --alias-description 'My alias description' ./myfunc

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lambda-uploader-1.0.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

lambda_uploader-1.0.0-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file lambda-uploader-1.0.0.tar.gz.

File metadata

File hashes

Hashes for lambda-uploader-1.0.0.tar.gz
Algorithm Hash digest
SHA256 47bcb6e59554f9db0fd2d1ec89ce49c5b0ae1fb9f2d9faa36adae22911afb9df
MD5 fb4f824247687e1953fb3f8534069443
BLAKE2b-256 acd06baf55e475538c5bddd00e95e18421b622ea4ea446af36d6e262e0f38db8

See more details on using hashes here.

File details

Details for the file lambda_uploader-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for lambda_uploader-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3560dc78a79f723bcf754596ec0da2bd00871e4cfc6b79f7c07dd0ed2aaeb045
MD5 914971093f82fb4580fcb800cfa2e82a
BLAKE2b-256 774fbb949f8ea574a50eef84e042a0c1bce22f3f0a5a096b18c92592da5aaffc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page