简体   繁体   中英

RDS instances script automation

I am trying to create a bash script that will find my rds instance with a particular tag and stop the instance. For example, if my rds instance is running with the tag Name=application_name and value=abc, it should provide me the list of the instance and then stop those.

You should be able to use something like:

ID=$(aws resourcegroupstaggingapi get-resources --resource-type-filters rds:instance --tag-filters Key=application_name,Values=abc --output text)

aws rds stop-db-instance --db-instance-identifier $ID

I didn't test it, but that should get you going!

See: get-resources — AWS CLI Command Reference

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM