rosstripi
rosstripi

Reputation: 584

boto3 says table is non-existent but I can query it in the AWS CLI

I'm trying to get a table description using boto3 and python using the following snippet:

import boto3

dynamodb = boto3.client('dynamodb', region_name='us-east-2', endpoint_url="http://localhost:8000")

response = dynamodb.describe_table(
    TableName='bars'
)

print(response)

but I keep getting this error:

botocore.errorfactory.ResourceNotFoundException: An error occurred (ResourceNotFoundException) when calling the DescribeTable operation: Cannot do operations on a non-existent table

But I'm able to query it in the AWS CLI when I run this command:

aws dynamodb describe-table --table-name bars

Is something borked with my boto3 setup? Obviously my aws config file is fine because I can access the table using the cli.

Upvotes: 2

Views: 982

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 270154

Remove the endpoint_url().

This is useful when connecting to DynamoDB Local but is not necessary when connecting to the 'live' Amazon DynamoDB service.

The AWS Command-Line Interface (CLI) will use the live service by default.

Upvotes: 4

Related Questions