the code below enumerate the list of vpc-id and make them into dictionary, the purpose is to make use of this dictionary to give a menu option for user.
import boto3 vpc_id_collector = [] menu_dict = {} i=0 filter = [{'Name':'tag:Name', 'Values':['*']}] ec2_client = boto3.client('ec2') """:type : pyboto3.ec2""" vpcs = ec2_client.describe_vpcs(Filters=filter)['Vpcs'] for vpc in vpcs: vpc_id_collector.append(vpc['VpcId']) for i in range(len(vpc_id_collector)): j = i + 1 menu_dict[j] = vpc_id_collector[i] print(menu_dict)