The following snippet in the [Boto documentation][1] is used to get a list of EC2 regions:

import boto.ec2
regions = boto.ec2.regions()

Unfortunately when executed this code raises the following error:

Traceback (most recent call last):
    regions = boto.ec2.regions() 
  File ".../site-packages/boto/ec2/", line 38, in regions
    c = EC2Connection(**kw_params)
  File ".../site-packages/boto/ec2/", line 80, in __init__
    https_connection_factory, path)
  File ".../site-packages/boto/", line 515, in __init__
    debug,  https_connection_factory, path)
  File ".../site-packages/boto/", line 186, in __init__
    self.hmac =, digestmod=sha)
  File "/opt/lib/python2.7/", line 133, in new
    return HMAC(key, msg, digestmod)
  File "/opt/lib/python2.7/", line 68, in __init__
    if len(key) > blocksize:
TypeError: object of type 'NoneType' has no len()

To fix this you need to pass your access credentials (i.e. you cannot call regions anonymously):

regions = boto.ec2.regions(
    aws_access_key_id=XXX, aws_secret_access_key=XXX)