Owen Murray
Owen Murray

Reputation: 133

How to delete all AWS Transcribe Jobs at once through CLI?

I am trying to delete all of my AWS Transcribe jobs at the same time. I know I can go through and delete them one by one through the console, and I can also delete them all through the CLI through the following command:

$ aws transcribe delete-transcription-job --transcription-job-name YOUR_JOB_NAME

The issue with this is that I have to do this for each individual job! I am dealing with them on a mass scale (about 1000 jobs), and I don't want to have to go in and delete each one manually (even with a Automator set up on my Mac, this is not efficient'. Is there anyway to just delete every Transcribe job instead of putting the specific job name in?

Upvotes: 1

Views: 815

Answers (1)

Dude0001
Dude0001

Reputation: 3450

It doesn't look like it. The closest option is to write a script that lists out all the jobs with list-transcription-jobs and then loops through deleting them:

for jobName in $(aws transcribe list-transcription-jobs --query '[TranscriptionJobSummaries[*].TranscriptionJobName]' --output text);
  do aws transcribe delete-transcription-job --transcription-job-name $jobName;
done

Note there is sometimes a limit to the number of records AWS CLI will return in one call. You may have to run this multiple times or write the script to use the --next-token argument to page through the entire list of jobs.

See: delete-transcription-job — AWS CLI Command Reference

Upvotes: 2

Related Questions