我试图使用Python 2.7编写的AWS Lambda函数来停止RDS实例。但是我无法使用标记过滤器获取实例。
import boto3
import logging
rds = boto3.client('rds')
def lambda_handler(event, context):
filters = [{
'Name': 'tag:Application',
'Values': ['appname']
},
{
'Name': 'instance-state-name',
'Values': ['running']
}
]
instances = rds.get_all_dbinstances.filter(Filters=filters)
instances.status
获取具有指定标记的所有实例
这是我得到的错误:
{
"stackTrace": [
[
"/var/task/lambda_function.py",
18,
"lambda_handler",
"instances = rds.get_all_dbinstances(Filters=filters)"
],
[
"/var/runtime/botocore/client.py",
553,
"__getattr__",
"self.__class__.__name__, item)"
]
],
"errorType": "AttributeError",
"errorMessage": "'RDS' object has no attribute 'get_all_dbinstances'"
}