GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - rackerlabs/lambda-uploader: Helps package and upload Python lambda functions to AWS

BranchesTags
Open more actions menu

Latest commit

 

History

219 Commits
219 Commits

Folders and files

NameName
Last commit message
Last commit date
example
example
 
 
lambda_uploader
lambda_uploader
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
README.rst
README.rst
 
 
circle.yml
circle.yml
 
 
pylintrc
pylintrc
 
 
requirements.txt
requirements.txt
 
 
setup.py
setup.py
 
 
test-requirements.txt
test-requirements.txt
 
 
tox.ini
tox.ini
 
 

Repository files navigation

lambda-uploader

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.

Note also the ignore entry is an array of regular expression strings used to match against the relative paths - be careful to quote accordingly. For example, a traditional *.txt "glob" is matched by the JSON string: ".*\\.txt$" (or just "\\.txt$").

Example lambda.json file:

{
  "name": "myFunction",
  "description": "It does things",
  "region": "us-east-1",
  "runtime": "python2.7",
  "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"
    ]
  },
  "tracing": {
    "Mode": "Active"
  }
}

You can also optionally setup a subscription to a Kinesis stream for your lambda using the subscription field as in the following sample configuration.

{
  "name": "myFunction",
  "description": "It does things",
  "region": "us-east-1",
  "runtime": "python2.7",
  "handler": "function.lambda_handler",
  "role": "arn:aws:iam::00000000000:role/lambda_basic_execution",
  "requirements": ["pygithub"],
  "timeout": 30,
  "memory": 512,
  "subscription": {
    "kinesis": {
      "stream": "arn:aws:kinesis:eu-west-1:000000000000:stream/services",
      "batch_size": 10
    }
  }
}

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

If you would prefer to build the package manually and just upload it using uploader you can ignore the build. This will upload lambda_function.zip file.

lambda-uploader --no-build

About

Helps package and upload Python lambda functions to AWS

Resources

Readme
Apache-2.0 license
Activity
Custom properties

Stars

271 stars

Watchers

93 watching

Forks

55 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.