Clean up resources
You would clean up resources in the following order:
- Access the management interface of AWS Step Functions.
- Click on state machine ApplicationProcessingStateMachine-xxxxxxxxxxxx.
- Click on the execution that is running.

- Click Stop execution to stop the execution of the state machine.

Make sure no more executions are in running state before you proceed to the next step. AWS Cloud Formation will not perform state machine deletion if there is still execution running.
- Return to the Cloud9 Instance interface. run the following command to delete the AWS CloudFormation stack that AWS SAM created for our application.
REGION=$(grep region samconfig.toml | awk -F\= '{gsub(/"/, "", $2); gsub(/ /, "", $2); print $2}')
STACK_NAME=$(grep stack_name samconfig.toml | awk -F\= '{gsub(/"/, "", $2); gsub(/ /, "", $2); print $2}')
aws cloudformation delete-stack --region $REGION --stack-name $STACK_NAME

- Access the management interface Cloud9 service
- Select Cloud9 Instance StepFunctions.
- Click Delete.

- Enter Delete to confirm.
- Click Delete to proceed to delete Cloud9 Instance.
