为什么python for循环在第一个迭代实例停止?

时间:2018-01-31 19:26:09

标签: python-2.7 lambda boto3 rds

我正在更新python函数以获取rds实例的列表,其中包含'备份'标签设置为" true"但由于某种原因,for循环在第一个实例停止。

我们有10个rds实例。

有人可以告诉我,我在这里做错了吗?

以下是代码:

def get_instances(region)
    rds = boto3.client('rds', region)
    instances_to_snapshot = []

    response = rds.describe_db_instances()

    aurora = "aurora"
    oracle = "oracle-se1"
    aurora_list = []

    instances = response['DBInstances']
    for instance in instances:
        engine = instance['Engine']
        if get_rds_instance_tag(region, instance['DBInstanceIdentifier'], 'Backup'):
            print "This instance - %s has engine - %s " % (instance['DBInstanceIdentifier'], engine)
            instances_to_snapshot.append(instance['DBInstanceIdentifier'])
    return instances_to_snapshot

谢谢

1 个答案:

答案 0 :(得分:0)

Found it!! The issue was 'Time out' setting in lambda.. haha It was set to "3 seconds" No wonder function didn't work correctly.