{"id":13682137,"url":"https://github.com/appleboy/drone-lambda","last_synced_at":"2025-08-20T23:32:29.347Z","repository":{"id":28354669,"uuid":"118217525","full_name":"appleboy/drone-lambda","owner":"appleboy","description":"Deploying Lambda code with drone CI to an existing function","archived":false,"fork":false,"pushed_at":"2024-05-19T03:22:03.000Z","size":2285,"stargazers_count":26,"open_issues_count":0,"forks_count":10,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-05-21T07:34:59.510Z","etag":null,"topics":["aws-lambda","drone","drone-ci","drone-plugin","golang","lambda"],"latest_commit_sha":null,"homepage":null,"language":"Go","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/appleboy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":["https://www.paypal.me/appleboy46"]}},"created_at":"2018-01-20T06:52:37.000Z","updated_at":"2024-05-28T02:27:01.316Z","dependencies_parsed_at":"2023-12-24T07:24:04.478Z","dependency_job_id":"48df589e-8fbc-4014-a4d2-d850bc10aa94","html_url":"https://github.com/appleboy/drone-lambda","commit_stats":{"total_commits":166,"total_committers":3,"mean_commits":"55.333333333333336","dds":"0.012048192771084376","last_synced_commit":"416677ef116a094554ccbcbc56fbd76b866e9169"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appleboy%2Fdrone-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appleboy%2Fdrone-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appleboy%2Fdrone-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appleboy%2Fdrone-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/appleboy","download_url":"https://codeload.github.com/appleboy/drone-lambda/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230026525,"owners_count":18161618,"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":["aws-lambda","drone","drone-ci","drone-plugin","golang","lambda"],"created_at":"2024-08-02T13:01:41.185Z","updated_at":"2024-12-19T17:08:24.059Z","avatar_url":"https://github.com/appleboy.png","language":"Go","funding_links":["https://www.paypal.me/appleboy46"],"categories":["Go"],"sub_categories":[],"readme":"# drone-lambda\n\n[![GoDoc](https://godoc.org/github.com/appleboy/drone-lambda?status.svg)](https://godoc.org/github.com/appleboy/drone-lambda)\n[![codecov](https://codecov.io/gh/appleboy/drone-lambda/branch/master/graph/badge.svg)](https://codecov.io/gh/appleboy/drone-lambda)\n[![Go Report Card](https://goreportcard.com/badge/github.com/appleboy/drone-lambda)](https://goreportcard.com/report/github.com/appleboy/drone-lambda)\n[![Docker Pulls](https://img.shields.io/docker/pulls/appleboy/drone-lambda.svg)](https://hub.docker.com/r/appleboy/drone-lambda/)\n\nDeploying Lambda code with drone CI to an existing function. The plugin automatically deployes a serverless function to AWS Lambda from a zip file located in an S3 bucket. This plugin does not handle creating or uploading the zip file.\n\n![cover](./images/infra.svg)\n\n## Build or Download a binary\n\nThe pre-compiled binaries can be downloaded from [release page](https://github.com/appleboy/drone-lambda/releases). Support the following OS type.\n\n* Windows amd64/386\n* Linux amd64/386\n* Darwin amd64/386\n\nWith `Go` installed\n\n```bash\ngo install github.com/appleboy/drone-lambda@latest\n```\n\nor build the binary with the following command:\n\n```sh\nexport GOOS=linux\nexport GOARCH=amd64\nexport CGO_ENABLED=0\nexport GO111MODULE=on\n\ngo test -cover ./...\n\ngo build -v -a -tags netgo -o release/linux/amd64/drone-lambda .\n```\n\n## Docker\n\nBuild the docker image with the following commands:\n\n```bash\nmake docker\n```\n\n## Usage\n\nThere are three ways to send notification.\n\n### Usage from binary\n\nUpdate lambda function from zip file.\n\n```sh\n$ drone-lambda --region ap-southeast-1 \\\n  --access-key xxxx \\\n  --secret-key xxxx \\\n  --function-name upload-s3 \\\n  --zip-file deployment.zip\n```\n\nUpdate lambda function from s3 object.\n\n```sh\n$ drone-lambda --region ap-southeast-1 \\\n  --access-key xxxx \\\n  --secret-key xxxx \\\n  --function-name upload-s3 \\\n  --s3-bucket some-bucket \\\n  --s3-key lambda-dir/lambda-project-${DRONE_BUILD_NUMBER}.zip\n```\n\n### Usage from docker\n\nUpdate lambda function from zip file.\n\n```bash\ndocker run --rm \\\n  -e AWS_ACCESS_KEY_ID=xxxxxxx \\\n  -e AWS_SECRET_ACCESS_KEY=xxxxxxx \\\n  -e FUNCTION_NAME=upload-s3 \\\n  -e ZIP_FILE=deployment.zip \\\n  -v $(pwd):$(pwd) \\\n  -w $(pwd) \\\n  appleboy/drone-lambda\n```\n\nUpdate lambda function from s3 object.\n\n```bash\ndocker run --rm \\\n  -e AWS_ACCESS_KEY_ID=xxxxxxx \\\n  -e AWS_SECRET_ACCESS_KEY=xxxxxxx \\\n  -e FUNCTION_NAME=upload-s3 \\\n  -e S3_BUCKET=some-bucket \\\n  -e S3_KEY=lambda-project.zip \\\n  appleboy/drone-lambda\n```\n\n### Usage from drone ci\n\nUpdate lambda function, execute from the working directory:\n\n```bash\ndocker run --rm \\\n  -e AWS_ACCESS_KEY_ID=xxxxxxx \\\n  -e AWS_SECRET_ACCESS_KEY=xxxxxxx \\\n  -e FUNCTION_NAME=upload-s3 \\\n  -e ZIP_FILE=deployment.zip \\\n  -v $(pwd):$(pwd) \\\n  -w $(pwd) \\\n  appleboy/drone-lambda\n```\n\n## Deploy with Drone\n\n```yaml\nkind: pipeline\nname: default\n\nsteps:\n- name: build\n  image: golang:1.15\n  commands:\n  - apt-get update \u0026\u0026 apt-get -y install zip\n  - cd example \u0026\u0026 GOOS=linux go build -v -a -o main main.go \u0026\u0026 zip deployment.zip main\n\n- name: deploy-lambda\n  image: appleboy/drone-lambda\n  settings:\n    pull: true\n    access_key:\n      from_secret: AWS_ACCESS_KEY_ID\n    secret_key:\n      from_secret: AWS_SECRET_ACCESS_KEY\n    region:\n      from_secret: AWS_REGION\n    function_name: gorush\n    zip_file: example/deployment.zip\n    debug: true\n```\n\n## AWS Policy\n\nAdd the following AWS policy if you want to integrate with CI/CD tools like Jenkins, GitLab Ci or Drone. Your function needs permission to upload trace data to [X-Ray](https://docs.aws.amazon.com/lambda/latest/dg/services-xray.html). When you activate tracing in the Lambda console, Lambda adds the required permissions to your function's execution role. Otherwise, add the [AWSXRayDaemonWriteAccess](https://console.aws.amazon.com/iam/home#/policies/arn:aws:iam::aws:policy/AWSXRayDaemonWriteAccess) policy to the execution role.\n\n```json\n{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Effect\": \"Allow\",\n      \"Action\": [\n        \"s3:PutObject\",\n        \"iam:ListRoles\",\n        \"lambda:UpdateFunctionCode\",\n        \"lambda:CreateFunction\",\n        \"lambda:GetFunction\",\n        \"lambda:GetFunctionConfiguration\",\n        \"lambda:UpdateFunctionConfiguration\"\n      ],\n      \"Resource\": \"arn:aws:logs:*:*:*\"\n    },\n    {\n      \"Effect\": \"Allow\",\n      \"Action\": [\n        \"xray:PutTraceSegments\",\n        \"xray:PutTelemetryRecords\",\n        \"xray:GetSamplingRules\",\n        \"xray:GetSamplingTargets\",\n        \"xray:GetSamplingStatisticSummaries\"\n      ],\n      \"Resource\": [\n        \"*\"\n      ]\n    }\n  ]\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappleboy%2Fdrone-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fappleboy%2Fdrone-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappleboy%2Fdrone-lambda/lists"}