Reputation: 31
I'm looking for an AWS RDS CLI command that will return Instance Class value for an Aurora instance in a cluster ? Please let know if anyone know what this is because I can't find it. You would think this would be apart of the describe-db-clusters
I'm trying to return the db.t2.medium value from the AWS RDS CLI.
Upvotes: 1
Views: 3256
Reputation: 10333
To get Cluster details we can use describe-db-clusters:
aws rds describe-db-clusters --db-cluster-identifier my-cluster
To get Instance details we can use describe-db-instances:
aws rds describe-db-instances --db-instance-identifier my-instance-one --query 'DBInstances[].DBInstanceClass'
To get all instance details using cluster identifier, we can execute describe-db-instances
for every instance returned by describe-db-clusters
aws rds describe-db-clusters --db-cluster-identifier my-cluster | jq -r ".DBClusters[].DBClusterMembers[].DBInstanceIdentifier" | xargs -I {} aws rds describe-db-instances --db-instance-identifier {} --query 'DBInstances[].{Intance:DBInstanceIdentifier, Class:DBInstanceClass}'
Upvotes: 0
Reputation: 238329
If you are using linux and bash you can write basic for loop to get the class of each instance in an aurora cluster. Combination of describe-db-clusters and describe-db-instances is used.
cluster_id="database-1"
for db_id in $(aws rds describe-db-clusters \
--db-cluster-identifier ${cluster_id} \
--query 'DBClusters[0].DBClusterMembers[].DBInstanceIdentifier' \
--output text); do
db_instance_class=$(aws rds describe-db-instances \
--db-instance-identifier ${db_id} \
--query 'DBInstances[0].DBInstanceClass'\
--output text)
echo "${db_id}: ${db_instance_class}"
done
The example result is:
database-1-instance-1-ap-southeast-2c: db.t2.small
database-1-instance-1: db.t2.small
Upvotes: 0