blog and things oh hi there!
Using Boto3 to access AWS in Python

Here are simple steps to get you connected to S3 and DynamoDB through Boto3 in Python.

S3

import boto3

s3_client = boto3.client('s3')
bucket = 'your-bucket-name'
prefix = 'path/to/folder'

# List all objects within a S3 bucket path
response = s3_client.list_objects(
    Bucket = bucket,
    Prefix = prefix
)

# Loop through each file
for file in response['Contents']:

    # Get the file name
    name = file['Key'].rsplit('/', 1)

    # Download each file to local disk
    s3_client.download_file(bucket, file['Key'], prefix + '/' + name[1])

DynamoDB

import boto3

dynamodb_client = boto3.resource('dynamodb')
table = dynamodb_client.Table('table_name')

# Create a record
table.put_item(
    Item = {
        'id': 1234,
        'name': str("kevin")
    }
© 2019 Kevin Jung