Search code examples
amazon-web-servicescmdaws-cli

How to start RDS database instance using AWS CLI?


I have a DB instance on AWS RDS.

I have a Windows cmd script supposed to start a db instance. Once it's started, it should continue some other operations.

    aws rds start-db-instance --db-instance-identifier SomeDatabase
    aws rds wait db-instance-available --db-instance-identifier SomeDatabase
    aws ec2 start-instances --instance-ids i-xxxxxxxxxxxxxxxxx
    aws ec2 wait instance-running --instance-ids i-xxxxxxxxxxxxxxxxx

The first line of the script works and starts the database. However it writes a long JSON description of the instance. The JSON description is so long that I have to manually press enter until the entire JSON is printed to the screen before continuing other operations.

How can I start an instance without printing the descriptive JSON or without any manually required intervention ?


Solution

  • Use --no-cli-pager in your commands. This will prevent the default behaviour of paginating output.

    You can remove this behaviour by default by setting this configuration:

    [default]
    cli_pager=
    

    See: Using AWS CLI pagination options

    Alternatively, you could specify the output you want rather than the default "show all" by using the --query parameter.