AWS WAIT command

Wait for …


When writing shell scripts by using the CLI there will be the need to wait for a specific condition from time to time. For example, after initiating an EBS snapshot your script might need to wait until the snapshot was completed. Waiting can be achieved with a polling loop and a describe-* command. But there is a simpler solution built into the CLI for this: aws <service> wait <condition>.

The following contains a wait command that will block the script until the snapshot has been completed.

#!/bin/bash
echo "Waiting for EBS snapshot"
aws ec2 wait snapshot-completed --snapshot-ids snap-id_abc
echo "EBS snapshot completed" 


You'll find many more uses for this, and hopefully no more corruption as commands compete.

Comments

Popular posts from this blog

Recursively Delete files of the Same Name in S3

Python - datetime Formatting

ORACLE RDS granting select privileges to users.