Skip to content

Instantly share code, notes, and snippets.

@vincentclaes
Last active February 17, 2021 07:33
Show Gist options
  • Save vincentclaes/09c65b6adf53d93f52e8b82356006b24 to your computer and use it in GitHub Desktop.
Save vincentclaes/09c65b6adf53d93f52e8b82356006b24 to your computer and use it in GitHub Desktop.
bulk delete aws resources (stepfunctions / lambda / ....)

stepfunctions

export PROFILE=some-profile
aws stepfunctions list-state-machines --region eu-central-1 --profile $PROFILE | jq -r '.stateMachines | .[] | .stateMachineArn' |
while read uname1; do
echo "Deleting $uname1";
aws stepfunctions delete-state-machine --region eu-central-1 --state-machine-arn $uname1 --profile $PROFILE;
done

lambda

export PROFILE=some-profile
aws lambda list-functions --region us-east-1 --profile $PROFILE | jq -r '.Functions | .[] | .FunctionName' |
while read uname1; do
echo "Deleting $uname1";
aws lambda delete-function --region us-east-1 --function-name $uname1 --profile $PROFILE;
done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment