{"id":15698674,"url":"https://github.com/int128/deploy-lambda-action","last_synced_at":"2026-05-16T02:20:55.180Z","repository":{"id":138190699,"uuid":"609350907","full_name":"int128/deploy-lambda-action","owner":"int128","description":"Deploy code to existing AWS Lambda function in GitHub Actions","archived":false,"fork":false,"pushed_at":"2026-04-17T21:53:09.000Z","size":47201,"stargazers_count":5,"open_issues_count":4,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-17T23:36:19.229Z","etag":null,"topics":["aws","aws-lambda","github-actions"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/int128.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-03-03T23:36:12.000Z","updated_at":"2026-04-17T21:52:47.000Z","dependencies_parsed_at":"2026-01-03T05:04:06.341Z","dependency_job_id":null,"html_url":"https://github.com/int128/deploy-lambda-action","commit_stats":{"total_commits":696,"total_committers":2,"mean_commits":348.0,"dds":"0.033045977011494254","last_synced_commit":"af56c742fccb5c8efc74193118e2b5db52844dd9"},"previous_names":[],"tags_count":354,"template":false,"template_full_name":"int128/typescript-action","purl":"pkg:github/int128/deploy-lambda-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/int128%2Fdeploy-lambda-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/int128%2Fdeploy-lambda-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/int128%2Fdeploy-lambda-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/int128%2Fdeploy-lambda-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/int128","download_url":"https://codeload.github.com/int128/deploy-lambda-action/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/int128%2Fdeploy-lambda-action/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32274982,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-25T18:29:39.964Z","status":"ssl_error","status_checked_at":"2026-04-25T18:29:32.149Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","aws-lambda","github-actions"],"created_at":"2024-10-03T19:32:00.261Z","updated_at":"2026-04-25T20:01:09.262Z","avatar_url":"https://github.com/int128.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# deploy-lambda-action [![ts](https://github.com/int128/deploy-lambda-action/actions/workflows/ts.yaml/badge.svg)](https://github.com/int128/deploy-lambda-action/actions/workflows/ts.yaml)\n\nThis is an action to deploy a code to an existing Lambda function.\n\n## Getting Started\n\nBefore using this action, you need to create a Lambda function.\nThis action is designed to manage a function and code separately as follows:\n\n- Manage a Lambda function with your IaC tool such as Terraform or CloudFormation.\n- Deploy the function code in GitHub Actions.\n\nYou can choose either an archive or a container image as the deployment package.\n\n### (Option 1) Deploy an archive\n\nHere is an example to deploy a zip archive to a Lambda function.\n\n```yaml\non:\n  pull_request:\n  push:\n    branches:\n      - main\n\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n    permissions:\n      id-token: write\n      contents: read\n    steps:\n      - uses: actions/checkout@v6\n      # Build an archive\n      - run: zip dist.zip ...\n      # Deploy a function\n      - uses: aws-actions/configure-aws-credentials@v4\n        with:\n          role-to-assume: arn:aws:iam::ACCOUNT:role/ROLE\n          aws-region: REGION\n      - uses: int128/deploy-lambda-action@v1\n        with:\n          function-name: my-function\n          alias-name: ${{ github.event.pull_request.number \u0026\u0026 format('pr-{0}', github.event.pull_request.number) || github.ref_name }}\n          alias-description: GitHub Actions ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\n          zip-path: dist.zip\n```\n\nFor pull_request events, it creates an alias of pull request number such as `pr-12345`.\nFor push events, it creates an alias of branch name such as `main` or `production`.\n\n### (Option 2) Deploy a container image\n\nHere is an example to deploy a container image to a Lambda function.\n\n```yaml\non:\n  pull_request:\n  push:\n    branches:\n      - main\n\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n    permissions:\n      id-token: write\n      contents: read\n    steps:\n      - uses: actions/checkout@v6\n      - uses: aws-actions/configure-aws-credentials@v4\n        with:\n          role-to-assume: arn:aws:iam::ACCOUNT:role/ROLE\n          aws-region: REGION\n\n      # Build a container image\n      - uses: aws-actions/amazon-ecr-login@v1\n        id: ecr\n      - uses: docker/metadata-action@v4\n        id: metadata\n        with:\n          images: ${{ steps.ecr.outputs.registry }}/${{ github.repository }}\n          flavor: latest=false\n      - uses: docker/build-push-action@v3\n        with:\n          push: true\n          tags: ${{ steps.metadata.outputs.tags }}\n          labels: ${{ steps.metadata.outputs.labels }}\n\n      # Deploy a function\n      - uses: int128/deploy-lambda-action@v1\n        with:\n          function-name: my-function\n          image-uri: ${{ steps.metadata.outputs.tags }}\n          alias-name: ${{ steps.metadata.outputs.version }}\n          alias-description: GitHub Actions ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\n```\n\nThis example creates an alias following the naming convention of [docker/metadata-action](https://github.com/docker/metadata-action).\n\nFor pull_request events, it creates an alias of pull request number such as `pr-12345`.\nFor push events, it creates an alias of branch name such as `main` or `production`.\n\n## Terraform examples\n\n### Lambda function\n\nHere is an example of Lambda function with an archive.\n\n```terraform\n# Terraform\nresource \"aws_lambda_function\" \"example\" {\n  function_name = \"example\"\n  role          = aws_iam_role.example_lambda.arn\n  handler       = \"main\"\n  runtime       = \"provided.al2\"\n\n  # The function code is updated by GitHub Actions.\n  filename = archive_file.dummy.output_path\n  lifecycle {\n    ignore_changes = [\n      filename,\n      publish,\n    ]\n  }\n}\n\nresource \"aws_iam_role\" \"example_lambda\" {\n  name               = \"example-lambda\"\n  assume_role_policy = data.aws_iam_policy_document.example_lambda_assume_role.json\n}\n\ndata \"aws_iam_policy_document\" \"example_lambda_assume_role\" {\n  statement {\n    actions = [\"sts:AssumeRole\"]\n    principals {\n      type        = \"Service\"\n      identifiers = [\"lambda.amazonaws.com\"]\n    }\n  }\n}\n\nresource \"archive_file\" \"dummy\" {\n  type        = \"zip\"\n  output_path = \"dummy.zip\"\n\n  source {\n    content  = \"dummy\"\n    filename = \"main\"\n  }\n}\n```\n\n### GitHub Actions IAM role\n\nThis action requires the following permissions:\n\n- `lambda:UpdateFunctionCode`\n- `lambda:CreateAlias`\n- `lambda:UpdateAlias`\n\nHere is an example of IAM Role for GitHub Actions.\n\n```terraform\n# Terraform\nresource \"aws_iam_role\" \"github_actions_deploy_lambda\" {\n  name               = \"github-actions-deploy-lambda\"\n  assume_role_policy = data.aws_iam_policy_document.github_actions_deploy_lambda_assume_role.json\n}\n\ndata \"aws_iam_policy_document\" \"github_actions_deploy_lambda_assume_role\" {\n  statement {\n    principals {\n      type        = \"Federated\"\n      identifiers = [\"arn:aws:iam::ACCOUNT:oidc-provider/token.actions.githubusercontent.com\"]\n    }\n    actions = [\"sts:AssumeRoleWithWebIdentity\"]\n    condition {\n      test     = \"StringLike\"\n      variable = \"token.actions.githubusercontent.com:sub\"\n      values   = [\"repo:OWNER/REPO:*\"]\n    }\n  }\n}\n\nresource \"aws_iam_role_policy\" \"github_actions_deploy_lambda\" {\n  role   = aws_iam_role.github_actions_deploy_lambda.id\n  name   = \"update-lambda\"\n  policy = data.aws_iam_policy_document.github_actions_deploy_lambda.json\n}\n\ndata \"aws_iam_policy_document\" \"github_actions_deploy_lambda\" {\n  statement {\n    effect = \"Allow\"\n    actions = [\n      \"lambda:UpdateFunctionCode\",\n      \"lambda:CreateAlias\",\n      \"lambda:UpdateAlias\",\n    ]\n    resources = [\n      \"arn:aws:lambda:REGION:ACCOUNT:function:FUNCTION\",\n    ]\n  }\n}\n```\n\n## Specification\n\n### Inputs\n\n| Name                | Description                                                                                                                                 |\n| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |\n| `function-name`     | Name of the function                                                                                                                        |\n| `image-uri`         | URI of the container image, i.e., `ACCOUNT.dkr.ecr.REGION.amazonaws.com/NAME:VERSION` or `ACCOUNT.dkr.ecr.REGION.amazonaws.com/NAME@DIGEST` |\n| `zip-path`          | Path to the archive                                                                                                                         |\n| `architecture`      | If set, update the architecture of the function. Either `x86_64` or `arm64` (optional)                                                      |\n| `alias-name`        | If set, create or update the function alias (optional)                                                                                      |\n| `alias-description` | Description of the function alias (optional)                                                                                                |\n\nEither `image-uri` or `zip-path` must be set.\n\n### Outputs\n\n| Name                   | Description              |\n| ---------------------- | ------------------------ |\n| `function-version`     | Published version        |\n| `function-version-arn` | ARN of published version |\n| `function-alias-arn`   | ARN of alias             |\n\n## Alternative\n\nIf you want to leave out using this action, you can directly call AWS CLI commands such as [`aws lambda update-function-code`](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/lambda/update-function-code.html).\n\nHere is an example script.\n\n```bash\n# Update function code with a zip archive\nVERSION=\"$(aws lambda update-function-code --function-name \"$FUNCTION\" --zip-file fileb://path/to/archive.zip --publish --query 'Version' --output text)\"\n\n# Create or update an alias\naws lambda update-alias --function-name \"$FUNCTION\" --name \"$ALIAS\" --function-version \"$VERSION\" ||\naws lambda create-alias --function-name \"$FUNCTION\" --name \"$ALIAS\" --function-version \"$VERSION\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fint128%2Fdeploy-lambda-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fint128%2Fdeploy-lambda-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fint128%2Fdeploy-lambda-action/lists"}