Skip to content

Instantly share code, notes, and snippets.

@faermanj
Last active May 8, 2023 15:59
Show Gist options
  • Save faermanj/7eb211036ce3bf128af45d57018acd41 to your computer and use it in GitHub Desktop.
Save faermanj/7eb211036ce3bf128af45d57018acd41 to your computer and use it in GitHub Desktop.
Limpando sua conta da AWS com aws-nuke
accounts:
"192912639870": {} # ccsandbox
account-blocklist:
- "192912699999"
resource-types:
excludes:
- IAMGroup
- IAMGroupPolicy
- IAMGroupPolicyAttachment
- IAMInstanceProfile
- IAMInstanceProfileRole
- IAMLoginProfile
- IAMOpenIDConnectProvider
- IAMPolicy
- IAMRole
- IAMRolePolicy
- IAMRolePolicyAttachment
- IAMSAMLProvider
- IAMServerCertificate
- IAMServiceSpecificCredential
- IAMSigningCertificate
- IAMUser
- IAMUserAccessKey
- IAMUserGroupAttachment
- IAMUserPolicy
- IAMUserPolicyAttachment
- IAMUserSSHPublicKey
- IAMVirtualMFADevice
regions:
- global
- us-east-2
- us-east-1
- us-west-1
- us-west-2
- af-south-1
- ap-east-1
- ap-southeast-3
- ap-south-1
- ap-northeast-3
- ap-northeast-2
- ap-southeast-1
- ap-southeast-2
- ap-northeast-1
- ca-central-1
- cn-north-1
- cn-northwest-1
- eu-central-1
- eu-west-1
- eu-west-2
- eu-south-1
- eu-west-3
- eu-north-1
- me-south-1
- sa-east-1
name: cleanup_sandbox
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: false
default: 'warning'
schedule:
- cron: '33 3 * * *'
jobs:
build:
runs-on: ubuntu-latest
env:
AWS_REGION: us-west-2
URL: https://github.com/rebuy-de/aws-nuke/releases/download/v2.19.0/aws-nuke-v2.19.0-linux-amd64.tar.gz
OUTPUT: /tmp/aws-nuke/aws-nuke-v2.19.0-linux-amd64.tar.gz
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Configure AWS credentials (SANDBOX)
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.SB_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.SB_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Check AWS authentication
run: aws sts get-caller-identity
- name: MKDIR
run: mkdir /tmp/aws-nuke
- name: Download aws-nuke
run: curl -Ls $URL --output $OUTPUT
- name: Extract aws-nuke
run: tar zxvf $OUTPUT -C /tmp/aws-nuke
- name: Move aws-nuke to path
run: sudo mv /tmp/aws-nuke/aws-nuke-v2.19.0-linux-amd64 /usr/local/bin/aws-nuke
# - name: List resource types
# run: aws-nuke resource-types
- name: Try aws-nuke
run: aws-nuke -c ./aws-nuke/aws-nuke.yml --no-dry-run --force --force-sleep 3 | tee aws-nuke.log
continue-on-error: true
- name: Preserve log
uses: actions/upload-artifact@v3
with:
name: aws-nuke.log
path: "aws-nuke.log"
retention-days: 14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment