在哪里可以找到正确的数据库实例ID,作为
DBInstanceIdentifier
的{{1}}参数?
以下数据库显示在RDS仪表板上:
但是当我尝试使用以下脚本访问它时:
boto3.client('rds').describe_db_log_files()
我得到以下异常:
#!/usr/bin/env python3
from __future__ import print_function
import boto3
def list_audit_files(db_id):
response = client.describe_db_log_files(
DBInstanceIdentifier=db_id,
)
if __name__ == "__main__":
client = boto3.client('rds')
db_id = "eran-test-west-2-oracle"
list_audit_files(db_id)
我应该在哪里找到正确的数据库实例ID?
问题源于数据库运行(us-west-1)的区域与$ python3 so_db_instance.py
Traceback (most recent call last):
File "so_db_instance.py", line 14, in <module>
list_audit_files(db_id)
File "so_db_instance.py", line 8, in list_audit_files
DBInstanceIdentifier=db_id,
File "/usr/local/lib/python3.5/dist-packages/botocore/client.py", line 312, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/usr/local/lib/python3.5/dist-packages/botocore/client.py", line 601, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.errorfactory.DBInstanceNotFoundFault: An error occurred (DBInstanceNotFound) when calling the DescribeDBLogFiles operation: DBInstance eran-test-west-2-oracle not found.
中定义的默认区域之间的差异(欧盟 - 西-1)。
一旦~/.aws/config
中的区域被修复,问题就会消失。