Skip to content

Instantly share code, notes, and snippets.

@ipolyzos
Created October 23, 2020 00:13
Show Gist options
  • Save ipolyzos/933168fea618911ab55c7cdfa5dd47fa to your computer and use it in GitHub Desktop.
Save ipolyzos/933168fea618911ab55c7cdfa5dd47fa to your computer and use it in GitHub Desktop.
Cleanup AWS Batch Compute Environments
#!/usr/bin/env bash
# NOTE
# this script expects the user to be logged in
# to the right AWS account and have the proper
# credential to delete the compute environments
# Create a list with all the compute environments
CENV=($(aws batch describe-compute-environments --query 'computeEnvironments[*].computeEnvironmentName' --output text))
# Iteratate the compute environments list deleting each environment
for e in ${CENV};
do
aws batch delete-compute-environment --compute-environment $e;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment