-
Notifications
You must be signed in to change notification settings - Fork 126
RDS Commands
Google AWS RDS CLI for details on parameters. RDS supports the same action names and abbreviations as the CLI. The following notes are in addition to the CLI documentation.
The following actions are supported. The up-to-date list may be obtained by running aws --help
.
modify-db-instance mdb
delete-db-instance deldb
add-tags-to-resource cdbtags
describe-db-instances ddb
create-db-snapshot cdbsnap
describe-db-snapshots ddbsnap
copy-db-snapshot cpdbsnap
restore-db-instance-from-db-snapshot rdb
delete-db-snapshot deldbsnap
The parameters for each action may be obtained by running aws --help. e.g. aws ddb --help
describe-db-instances ddb [DBInstanceIdentifier] [--marker Marker] [--max-records MaxRecords|-m MaxRecords] [--filter ]
###add-tags-to-resource (cdbtags)
This is for all kinds of resources so its fully qualified. Tags are formatted as key=value pairs and multiple tags have multiple --tags
parameters:
add-tags-to-resource arn:aws:rds:ap-southeast-2:775488040364:db:loadtestlansa2 --tag Type=Test --tag Platform=x64
where the resource is generalized to:
arn:awsd:rds:<region>:<account>:<resource type>:<DB Instance Identifier>
###restore-db-instance-from-db-snapshot (rdb) See the wiki for RDS Example start db.pl, for an example usage of rdb.
A restored DB instance is not identical to the original. It will be started in a random AZ, it will not have a VPC security group and if its a MySQL database before 5.6, it will not retain the original backup retention period - its set to 0. Or maybe its not the version of MySQL but when the DB instance was launched. The example shows one way to restore the missing attributes.
###copy-db-snapshot (cpdbsnap)
Automated snapshots and manual snapshots are copied with a different syntax for the uri. Snapshots may be copied using this api and they can only be copied FROM the source region to the CURRENT region.
#####uri syntax for a snapshot
arn:aws:rds:[SRC REGION]:[AWS ACCOUNT NUMBER]:snapshot:[SRC SNAPSHOT NAME]
Note that an automated snapshot name as listed in the AWS console requires the 'rds:' prefix.
This copies the automated snapshot rds:lansadbinstance-2014-07-22-16-36
from Sydney to N. Virginia and names the target snapshot cp-region-snapshot
and tags it type=copy
:
cpdbsnap arn:aws:rds:ap-southeast-2:775488040364:snapshot:rds:lansadbinstance-2014-07-22-16-36 -t cp-region-snapshot --tag type=copy --region us-east-1
Manual snapshots may only be copied to another region. Only one snapshot may be copied across region at a time.