Skip to content

Destroy Specific AWS Resources #61

Destroy Specific AWS Resources

Destroy Specific AWS Resources #61

Workflow file for this run

name: Destroy Specific AWS Resources
on:
schedule:
- cron: '0 0 * * *' # Runs at midnight every day
workflow_dispatch: # Allows manual triggering
jobs:
destroy-resources:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up AWS CLI
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Install Cloud Nuke
run: |
curl -LO https://github.com/gruntwork-io/cloud-nuke/releases/download/v0.37.1/cloud-nuke_linux_amd64
chmod +x cloud-nuke_linux_amd64
sudo mv cloud-nuke_linux_amd64 /usr/local/bin/cloud-nuke
- name: Verify Cloud Nuke Installation
run: |
/usr/local/bin/cloud-nuke --version
- name: Run Cloud Nuke to delete specific resources
run: |
/usr/local/bin/cloud-nuke aws --region us-east-1 --region us-east-2 --force
/usr/local/bin/cloud-nuke aws --region us-east-1 --resource-type ec2 --resource-type rds --resource-type s3 --force
/usr/local/bin/cloud-nuke aws --region us-east-2 --resource-type ec2 --resource-type rds --resource-type s3 --force
/usr/local/bin/cloud-nuke aws --region ap-south-1 --resource-type ec2 --resource-type rds --resource-type s3 --force