Skip to content

Instantly share code, notes, and snippets.

View utahcon's full-sized avatar

Adam Barrett utahcon

View GitHub Profile

Keybase proof

I hereby claim:

  • I am utahcon on github.
  • I am utahcon (https://keybase.io/utahcon) on keybase.
  • I have a public key ASAeNg0N5MWnZ1j3YeSpV2mcqM-_G1C23zCahT6fw-AnvAo

To claim this, I am signing this object:

@utahcon
utahcon / oneliner_aws_sfn_stop_running.md
Last active July 3, 2023 17:28
Oneliner: stop all running AWS step-functions for given state-machine

NOTE: You will be required to have PROFILE and STATE_MACHINE_ARN set in your environment variables for the below to work. Alternatively set them as part of the oneliner.

The blow will query AWS for all RUNNING executions of your state-machine, then loop through each one sending a stop request. This will terminate the function in whatever state it happens to be in. This will NOT stop external work that has already been invoked. If you run into errors with the below, not that it is trying to run the stop command in parallel, so a smaller parallelism number may be appropriate for your use case.

$ aws --profile ${PROFILE} stepfunctions list-executions --state-machine-arn ${STATE_MACHINE_ARN} --status-filter RUNNING | grep executionArn | awk '{print $2}' | sed -e 's/\"//g' | sed -e 's/,//g' | xargs -L 1 -n 1 -P 10 aws --profile ${PROFILE} stepfunctions stop-execution --execution-arn

@utahcon
utahcon / communication
Last active May 23, 2016 07:00
Below is an example of controlling multiple processes/threads using golang.
package main
import (
"log"
"os"
"os/signal"
"sync"
"time"
)