{ "info": { "author": "James Kelly", "author_email": "pthread1981@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Topic :: System :: Software Distribution" ], "description": "# Lambda Deploy - Easily Deploy Code to AWS Lambda\n\n_Note: 0.1.0 introduces a change in how Lambda\nDeploy operates - no longer are all directories\nin the current working directory assumed to be\nLambdas, instead the current directory itself\nis assumed to be a Lambda, and you need to call\nit multiple times to upload multiple Lambdas._\n\nThis tool provides an easy way to deploy your code\nto AWS's Lambda service. It provides a number of\nuseful features:\n\n- Uses the standard boto/aws configuration options\n- Handles packaging of (pure python) dependencies\n- Allows for providing environment variables to Lambda\n- Simplifies deployment steps\n\nIt should be noted that this is alpha, and issues\nare expected, as well as changes to the interface.\nWhere an issue is known, I try and document it here,\nbut if you find something, please open an issue.\n\n## Usage\n\nAt its heart the tool simply takes the directory\nit is run from, and will package it up, giving it\nthe name of the directory, and pushing\nit to AWS with the options you configure (see\n[Configuration](#configuration) below).\n\nWhile the tool is oriented towards Python at the\nmoment, there is no reason it could not push\nother types of code to AWS, and its dependency\nbundling could be extended to support other\nlanguages. If this interests you, please open\na ticket.\n\nA simple example usage would be the following:\n\n\t$ lambda-deploy deploy\n\nThis will load all the contents of the current\nworking directory into a Lambda and upload it\nto AWS.\n\nThere is one other command aside from `deploy`:\n`list`. You can guess what `list` does - it\nlists your current Lambdas along with some\ninformation about them.\n\nAt its most basic that's it. The next section\nwill cover how to configure things.\n\n## Configuration\n\nConfiguration of the tool can be done though two\nprimary avenues - command line arguments and\nenvironment variables. Within environment\nvariables, you can either set them yourself\nusing traditional means, or make use of a `.env`\nfile, which the tool will read in to populate\nthe environment.\n\nCommand line arguments will override\nenvironment variables.\n\n### AWS Credentials\n\nYou can configure AWS in any way which\n[boto3](http://boto3.readthedocs.org/en/latest/guide/configuration.html)\nsupports. This tool actually does not touch\nthese at all, and relies on boto to pick\nthem up entirely. There's no way to pass\nthem via the command line.\n\n### Lambda Options\n\nThere are several options can be passed in to \nyour Lambda jobs, as well as one required\npiece of information. Options that can also\nbe configured via an environment variable\nwill have the environment variable in\nparanthesis in the header.\n\nThese correspond to boto3 arguments, so if\nsomething is unclear, I recommend checking\nthe [boto3 documentation](http://boto3.readthedocs.org/en/latest/reference/services/lambda.html).\n\n#### Role (LAMBDA_ROLE)\n\nThe only thing that is required is that you\nspecify the ARN role that your Lambda job\nwill operate under when communicating with\nAWS. This can be specified via the\n`-r/--role` option on the command line,\nor via the environment variable. You must\nconfigure via one of these methods, and\nif you've done both, the command line\ntakes precedence.\n\n#### Runtime (LAMBDA_RUNTIME)\n\nThis is the runtime on AWS Lambda that your\ncode will run under. It defaults to `python2.7`,\nand can only be changed via the environment\nvariable.\n\n#### Handler (LAMBDA_HANDLER)\n\nThis controls the entry point of your Lambda\ncode. It defaults to `lambda_function.lambda_handler`,\nand can only be changed via the environment\nvariable.\n\nThis means, for example, that inside your\nLambda directory you would have a file\n`lambda_function.py` which contains a\nfunction `lambda_handler`.\n\n#### Name (LAMBDA_NAME)\n\nThis is the name attached to your Lambda job\non AWS. It defaults to the directory name the\ncode resides in. This can be specified via\nthe `-n/--name` option on the command line\nor the environment variable.\n\n#### Description (LAMBDA_DESCRIPTION)\n\nThis is the description attached to your Lambda\njob on AWS. It defaults to \"Lambda code for \"\nfollowed by the name of your Lambda job,\nand can only be changed via the environment\nvariable.\n\n#### Timeout (LAMBDA_TIMEOUT)\n\nThis is the amount of time, as an integer,\nthat Lambda should allow your job to run\nbefore it is killed. This value defaults\nto 3 seconds, and can only be changed via\nthe environment variable. The maximum that\nAWS allows is 300 seconds.\n\n#### Memory Size (LAMBDA\\_MEMORY_SIZE)\n\nThe amount of memory, expressed as an integer\nnumber of megabytes, that should be allocated\nto your job. The default is 128, and values must\nbe given as multiples of 64, and can only be\nchanged via the environment variable. \n\nThe amount of CPU is also inferred based on\nthis. For specifics, as well as maximums, I\nrecommend you check the AWS documentation.\n\n### Tool Options\n\nThe following options can be provided to tweak\nhow the tool runs. Options that can also\nbe configured via an environment variable\nwill have the environment variable in\nparanthesis in the header.\n\n#### Environment File (LAMBDA\\_ENV_FILE)\n\nYou can specify a different environment file\n(from the default `.env`) to populate the\nenvironment:\n\n\t$ lambda-deploy -e /my/env/file deploy\n\nNote that shell expansions haven't been tested\nhere yet.\n\nNote that a `.env` file inside your Lambda\ndirectory will *not* be uploaded, to protect\nyou from accidentally uploading sensitive\ninformation. Use `LAMBDA_ENV_VARS` as is\ndescribed below.\n\n#### Environment Variables (LAMBDA\\_ENV_VARS)\n\nYou can specify one or more environment\nvariables to pluck out of the environment\nthe tool is running in, which will be placed in\na `.env` file that will be shipped with your\nLambdas.\n\n\t$ lambda-deploy -E MY_ENV_VAR -E MY_OTHER_ENV_VAR deploy\n\nWhen setting this in an environment variable\nitself, you can set values in a comma-delimated\nfashion:\n\n\tLAMBDA_ENV_VARS=MY_ENV_VAR,MY_OTHER_ENV_VAR\n\nThis is useful for keeping all your configuration\ninside a `.env` file. If for example `MY_ENV_VAR`\nhad a value of \"foo\" and `MY_OTHER_ENV_VAR` had\na value of bar, providing this options above would\nresult in a `.env` file being creatd in your LAMBDA\nthat looks like the following:\n\n\tMY_ENV_VAR=foo\n\tMY_OTHER_ENV_VAR=bar\n\n#### Lambda Directory (LAMBDA_DIRECTORY)\n\nBy default the tool uses the current working\ndirectory as its base to package, but you\ncan change this by providing this option:\n\n\t$ lambda-deploy -d /another/directory\n\nLike the environment file, support for things\nlike shell expansions isn't really there yet.\n\n#### Logging Level (LAMBDA\\_LOGGING_LEVEL)\n\nIn order to change the logging level, you can\nsimply provide the `-v/--verbose` option to\nget DEBUG level logging, or you can specify\nwhat you want using the `-l/--logging-level`\noption:\n\n\t$ lambda-deploy -l WARNING deploy\n\nThese correspond to standard Python logging\nmodule levels - `CRITICAL`, `ERROR`, `WARNING`,\n`INFO`, `DEBUG` or `NOTSET`.\n\n## Automatic Dependency Bundling\n\nOne of the nicest features of this tool is\nthat you can use a `requirements.txt` file as\nyou normally would, and have those dependencies\nbundles at the time you build your Lambda,\nwithout polluting your local development\nenvironment or even requiring a virtual\nenvironment.\n\nJust place the `requirements.txt` in the root\nof your Lambda's folder (i.e. peered with\nyour Lambda handler file) and we'll handle the\nrest.\n\nIf this sounds to good to be true, it is, or\nat least there are some limits. Unfortunately,\nwhile this works well for pure Python modules,\nmodules with compiled resources will not work\ndirectly.\n\nThere are some ways around this. If you build\nmodules on an Amazon Linux x86_64 EC2 instance,\nas long as the resulting code is relatively\nself contained (i.e. doesn't require the\ninstallation of compiled binaries elsewhere\non the system) then you should be able to move\nthis off of that system into your Lambda bundle.\n\nAdditionally, if you Google you can find some\npeople that have made special pip installable\nversions of packages designed to work on\nLambda.\n\nFeel free to open an issue if you have problems\ngetting this to work.\n\n## An Example of Deploying Multiple Lambdas\n\nA common use case is having a stable of Lambdas\nthat you would like deployed, perhaps as part of\na CI solution. An example of this might be\nhaving a single git repo, in which you have a\ndirectory called \"lambdas\" which contains\ndirectories containing your individual Lambda\ndirectories, like so:\n\n\t$ ls lambdas/\n\tlambdaA lambdaB\n\nAssuming your CI solution inserts the current\ngit commit SHA1 in an environment variable, lets\ncall it `GIT_COMMIT_SHA1`, you could construct\na command like the following to only release\nthe Lambdas that changed:\n\n\t$ git show --pretty=\"format:\" --name-only $GIT_COMMIT_SHA1 | grep '^lambdas' | cut -d/ -f 1-2 | uniq | xargs -I {} sh -c 'test -d \"{}\" && lambda-deploy -d \"{}\" deploy'\n\nThis correctly deals with not acting on things\noutside of your lambdas directory, and only\nuploading a Lambda if it changed. It does not\nremove existing Lambdas if they are removed\nfrom your git source - that's still something\nyou'd need to do manually.\n\n## Development and Support\n\nPull requests and issues are welcome - join us on\n[GitHub](https://github.com/jimjkelly/lambda-deploy)\n\n\n\nHistory\n-------\n\n__0.1.1 (2016-05-04)__: Fix issue with running with no .env file.\n__0.1.0 (2016-04-28)__: Change to deploying a single Lambda at a time.\n__0.0.2 (2016-04-18)__: Fix issue with uptake of files in directory search.\n__0.0.1 (2016-04-16)__: Initial Release.", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jimjkelly/lambda-deploy", "keywords": "aws lambda", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "lambda-deploy", "package_url": "https://pypi.org/project/lambda-deploy/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/lambda-deploy/", "project_urls": { "Homepage": "https://github.com/jimjkelly/lambda-deploy" }, "release_url": "https://pypi.org/project/lambda-deploy/0.1.2/", "requires_dist": [ "boto3 (>=1.3.0)", "requests (>=2.9.1)", "yaep (>=0.0.4)" ], "requires_python": "", "summary": "Easily deploy code to AWS Lambda", "version": "0.1.2" }, "last_serial": 2276238, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "394c92f41584a927524a885ef552b8d1", "sha256": "3e03a87592a1a8176ecb64b18973ff42307326398daed5a03ab096f8734eebc4" }, "downloads": -1, "filename": "lambda-deploy-0.0.1.tar.gz", "has_sig": false, "md5_digest": "394c92f41584a927524a885ef552b8d1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12955, "upload_time": "2016-04-16T14:33:44", "url": "https://files.pythonhosted.org/packages/78/dc/27cec42d387d3bbc3b43e236b5375d90f6c95f21292e711c861136e65d15/lambda-deploy-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "1d49fec7f3be51c678171cb5086121ac", "sha256": "19cbcad3e2744f4999ac9801b4ec51b158d9849d2f152a76a05fbd4e53c1ff2e" }, "downloads": -1, "filename": "lambda_deploy-0.0.2-py2-none-any.whl", "has_sig": false, "md5_digest": "1d49fec7f3be51c678171cb5086121ac", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 13859, "upload_time": "2016-04-18T20:30:19", "url": "https://files.pythonhosted.org/packages/f5/47/8f9bf04a096a920ec2eb266367d6b90a6a4cf48998220c5bf0b7348f474d/lambda_deploy-0.0.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ad396cbefd7716fc3a62fea5dc0527b5", "sha256": "6bef97ed886973138470cd808b5f742159bc9ab4757d3cb4d22d46bd85a9daf6" }, "downloads": -1, "filename": "lambda-deploy-0.0.2.tar.gz", "has_sig": false, "md5_digest": "ad396cbefd7716fc3a62fea5dc0527b5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13396, "upload_time": "2016-04-18T20:31:30", "url": "https://files.pythonhosted.org/packages/d5/79/cf7b48d77fac9cd7a08b9d1db8f679e386f3fe9174c9a9c008de475b1586/lambda-deploy-0.0.2.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "81efc6436ff7ec1c9f386f6ef989a5ae", "sha256": "4bc44bb6d031e60bdf16f579bb8c89cc90880967143144707782d6e602ac7f63" }, "downloads": -1, "filename": "lambda_deploy-0.1.0-py2-none-any.whl", "has_sig": false, "md5_digest": "81efc6436ff7ec1c9f386f6ef989a5ae", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 15180, "upload_time": "2016-04-30T19:42:03", "url": "https://files.pythonhosted.org/packages/7d/6b/da934f39cfa3df864d7275364a07a6c1e1ade0d67a8c1e46bd6453eb6cc3/lambda_deploy-0.1.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f57257f0ba91e36298d1c73e1d1af9d7", "sha256": "0a1acf359e3dbf448c0b5eda601505c9e68cc3d9d9ed1932637732a0602a7d27" }, "downloads": -1, "filename": "lambda-deploy-0.1.0.tar.gz", "has_sig": false, "md5_digest": "f57257f0ba91e36298d1c73e1d1af9d7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15021, "upload_time": "2016-04-30T19:42:21", "url": "https://files.pythonhosted.org/packages/1f/cc/c76db453e8bde52bb92a9fb2ca1c9c1c0445a16f20bc167c0739c1e1da1a/lambda-deploy-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "ec86da131135ceada717f198d2c9470a", "sha256": "39bf020c58c4658ad439ef55ebb3fe20190f98ca2cd0006067edfa6e361f016e" }, "downloads": -1, "filename": "lambda_deploy-0.1.1-py2-none-any.whl", "has_sig": false, "md5_digest": "ec86da131135ceada717f198d2c9470a", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 15243, "upload_time": "2016-05-04T18:56:59", "url": "https://files.pythonhosted.org/packages/23/2c/08f210d0796e3aa3f317c64dae52413c420906c8c607bd7a58d0c57204a7/lambda_deploy-0.1.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "045eb39141aac8ac472fc0f67ffdad15", "sha256": "389870b6bc1b9b6fae5d552f07a33ca1695db68cd0abfb3a734e8bf95985d5a8" }, "downloads": -1, "filename": "lambda-deploy-0.1.1.tar.gz", "has_sig": false, "md5_digest": "045eb39141aac8ac472fc0f67ffdad15", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15101, "upload_time": "2016-05-04T18:59:24", "url": "https://files.pythonhosted.org/packages/ad/87/4a5803e777d89c61fb06eed36fb79fa8f3fa3ee002259c0e7d0412823f53/lambda-deploy-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "ac964fc58d6d71ddd46b548e5b084dea", "sha256": "a1bc272616eb1fca2b0254cd5b3ff6869801a485cabcd35f8353c4f35e9b0b1a" }, "downloads": -1, "filename": "lambda_deploy-0.1.2-py2-none-any.whl", "has_sig": false, "md5_digest": "ac964fc58d6d71ddd46b548e5b084dea", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 15437, "upload_time": "2016-08-11T16:19:56", "url": "https://files.pythonhosted.org/packages/ea/03/9d7e5441109428c05735010558afa0243a1b2a6080d1d43042b5ad7af20f/lambda_deploy-0.1.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b178ceec00426f227a4c685081caec73", "sha256": "81eeb1939e55503b531033b0ff206d080144169225efbe6b3971659904d8d567" }, "downloads": -1, "filename": "lambda-deploy-0.1.2.tar.gz", "has_sig": false, "md5_digest": "b178ceec00426f227a4c685081caec73", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15373, "upload_time": "2016-08-11T16:19:58", "url": "https://files.pythonhosted.org/packages/de/82/63f7812e9b5419082ff1f2eec4975eaeee3c6d783b6347ba34d3e458c1f8/lambda-deploy-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ac964fc58d6d71ddd46b548e5b084dea", "sha256": "a1bc272616eb1fca2b0254cd5b3ff6869801a485cabcd35f8353c4f35e9b0b1a" }, "downloads": -1, "filename": "lambda_deploy-0.1.2-py2-none-any.whl", "has_sig": false, "md5_digest": "ac964fc58d6d71ddd46b548e5b084dea", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 15437, "upload_time": "2016-08-11T16:19:56", "url": "https://files.pythonhosted.org/packages/ea/03/9d7e5441109428c05735010558afa0243a1b2a6080d1d43042b5ad7af20f/lambda_deploy-0.1.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b178ceec00426f227a4c685081caec73", "sha256": "81eeb1939e55503b531033b0ff206d080144169225efbe6b3971659904d8d567" }, "downloads": -1, "filename": "lambda-deploy-0.1.2.tar.gz", "has_sig": false, "md5_digest": "b178ceec00426f227a4c685081caec73", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15373, "upload_time": "2016-08-11T16:19:58", "url": "https://files.pythonhosted.org/packages/de/82/63f7812e9b5419082ff1f2eec4975eaeee3c6d783b6347ba34d3e458c1f8/lambda-deploy-0.1.2.tar.gz" } ] }