Skip to content

Instantly share code, notes, and snippets.

@linusthe3rd
Created June 24, 2015 14:18
Show Gist options
  • Save linusthe3rd/ff3a0d28848e19626056 to your computer and use it in GitHub Desktop.
Save linusthe3rd/ff3a0d28848e19626056 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