Amazon Cli Rds

list all the instances by name

aws rds describe-db-instances --output text  --query 'DBInstances[*].[DBInstanceIdentifier]'

list the tags of one instance

the command is explained here
you need to build an arn for db and this is explained here

example in Oregon Region

aws rds list-tags-for-resource --resource-name arn:aws:rds:us-west-2:9876543210:db:mydbname

list all the instances with a parameter group

aws rds describe-db-instances --output text  --query 'DBInstances[*]' | grep -B 5 "insert-the-parameter-group-name"

add a tag to an instance

aws rds add-tags-to-resource --resource-name arn:aws:rds:us-west-2:9876543210:db:mydbname --tags Key=ENVIRONMENT,Value=development

show all the backup windows of the rds

aws rds describe-db-instances --output text  --query 'DBInstances[*].[DBInstanceIdentifier,PreferredBackupWindow]'

change the backup window of all the rds

ALLRDS=`aws rds describe-db-instances --output text  --query 'DBInstances[*].[DBInstanceIdentifier]'`
#echo $ALLRDS
for line in $(echo $ALLRDS); do
   aws rds modify-db-instance --db-instance-identifier $line --preferred-backup-window 01:00-02:00 
Salvo diversa indicazione, il contenuto di questa pagina è sotto licenza Creative Commons Attribution-ShareAlike 3.0 License