因为
get_all_launch_configurations
boto2
的函数,但是一个类似的函数
describe_launch_configurations
从
boto3
提到:
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/autoscaling.html#AutoScaling.Client.describe_launch_configurations
参数
最大记录
(整数)--返回此值的最大项数
打电话。默认值为50,最大值为100。
下一个
返回。(您从上一次通话中收到此令牌。)
的
get_all_launch_configurations()
名下
max_records
和
next_token
here
先打电话给
NextToken=""
您将获得前50个(或最多100个)启动配置。在返回的数据中查找
NextToken
下一个
.
data = conn.get_all_launch_configurations()
process_lc(data['LaunchConfigurations'])
while 'NextToken' in data:
data = conn.get_all_launch_configurations(next_token=data['NextToken'])
process_lc(data['LaunchConfigurations'])
希望有帮助:)
博托3
更新-boto2与boto3:
看起来像
博托2
不会再回来了
下一个
,它更好,更符合逻辑,真的:)
下面是一个实际的脚本:
#!/usr/bin/env python3
import boto3
def process_lcs(launch_configs):
for lc in launch_configs:
print(lc['LaunchConfigurationARN'])
client = boto3.client('autoscaling')
response = client.describe_launch_configurations(MaxRecords=1)
process_lcs(response['LaunchConfigurations'])
while 'NextToken' in response:
response = client.describe_launch_configurations(MaxRecords=1, NextToken=response['NextToken'])
process_lcs(response['LaunchConfigurations'])
我故意设置
MaxRecords=1