def custodian_archive ( packages = None ) : modules = { 'c7n' , 'pkg_resources' } if packages : modules = filter ( None , modules . union ( packages ) ) return PythonPackageArchive ( * sorted ( modules ) )
add python libraries to aws lambda
Create a lambda code archive for running custodian .
def custodian_archive(packages=None):
    """Create a lambda code archive for running custodian.

    Lambda archive currently always includes `c7n` and
    `pkg_resources`. Add additional packages in the mode block.

    Example policy that includes additional packages

    .. code-block:: yaml

        policy:
          name: lambda-archive-example
          resource: s3
          mode:
            packages:
              - botocore

    packages: List of additional packages to include in the lambda archive.

    """
    modules = {'c7n', 'pkg_resources'}
    if packages:
        modules = filter(None, modules.union(packages))
    return PythonPackageArchive(*sorted(modules))