Skip to content

Instantly share code, notes, and snippets.

@ataylor284
Created August 2, 2024 23:13
Show Gist options
  • Save ataylor284/482ac72e6a9862a61e24b8ed65106223 to your computer and use it in GitHub Desktop.
Save ataylor284/482ac72e6a9862a61e24b8ed65106223 to your computer and use it in GitHub Desktop.
Redrive failed AWS state machines in FAILED state
THREADS=4
STATE_MACHINE_ARN="$1"
FILE=failed_arns.txt
REGION=us-west-2
echo "writing failed execution arns to $FILE"
aws stepfunctions list-executions --state-machine-arn=$STATE_MACHINE_ARN --status-filter FAILED --region $REGION --query 'executions[].[executionArn]' --output=text > $FILE
wc -l $FILE
# use xargs to do multiple in parallel
cat $FILE | xargs -L 1 -P $THREADS aws stepfunctions redrive-execution --output=text --execution-arn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment