Skip to content

Instantly share code, notes, and snippets.

@gustavoapolinario
Created September 16, 2020 12:29
Show Gist options
  • Save gustavoapolinario/4149a615beb7f768623bea5070ecc730 to your computer and use it in GitHub Desktop.
Save gustavoapolinario/4149a615beb7f768623bea5070ecc730 to your computer and use it in GitHub Desktop.
Cancel All AWS Batchs Jobs to run
#! /bin/bash
for i in $(aws --profile [PROFILE] --region [REGION] batch list-jobs --job-queue [QUEUE] --job-status runnable --output text --max-items 10000 --query jobSummaryList[*].[jobId])
do
echo "Cancel Job: $i"
aws --profile [PROFILE] --region [REGION] batch cancel-job --job-id $i --reason "Cancelling job."
#echo "Job $i canceled"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment