boto3获取aws lambda函数信息保存到excel

 

#coding:utf8
import boto3
import xlwt
lambda_client = boto3.client('lambda',region_name = 'cn-north-1')

workbook = xlwt.Workbook()
sheet1 = workbook.add_sheet('sheet1',cell_overwrite_ok=True)
sheet1.write(0,0,"函数名")
sheet1.write(0,1,"运行环境")
sheet1.write(0,2,"代码大小")
sheet1.write(0,3,"修改时间")
# print(lambda_client.list_functions())
llist = lambda_client.list_functions()
# print(llist['Functions'])
i = 1
for l in llist['Functions']:
    sheet1.write(i,0,l['FunctionName'])
    sheet1.write(i,1,l['Runtime'])
    sheet1.write(i,2,l['CodeSize'])
    sheet1.write(i,3,l['LastModified'])
    print(l['FunctionName'])
    print(l['Runtime'])
    print(l['CodeSize'])
    print(l['LastModified'])
    print('...........................')
    i+=1

workbook.save(u'lambda.xls')

 

posted @ 2019-01-07 16:33  老农夫  阅读(580)  评论(0编辑  收藏  举报