Home > Software engineering >  How to export dynamodb table using boto3?
How to export dynamodb table using boto3?

Time:02-04

I have written below the AWS lambda function to export dynamodb table to the S3 bucket. But when I execute the below code, I am getting an error

'dynamodb.ServiceResource' object has no attribute 'export_table_to_point_in_time'

import boto3
import datetime



def lambda_handler(event,context):
    client = boto3.resource('dynamodb',endpoint_url="http://localhost:8000")
    response = client.export_table_to_point_in_time(
        TableArn='table arn string',
        ExportTime=datetime(2015, 1, 1),
        S3Bucket='my-bucket',
        S3BucketOwner='string',
        ExportFormat='DYNAMODB_JSON'
    )

    print("Response :", response)

Boto 3 version : 1.24.82

CodePudding user response:

ExportTableToPointInTime is not available on DynamoDB Local, so if you are trying to do it in local (assumed from the localhost endpoint) you cannot.

Moreover, the Resource client does not have that API. You must use the Client client.

import boto3
dynamodb = boto3.client('dynamodb')
  • Related