#!/usr/bin/python
import numpy as np
import pandas as pd
import xlsxwriter
import boto3
data=[]
ec2client=boto3.client('ec2')
ec2res=boto3.resource('ec2')
list1=ec2client.describe_instances()
list2=list1['Reservations']
it=iter(list2)
for i in it:
    op=ec2res.Instance(id=i['Instances'][0]['InstanceId'])
    data.append([i['Instances'][0]['InstanceType'],op.private_ip_address,op.id])
df=pd.DataFrame(data,columns=['Instance-Type','Private-ip','instance-id'])
writer=pd.ExcelWriter('inventory.xlsx',engine='xlsxwriter')
df.to_excel(writer, sheet_name='dev')
writer.save()
print data
