AWS RDS status while creating the RDS via CLI

Viewed 3723

I am creating the RDS via AWS CLI using

create-db-instance

RDS is getting created but I want to wait until the RDS comes to "available" state so that I can execute the remaining part of the script. I am not sure how can I achieve that.

3 Answers

Use the waiters as provided by the AWS SDK in its CLI. Specifically, you want to wait until RDS DB instance becomes available. Look at db-instance-available.

aws rds wait \
    db-instance-available \
    --db-instance-identifier "your-rds-instnace-id"

Never tried this. But the following CLI is what you need:

aws rds wait db-instance-available --db-instance-identifier <value>

Wait until JMESPath query DBInstances[].DBInstanceStatus returns available for all elements when polling with describe-db-instances. It will poll every 30 seconds until a successful state has been reached. This will exit with a return code of 255 after 60 failed checks.

Related