Cleanup AWS resources.
Go to file
Richard Case 1ca737e996
init: initial simple version of the janitor
Signed-off-by: Richard Case <richard.case@suse.com>
2023-11-03 10:27:03 +01:00
.github/workflows init: initial simple version of the janitor 2023-11-03 10:27:03 +01:00
action init: initial simple version of the janitor 2023-11-03 10:27:03 +01:00
.gitignore init: initial simple version of the janitor 2023-11-03 10:27:03 +01:00
Dockerfile init: initial simple version of the janitor 2023-11-03 10:27:03 +01:00
LICENSE Initial commit 2023-11-02 16:29:15 +00:00
Makefile init: initial simple version of the janitor 2023-11-03 10:27:03 +01:00
README.md init: initial simple version of the janitor 2023-11-03 10:27:03 +01:00
action.yml init: initial simple version of the janitor 2023-11-03 10:27:03 +01:00
go.mod init: initial simple version of the janitor 2023-11-03 10:27:03 +01:00
go.sum init: initial simple version of the janitor 2023-11-03 10:27:03 +01:00
main.go init: initial simple version of the janitor 2023-11-03 10:27:03 +01:00

README.md

AWS Janitor

A GitHub Action to cleanup AWS resources that have exceeded a TTL.

By default the action will not perform the delete (i.e. it will be a dry-run). You need to explicitly set commit to true.

It supports cleaning up the following services:

  • EKS Clusters
  • Auto Scaling Groups

Inputs

Name Required Description
regions Y A comma seperated list of regions to clean resources in. You can use * for all regions
allow-all-regions N Set to true if use * from regions.
ttl Y The duration that a resource can live for. For example, use 24h for 1 day.
commit N Whether to perform the delete. Defaults to false which is a dry run

Example Usage

jobs:
  cleanup:
    runs-on: ubuntu-latest
    name: Cleanup resource groups
    steps:
      - name: Cleanup
        uses: rancher-sandbox/aws-janitor@v0.1.0
        with:
            regions: eu-west-1
            ttl: 168h
        env:
            AWS_ACCESS_KEY_ID: {{secrets.AWS_ACCESS_KEY_ID}}
            AWS_SECRET_ACCESS_KEY: {{secrets.AWS_SECRET_ACCESS_KEY}}

Implementation Notes

It currently assumes that an instance of a service will have some form of creation date. This means that the implementation can be simpler as it doesn't need to adopt a "mark & sweep" pattern that requires saving state between runs of the action.