Archive for June, 2013

Dynamo AWS python script list all tables , structure and items

June 5, 2013

Hi All

just tried to look in Amazon Dynamo and python , as beginner and no programmer , maybe there are others out and I share my work .

All the best

Allways a Beginner

 

import boto.dynamodb
import boto.dynamodb.condition

#AWS setting
access_key_id = “Your AWS Key”
secret_key = “Your AWS secret key”
aws_region=”us-west-2″

#connect to AWS
conn = boto.connect_dynamodb( access_key_id, secret_key)

#list all tables at amazon and show structure
awstables = conn.list_tables()
for item in awstables:
      print “Table: “
      print item
      awstables_desc= conn.describe_table(item)
      print “Tabledescription :”
      print awstables_desc
      # list database items
      awstable = conn.get_table(item)
      if awstable.item_count > 0:
              db_line = awstable.scan()
              for i in db_line:
                      print “Item : “
                      print i