GithubHelp home page GithubHelp logo

wrah / python-lambder Goto Github PK

View Code? Open in Web Editor NEW

This project forked from leafsoftware/python-lambder

0.0 2.0 0.0 18 KB

Create and manage scheduled AWS Lambdas from the CLI

License: MIT License

Python 100.00%

python-lambder's Introduction

Lambder

Serverless cron jobs written in python and scheduled as AWS Lambdas.

We used to implement maintenance jobs like RDS snapshots and starting/stopping instances outside of business hours as CI server builds. This always seemed hacky. When scheduled Lambdas were released, we got to work re-implementing these scripts. Unfortunately, scheduled Lambdas have a steep learning curve. You have to understand IAM roles, CloudWatch Events, and how to deploy and update Lambda function code.

Lambder simplifies the creation and deployment of these scheduled jobs.

Installation

If you don't use pipsi, you're missing out. Here are installation instructions.

Simply run:

$ pipsi install lambder

Getting Started

To create a new Lambda Function project, specify a name and an S3 bucket to store the code zipfile.

  1. lambder functions new --name foo --bucket mys3bucket
  2. cd lambder-foo
  3. lambder functions deploy
  4. lambder functions list
  5. lambder functions invoke

Usage

Get help

lambder --help

Managing Events

Schedule an existing AWS Lambda

lambder events add \
  --name EbsBackups \
  --function-name Lambder-ebs-backup \
  --cron 'cron(0 6 ? * * *)'

Remove an event (a scheduled Lambda)

lambder events rm --name EbsBackups

Disable an event

lambder events disable --name EbsBackups

Re-enable a disabled event

lambder events enable --name EbsBackups

Load events from a json file

lambder events load --file example_events.json

List all events created by lambder

lambder events list

Managing Functions

Create a new AWS Lambda project. Specify a name and an S3 bucket to store the Lambda function code. Optionally specify function configuration like timeout, memory size, and description.

lambder functions new \
  --name ebs-backups \
  --bucket my-s3-bucket \
  --timeout 30 \
  --memory 128 \
  --description "ebs backup function"

Deploy the Lambda function (from within the project directory)

lambder functions deploy

Invoke the Lambda in AWS (from within the project directory)

lambder functions invoke

Invoke the function with input (from within the project directory)

lambder functions invoke --input input/ping.json

List all functions

lambder functions list

Delete a function (from within the project directory)

lambder functions rm

Sample Lambda Functions

TODO:

  • add code to add site packages from virtualenvwrapper to zip
  • add lambda name autodetection to 'lambder events add'
  • add pagination where needed (lambda:list-functions)

python-lambder's People

Contributors

akaczorek avatar chalfant avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.