k. Next Steps & Clean up

Now that you have completed setup, you have many optional next steps. You can generate videos from the simulations, add Lambda functions generate videos, or add Lambda functions to send you notifications once jobs are processed.

Generate Videos from Simulations

The results of the simulations are exported to your S3 bucket as ZIP files. You can fetch the files, then view the RGB, segmentation, and depth images. In the AWS Management Console, locate the S3 Dashboard, then view your S3 bucket. Or, use the following command to find the name of your S3 bucket:

S3_BUCKET=$(aws cloudformation describe-stacks --stack-name $STACK_NAME --output text --query 'Stacks[0].Outputs[?OutputKey == `OutputBucket`].OutputValue')
echo 'Your S3 bucket is: $S3_BUCKET'

Then, list the content of your bucket using the following command:

aws s3 ls s3://$S3_BUCKET

Next, copy one of the files to your AWS Cloud9 IDE (or desktop) using the following command. Make sure to replace the_archive_to_retrieve with your archive name.

aws s3 cp s3://$S3_BUCKET/the_archive_to_retrieve.tar.gz .

After you have fetched and expanded the archive, you can build a movie from the images using the following code. Note that you must install ffmpeg yourself.

convert -quality 100 depth/*.png depth.mp4
convert -quality 100 rgb/*.png rgb.mp4
convert -quality 100 seg/*.png seg.mp4
ffmpeg -i depth.mp4 -i seg.mp4 -i rgb.mp4 -filter_complex "[0:v][1:v][2:v]hstack=3" -c:v libx264 -crf 0 output.mp4

What Else Can You Do?

You can also do any of the following tasks:

Make sure to let us know what cool things you are building!

Clean Up

After you complete the workshop, clean up your environment by following these steps. (Note that you can complete these steps in the AWS Management Console or run the commands in your Cloud9 terminal):

  1. Navigate to the AWS Batch Dashboard of the AWS Management Console.
  2. Choose Jobs. Select any running jobs and choose Terminate Job. (Alternatively, you can use the following script to terminate jobs in your Cloud9 environment terminal.)
cd ~
cat > ~/kill-all-jobs.sh << EOF

JQS=$(aws batch describe-job-queues --query "jobQueues[].[jobQueueName]" --output text)

echo $JQS
for jq in $JQS
        JOBS=$(aws batch list-jobs --job-queue ${jq} --job-status ${state} --query "jobSummaryList[].[jobId]" --output text)
        if [ ! -z "$JOBS" ]
            for job in $JOBS
                aws batch terminate-job --job-id ${job} --reason 'Terminating job'
                echo "Terminating ${job} in ${jq} with state ${state}"

bash kill-all-jobs.sh
  1. Choose Job definitions. Select the job definitions you created for this workshop and choose Actions, Deregister. Job definitions remain inactive for 180 days after which they are deleted. (Or, use the following script to remove all existing job definitions.)
cd ~
cat > ~/remove-jd.sh << EOF

echo "Removing job definitions"
JD_LIST=$(aws batch describe-job-definitions --query "jobDefinitions[*].[jobDefinitionArn]")
for jd in $JD_LIST
    aws batch deregister-job-definition --job-definition $jd

bash remove-jd.sh
  1. Choose Job queues. Select the queues you added for this workshop and choose Disable. After the job queues are disabled, select them again and choose Delete. (Or, use the following script to delete all job queues.)
cd ~
cat > ~/remove-jq.sh << EOF

echo "Remove all job queues "
JQ_LIST=$(aws batch describe-job-queues --query "jobQueues[*].jobQueueArn" | jq -r ".[]")
for jq in $JQ_LIST
  aws batch delete-job-queue --job-queue $jq

bash remove-jq.sh
  1. Choose Compute environments section. Select the compute environment you created for this workshop and choose Delete. Note that job queues must be deleted or disassociated from compute environments before the compute environment can be deleted. You can also run the following script:
cd ~
cat > ~/remove-ce.sh << EOF

echo "Remove all compute environments "
CE_LIST=$(aws batch describe-compute-environments --query "computeEnvironments[*].computeEnvironmentArn" | jq -r ".[]")
for ce in $CE_LIST
  aws batch delete-compute-environments --compute-environment $jq

bash remove-ce.sh
  1. Navigate to the ECR Dashboard of the AWS Management Console and delete the repository you created earlier.

  2. Either delete the previously created PrepAVWorkshop stack using the CLI or the AWS Management Console:

  • CLI: use the following command in your Cloud9 Environment:
aws cloudformation delete-stack --stack-name PrepAVWorkshop
  • Console: go to CloudFormation, select the right region and the PrepAVWorkshop stack and click on Delete