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/__init__.py", line 38, in regions
    c = EC2Connection(**kw_params)
  File ".../site-packages/boto/ec2/connection.py", line 80, in __init__
    https_connection_factory, path)
  File ".../site-packages/boto/connection.py", line 515, in __init__
    debug,  https_connection_factory, path)
  File ".../site-packages/boto/connection.py", line 186, in __init__
    self.hmac = hmac.new(self.aws_secret_access_key, digestmod=sha)
  File "/opt/lib/python2.7/hmac.py", line 133, in new
    return HMAC(key, msg, digestmod)
  File "/opt/lib/python2.7/hmac.py", 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)

[1]: http://boto.cloudhackers.com/ec2_tut.html#a-note-about-regions