Search code examples
amazon-web-servicesaws-clirds

Stopping an RDS instance via CLI


I am trying to use one of AWS's latest features where it allows you to stop an RDS instance.

I followed this doc where it explains that I need to run the command: aws rds stop-db-instance --db-instance-identifier mydbinstance however, when I do that I get this:

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help
aws: error: argument operation: Invalid choice, valid choices are:

add-role-to-db-cluster                   | add-source-identifier-to-subscription
add-tags-to-resource                     | apply-pending-maintenance-action

and it continues to list other RDS commands but not including stop-db-instance. I updated my CLI and the current version that I have is: aws-cli/1.11.11 Python/2.7.9 Windows/8 botocore/1.4.68

What am I missing?

UPDATE

I tried to upgrade the aws cli again but what I'm getting back is that everything is up to date:

C:\Users\n.ihab>aws --version
aws-cli/1.11.11 Python/2.7.9 Windows/8 botocore/1.4.68

C:\Users\n.ihab>pip install awscli --upgrade
Requirement already up-to-date: awscli in c:\python34\lib\site-packages
Requirement already up-to-date: rsa<=3.5.0,>=3.1.2 in c:\python34\lib\site-packages (from awscli)
Requirement already up-to-date: colorama<=0.3.7,>=0.2.5 in c:\users\n.ihab\appdata\roaming\python\python34\site-packages (from awscli)
Requirement already up-to-date: docutils>=0.10 in c:\users\n.ihab\appdata\roaming\python\python34\site-packages (from awscli)
Requirement already up-to-date: botocore==1.5.72 in c:\python34\lib\site-packages (from awscli)
Requirement already up-to-date: PyYAML<=3.12,>=3.10 in c:\users\n.ihab\appdata\roaming\python\python34\site-packages (from awscli)
Requirement already up-to-date: s3transfer<0.2.0,>=0.1.9 in c:\python34\lib\site-packages (from awscli)
Requirement already up-to-date: pyasn1>=0.1.3 in c:\python34\lib\site-packages (from rsa<=3.5.0,>=3.1.2->awscli)
Requirement already up-to-date: python-dateutil<3.0.0,>=2.1 in c:\users\n.ihab\appdata\roaming\python\python34\site-packages (from botocore==1.5.72->awscli)
Requirement already up-to-date: jmespath<1.0.0,>=0.7.1 in c:\users\n.ihab\appdata\roaming\python\python34\site-packages (from botocore==1.5.72->awscli)
Requirement already up-to-date: six>=1.5 in c:\users\n.ihab\appdata\roaming\python\python34\site-packages (from python-dateutil<3.0.0,>=2.1->botocore==1.5.72->awscli)

C:\Users\n.ihab>aws --version
aws-cli/1.11.11 Python/2.7.9 Windows/8 botocore/1.4.68

Is there something else I need to upgrade prior to this step?


Solution

  • It is a new feature and available since CLI version 1.11.95. Latest version is 1.11.109. Update to the latest AWS CLI version and you can use stop-db-instance

    Before upgrade

    $ aws --version
    aws-cli/1.11.83 Python/2.7.10 Linux/4.1.17-22.30.amzn1.x86_64 botocore/1.5.46
    
    $ aws rds stop-db-instance    
    aws: error: argument operation: Invalid choice, valid choices are:
    

    Upgrade CLI and reboot (Linux)

    $ sudo pip install awscli --upgrade
    

    After upgrade

    $ aws --version
    aws-cli/1.11.109 Python/2.6.9 Linux/4.1.17-22.30.amzn1.x86_64 botocore/1.5.72
    
    $ aws rds stop-db-instance
    aws: error: argument --db-instance-identifier is required