Skip to content

Delete unattached (available) EBS volumes in all AWS regions #4

Delete unattached (available) EBS volumes in all AWS regions

Delete unattached (available) EBS volumes in all AWS regions #4

name: Delete unattached (available) EBS volumes in all AWS regions
on:
workflow_dispatch: # This event allows manual triggering from the Github UI
secrets:
BUNDLE_KUBEFLOW_EKS_AWS_ACCESS_KEY_ID:
required: true
BUNDLE_KUBEFLOW_EKS_AWS_SECRET_ACCESS_KEY:
required: true
inputs:
region:
description: 'Insert the AWS Region name in which the script will delete unattached volumes. Running it with an empty region means that it will delete unattached volumes in the ALL available regions.'
required: false
default: ''
workflow_call:
secrets:
BUNDLE_KUBEFLOW_EKS_AWS_ACCESS_KEY_ID:
required: true
BUNDLE_KUBEFLOW_EKS_AWS_SECRET_ACCESS_KEY:
required: true
inputs:
region:
description: 'Insert the AWS Region name in which the script will delete unattached volumes. Running it with an empty region means that it will delete unattached volumes in the ALL available regions.'
required: false
default: ''
type: string
jobs:
delete-volumes:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Configure AWS Credentials
env:
AWS_ACCESS_KEY_ID: ${{ secrets.BUNDLE_KUBEFLOW_EKS_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.BUNDLE_KUBEFLOW_EKS_AWS_SECRET_ACCESS_KEY }}
run: |
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
aws configure set default.region eu-central-1
- name: Install requirements
run: |
python -m pip install --upgrade pip
python -m pip install boto3
python -m pip install tenacity
- name: Run delete volumes script
run: python scripts/delete_volumes.py ${{ inputs.region }}