-
Notifications
You must be signed in to change notification settings - Fork 0
31 lines (31 loc) · 1.43 KB
/
cloudnuke.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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