Skip to content Skip to sidebar Skip to footer

Amazon Dynamodb -- Region-specific Connection

I'm using the boto library in Python to connect to DynamoDB. The following code has been working for me just fine: import boto key = 'abc' secret = '123' con = boto.connect_dynam

Solution 1:

After playing around, I found out that changing the code to connect in this fashion works:

import boto
from boto.ec2.connection import EC2Connection
from boto.dynamodb import connect_to_region

key = 'abc'
secret = '123'
regions = EC2Connection(key,secret).get_all_regions()
for r in regions:
  con = connect_to_region(aws_access_key_id=key,aws_secret_access_key=secret,region_name=r.name)
  table = con.get_table('Table Name') # no problem
  -- rest of code --

Post a Comment for "Amazon Dynamodb -- Region-specific Connection"