Python导出aws ec2主机列表到csv文件
1. 背景
需要将AWS EC2主机批量导出到csv文件
Python3 导入所需包: boto3 csv
AWS: AK/SK 在aws控制台IAM中获取下载
2. Python脚本
import boto3
import csv
ec2 = boto3.client(
'ec2',
aws_access_key_id="xxxx",
aws_secret_access_key="xxxx",
region_name='ap-east-1',
)
# Retrieves all regions/endpoints that work with EC2
# response = ec2.describe_regions()
# print('Regions:', response['Regions'])
# Retrieves availability zones only for region of the ec2 object
# response = ec2.describe
http://www.cnblogs.com/Jame-mei
浙公网安备 33010602011771号