-
Notifications
You must be signed in to change notification settings - Fork 16
/
run_describe_rds.py
executable file
·73 lines (51 loc) · 1.49 KB
/
run_describe_rds.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env python3.12
from env import env
from run_common import AWSCli
aws_cli = AWSCli()
def describe_db_subnet_groups():
cmd = ['rds', 'describe-db-subnet-groups']
cmd += ['--db-subnet-group-name', env['rds']['DB_SUBNET_NAME']]
# noinspection PyBroadException
try:
aws_cli.run(cmd)
except Exception:
return False
return True
def describe_db_instances():
cmd = ['rds', 'describe-db-instances']
cmd += ['--db-instance-identifier', env['rds']['DB_INSTANCE_ID']]
# noinspection PyBroadException
try:
aws_cli.run(cmd)
except Exception:
return False
return True
def describe_db_clusters():
cmd = ['rds', 'describe-db-clusters']
cmd += ['--db-cluster-identifier', env['rds']['DB_CLUSTER_ID']]
# noinspection PyBroadException
try:
aws_cli.run(cmd)
except Exception:
return False
return True
if __name__ == "__main__":
from run_common import parse_args
parse_args()
results = list()
if not describe_db_subnet_groups():
results.append('RDS Subnet Group -------------- X')
else:
results.append('RDS Subnet Group -------------- O')
if not describe_db_instances():
results.append('RDS Instance -------------- X')
else:
results.append('RDS Instance -------------- O')
if not describe_db_clusters():
results.append('RDS Cluster -------------- X')
else:
results.append('RDS Cluster -------------- O')
print('#' * 80)
for r in results:
print(r)
print('#' * 80)