code-dumps/aws/list-resources-before-account-delete.sh

19 lines
692 B
Bash
Executable File

#!/usr/bin/env bash
alias nl="nl -s '. '"
shopt -s expand_aliases
echo "As of $(date), the following resources are detected on your AWS account $(aws sts get-caller-identity | jq .Account)"
echo ""
echo ec2:
aws ec2 describe-instances | jq -cr '.Reservations[] | .Instances[].InstanceId' | nl
echo rds:
aws rds describe-db-instances | jq -cr '.DBInstances[] | .DBInstanceIdentifier' | nl
echo lambda:
aws lambda list-functions | jq -cr '.Functions[] | .FunctionName' | nl
echo s3:
aws s3api list-buckets | jq -cr '.Buckets[] | .Name' | nl
echo efs:
aws efs describe-file-systems | jq -cr '.FileSystems[] | .FileSystemId' | nl
echo vpc:
aws ec2 describe-vpcs | jq -cr '.Vpcs[] | .VpcId' | nl