{"id":20471769,"url":"https://github.com/signiant/lambda-promotion","last_synced_at":"2025-08-12T00:13:18.333Z","repository":{"id":93380987,"uuid":"49578823","full_name":"Signiant/lambda-promotion","owner":"Signiant","description":"Easily promote lambda functions to AWS","archived":false,"fork":false,"pushed_at":"2018-07-04T18:10:57.000Z","size":117,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-01-16T02:23:49.347Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Signiant.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-01-13T14:28:00.000Z","updated_at":"2020-03-12T15:28:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"6e39db44-92c3-4c0b-8aa2-73502faadb73","html_url":"https://github.com/Signiant/lambda-promotion","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Signiant%2Flambda-promotion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Signiant%2Flambda-promotion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Signiant%2Flambda-promotion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Signiant%2Flambda-promotion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Signiant","download_url":"https://codeload.github.com/Signiant/lambda-promotion/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242039536,"owners_count":20061924,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T14:17:12.358Z","updated_at":"2025-03-05T13:44:29.810Z","avatar_url":"https://github.com/Signiant.png","language":"Shell","readme":"# lambda-promotion\n\nLambda-promotion is a shell script tool that uses the aws cli to automate the process of creating and updating lambda functions.  It allows to deploy and promote your functions straight from the command line.  This tool was designed for jenkins integration, but can be run locally just as easily.  \n\n## What does it do?\n\nThe lambda-promotion tool will create and/or update a lambda function and it's associated dependencies based information supplied in json configuration files.  Unique IAM roles and policies are created for each function.  It also manages function versioning using the alias functionality provided by AWS Lambda.\n\n## Setup\nThe lambda-promotion tool runs independently of the build process, but requires that certain artifacts are produced.\n\nBelow is an example of the file structure resulting from a build.\n\n![Build Artifacts](/images/build-artifacts.png?raw=true)\n\n#### Environments\n\n![Environments Directory](/images/environments.png?raw=true)\n\nThe environments directory is required within the deploy directory of the build output, and holds the environment specific configuration files.  These files are created from the lambda.json template (templates/lambda.json) and hold most of the function configuration information.  The filename must match the environment that will be supplied when invoking the script, and have the extension .lam.json.\n\n#### Policy\n\n![Policy.json](/images/policy.png?raw=true)\n\nAlso within the deploy directory is the policy.lam.json file.  This will be the policy for the role your lambda function will assume. There may only be one policy document, but the policy may have as many statements as necessary.\n\nProper policy document can be generated using the [AWS Policy Generator](http://awspolicygen.s3.amazonaws.com/policygen.html), with an IAM policy type.\n\n### Test events\n\nYou may wish to run tests against the function to verify that it is ready for promotion.  This can be done by including a tests.lam.json in the deploy directory.  This file is optional, and contains an array of event objects to test the lambda function with.  If any of these events fail, the alias will not move to the new function version, and the promotion process will exit, noting the function version, error, and response.\n\nThe template for a tests.lam.json file can be found in templates/lambda.json.  Simply add an object to the \"events\" array for each test you would like to run.\n\n#### Source code\n\n![Source Code Artifacts](/images/source-artifacts.png?raw=true)\n\nAt the top-level of the build output there at least one .zip artifact containing the source code is required.  This is the file that will be uploaded to the lambda function.  Separate archives may be used for each environment, but they may also share a single archive.\n\n#### Events\n\n![Events](/images/events.png?raw=true)\n\nThe events directory (located under the deploy directory) is the only optional portion of the build output.  It contains the .json documents defining any of your functions event sources.\n\n\n## Event sources\n\nThe lambda-promotion tool supports multiple types of event-sources.\nThe currently supported event types are s3, dynamodb, sns, and events (Cloudwatch Scheduled Events).  To include an event source, it must be added to the events array in the environment configuration file.  \nEvent objects are structured as follows\n```\n{\n  \"type\": \"\",\n  \"src\": \"\",\n  \"parameter\": \"\"\n}\n```\nThe type property identifies the event type (either s3, dynamodb, sns, or events).  \n\nThe src key identifies the source json file for the event (from the build output directory e.g. deploy/events/event.json).  Each event type (except for sns) requires a .json file defining it's properties.  The templates for these definitions are located under templates/event-templates.  Any keys marked with a value of '*' Will be automatically filled in by the script.  For sns events, leave this value blank.\n\nThe parameter key identifies an additional parameter required for some event-types.  For event-types without a parameter, this field is left blank.  \n\nThe event types and their parameters are as follows :\ns3: bucket name\ndynamodb: table name\nsns: topic name\nevents: none\n\n## Monitoring\n\nThis tool uses the [lambda-metrics](https://github.com/Signiant/lambda-metrics) function for monitoring.  This Lambda function must be setup on the same environment as any Lambda functions you wish to monitor.\n\nThe lambda-monitor.sh script can be run after the promotion of a function to enable monitoring.  Monitoring a function tracks a custom percent-failure metric (calculated for the last 5 minutes), and triggers a notification to an https endpoint if it reaches or exceeds a threshold. Two Cloudwatch alarms and one SNS topic are created for each function.\n\n## Usage\n\nThe lambda-promotion tool requires two arguments, the path to the build directory, and the environment to use (must have a matching .lam.json config file).\n\nlambda-promote.sh \u003c build-path \u003e \u003c environment \u003e\n\nlambda-promote.sh /Users/example/Projects/LambdaProject/build dev\n\nThe monitoring tool requires 5 arguments, the path to the build directory, the environment to use, the notification endpoint url (must be https), the threshold value (between 1 and 100), and the SNS origin topic name.  \n\n  lambda-monitor.sh /Users/example/Projects/LambdaProject.build dev https://test.url/endpoint 50 Lambda-Monitoring-Topic\n\n  lambda-monitor.sh \u003c build-path \u003e \u003c environment \u003e \u003c endpoint \u003e \u003c threshold \u003e \u003c topic \u003e\n\n## Dependencies\nThis tool requires that these cli utilities be installed :  \njq \u003e=1.5  \naws-cli \u003e= 1.3.20\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsigniant%2Flambda-promotion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsigniant%2Flambda-promotion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsigniant%2Flambda-promotion/lists"}