getting started with boto3

221 views
Skip to first unread message

Robert Schweikert

unread,
Jan 15, 2016, 6:24:46 PM1/15/16
to boto-users
Hi,

Yes I am finally taking the plunge and moving stuff that I still have based on boto to boto3. At this point I cannot quite put the pieces together just yet and thus I'd like to find out if I am going down the right direction.

For example one I have code that can operate on all connected regions by self discovering the available regions. In boto this looked like this:

regions = []
regs = boto.ec2.regions()
for reg in regs:
    if reg.name in ['us-gov-west-1', 'cn-north-1']:
          continue
    regions.append(reg.name)

to do this in boto3 it appears that I have to jump through a lot more hoops:

s = boto3.session.Session(aws_access_key_id='',aws_secret_access_key='',region_name='')
ec2 = s.client(service_name='ec2',region_name='')
region_data = ec2.describe_regions()

process the returned dictionary.

Am I going down the right path or is there something that I am missing?

Thanks,
Robert
Reply all
Reply to author
Forward
0 new messages