Lambada Reference API Documentation

Lambada package entry point

class lambada.Bouncer(config_file=None, env_prefix=u'BOUNCER_')[source]

Bases: object

Configuration class for lambda type deployments where you don’t want to keep security information in source control, but don’t have environment variable configuration as a feature of Lambda. It pairs with the command line interface to package and serializes the current configuration into the zip file when packaging. This allows changing with local environment variable changes or different configuration file paths at package time).

Configuration files, if not specified, are loaded in the following order, with the first one found being the only configuration (they do not layer):

  • Path specified by BOUNCER_CONFIG environment variable.
  • lambada.yml in the current working directory.
  • .lambada.yml in your HOME directory
  • /etc/lambada.yml

That said no configuration file is required and any environment variable with a certain prefix will be added to the attributes of this class when instantiated. The default is BOUNCER_ so the environment variable BOUNCER_THING will be set in the object as bouncer.thing after construction.

These prefixed environment variables will also override whatever value is in the config, so if your config file has a thing variable in it, and BOUNCER_THING is set, the value of the environment variable will override the configuration file.

Finds and sets up configuration by yaml file

  • config_file (str) – Path to configuration file
  • env_prefix (str) – Prefix of environment variables to use as configuration

Write out the current configuration to the given stream as YAML.


destination (str) – Path to output file.

  • IOError
  • yaml.YAMLError
class lambada.Dancer(function, name=None, description=u'', **kwargs)[source]

Bases: object

Simple function wrapping class to add context to the function (i.e. name, description, memory.)

Creates a dancer object to let us know something has been decorated and store the function as the callable.

  • function (callable) – Function to wrap.
  • name (str) – Name of function.
  • description (str) – Description of function.
  • kwargs – See OPTIONAL_CONFIG for options, if not specified in dancer, the Lambada objects configuration is used, and if that is unspecified, the defaults listed there are used.

A dictionary of configuration variables that can be merged in with the Lambada object

class lambada.Lambada(handler=u'lambda.tune', bouncer=<lambada.Bouncer object>, **kwargs)[source]

Bases: object

Lambada class for managing, discovery and calling the correct lambda dancers.

Setup the data structure of dancers and do some auto configuration for us with deploying to AWS using lambda_uploader. See OPTIONAL_CONFIG for arguments and defaults.

dancer(name=None, description=u'', **kwargs)[source]

Wrapper that adds a given function to the dancers dictionary to be called.

  • name (str) – Optional lambda function name (default uses the name of the function decorated.
  • description (str) – Description field in AWS of the function.
  • kwargs – Key/Value overrides of either defaults or Lambada class configuration values. See OPTIONAL_CONFIG for available options.

Object with configuration and callable that is the function

being wrapped

Return type:



Get any and all environment variables with given prefix, remove prefix, lower case the name, and add as a dictionary item that is returned.

Parameters:env_prefix (str) – environemnt variable prefix.
empty if no environment variables were found, or the
dictionary of found variables that match the prefix.
Return type:dict

Finds configuration file and returns the python object in it or raises on parsing failures.

Parameters:config_file (str) – Optional path to configuration file, runs through CONFIG_PATHS if none is specified.
empty if no configuration file was found, or the
contents of that file.
Return type:dict

lambada.cli module

Command line interface for running, packaging, and uploading commands to AWS.

lambada.cli.create_package(path, tune, requirements, destination='')[source]

Creates and returns the package using lambda_uploader.

lambada.common module

Common classes, functions, etc.

class lambada.common.LambadaConfig(path, config)[source]

Bases: lambda_uploader.config.Config

Small override to load config from dictionary instead of from a configuration file.

Takes config dictionary directly instead of retrieving it from a configuration file.

class lambada.common.LambdaContext(function_name, function_version=None, invoked_function_arn=None, memory_limit_in_mb=None, aws_request_id=None, log_group_name=None, log_stream_name=None, identity=None, client_context=None, timeout=None)[source]

Bases: object

Convenient class duplication of the one passed in by Amazon as defined at:

Setup all the attributes of the class.


If we have a timeout return the amount of time left.


Given the path, find the lambada class label by dir() ing for that type.

Parameters:path (click.Path) – Path to folder or file

Returns the current time in milliseconds since epoch.