Beispiel #1
0
def lip_details(region, account, addr):
    filter = [{'Name':'addresses.private-ip-address', 'Values':[addr]}]
    ec2c = Session(profile_name=account).client('ec2', region)
    lip = ec2c.describe_network_interfaces(Filters = filter)['NetworkInterfaces']
    if not lip:
        lip = {'Result': 'Local IP address not found'}
    elif len(lip[0].keys()) >= 1:
        lip = lip[0]
        lip['Account_Info'] = [account,region]
    return lip
Beispiel #2
0
def eip_details(addr):
    filter = [{'Name': 'addresses.association.public-ip', 'Values': [addr]}]
    for account in accounts:
        for region in regions:
            ec2c = Session(profile_name=account).client('ec2', region)
            eip = ec2c.describe_network_interfaces(Filters = filter)['NetworkInterfaces']
            if not eip:
                eip = {'Result': 'EIP address Not found'}
            elif len(eip[0].keys())>= 1:
                eip = eip[0]
                eip['Account_Info'] = [account,region]
                break
        if len(eip.keys()) >1:
            break
    return eip