Skip to content

GitHub Action to automatically publish a new version of an AWS Lambda function and set up provisioned concurrency.

License

Notifications You must be signed in to change notification settings

IronCloud/setup-provisioned-concurrency

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Setup Provisioned Concurrency GitHub Action

This GitHub Action sets up and cleans up provisioned concurrency for a specified AWS Lambda function. It automatically publishes a new version of the Lambda function, sets up provisioned concurrency for that version, and deletes older versions along with their provisioned concurrency configurations.

Prerequisites

IAM Permissions

The AWS credentials used must have the following IAM permissions:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "lambda:PublishVersion",
        "lambda:PutProvisionedConcurrencyConfig",
        "lambda:ListVersionsByFunction",
        "lambda:DeleteProvisionedConcurrencyConfig",
        "lambda:DeleteFunction"
      ],
      "Resource": "arn:aws:lambda:REGION:ACCOUNT_ID:function:FUNCTION_NAME"
    }
  ]
}

Replace REGION, ACCOUNT_ID, and FUNCTION_NAME with your AWS region, account ID, and the name of your Lambda function, respectively.

Usage

Here's a sample workflow to demonstrate how to use this action:

name: Setup Provisioned Concurrency

on:
  push:
    branches:
      - main

jobs:
  setup:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout code
      uses: actions/checkout@v3

    - name: Configure AWS credentials
      uses: aws-actions/configure-aws-credentials@v3
      with:
        aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
        aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        aws-region: us-west-2

    - name: Deploy Chalice App
      run: |
        cd my-app/
        chalice deploy        

    - name: Setup Provisioned Concurrency
      uses: IronCloud/setup-provisioned-concurrency@v2
      with:
        function-name: 'your-lambda-function-name'
        provisioned-concurrency: 5

Replace your-github-username with your GitHub username and your-lambda-function-name with the name of your Lambda function.

Inputs

Input Description Required
function-name The name of the AWS Lambda function. Yes
provisioned-concurrency The number of provisioned concurrency to set up. Yes

Outputs

  • new-version: The new version of the Lambda function that was published.
  • provisioned-concurrency: The number of provisioned concurrency that was set up.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

About

GitHub Action to automatically publish a new version of an AWS Lambda function and set up provisioned concurrency.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages