Skip to content

Instantly share code, notes, and snippets.

@jsocol
Forked from linusthe3rd/gist:ff3a0d28848e19626056
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsocol/5d523508410b011d4bc9 to your computer and use it in GitHub Desktop.
Save jsocol/5d523508410b011d4bc9 to your computer and use it in GitHub Desktop.
from boto.dynamodb2 import connect_to_region
from boto.provider import Provider
aws_settings_provider = Provider('aws')
def create_connection():
aws_region = # get the AWS region of the EC2 instance
# connect_to_region passes along the named arguments
# to the DynamoDBConnection class that gets created
return connect_to_region(
aws_region,
provider=aws_settings_provider,
)
def get_item(key):
connection = create_connection()
# Perform DynamoDB operations...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment