Skip to content

Feature Request: Add an option to delete older ones #34

@saitotqr

Description

@saitotqr

Problem

When deploying Lambda functions with versioning continuously, the number of versions accumulates over time. This can eventually lead to the CodeStorageExceededException when the total code storage size for the region hits the 75GB limit. This issue usually occurs when the package size is large due to extensive dependencies.

Currently, there is no built-in mechanism within this action to clean up old, unused versions.

Proposed Solution

I propose adding a new input option, for example, versions-to-retain .

This option would allow users to specify the number of recent versions they want to keep. For instance,

if a user sets versions-to-retain: 10 , the action would delete all versions except for the 10 most recent ones (and $LATEST ) after a successful deployment. This would automate the cleanup process and prevent hitting the code storage limit, making the CI/CD pipeline more robust and manageable.

Use Case

- name: Deploy to production
  uses: aws-actions/aws-lambda-deploy@v1
  with:
    function-name: my-function-prod
    versions-to-retain: 10 # New option

alternatives

The current workaround are

  • Manually deleting old versions via the AWS Management Console or AWS CLI.
  • Running a separate script or a scheduled Lambda function to perform the cleanup.

These methods are cumbersome, require extra maintenance, and are disconnected from the deployment process itself. Integrating this cleanup logic directly into the deployment action would be better solution I think.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions