Python - UnrecognizedClientException : The security token included in the request is invalid
See original GitHub issueI am following the tutorial of the DynamoDB of Amazon using the Python boto3 :
https://boto3.amazonaws.com/v1/documentation/api/latest/guide/dynamodb.html
Before that, I have installed Dynamo DB Locally and Running the Dynamo DB (Windows 7)-
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.DownloadingAndRunning.html
Configuration File has been created using the AWS CLI -
aws configure Followed the following documentation also - https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html#configuring-credentials
Now, DynomoDB Local is configured and Running along with the Credentials configured through “aws configure” and config, credentials files created with “default” profile. Now i am running the sample program -
` import boto3
#Get the service resource. dynamodb = boto3.resource( ‘dynamodb’, aws_access_key_id=‘foo’, aws_secret_access_key=‘bar’, )
#Create the DynamoDB table. table = dynamodb.create_table( TableName=‘users1’, KeySchema=[ { ‘AttributeName’: ‘username’, ‘KeyType’: ‘HASH’ }, { ‘AttributeName’: ‘last_name’, ‘KeyType’: ‘RANGE’ } ], AttributeDefinitions=[ { ‘AttributeName’: ‘username’, ‘AttributeType’: ‘S’ }, { ‘AttributeName’: ‘last_name’, ‘AttributeType’: ‘S’ },
], ProvisionedThroughput={ 'ReadCapacityUnits': 5, 'WriteCapacityUnits': 5 }
)
#Wait until the table exists. table.meta.client.get_waiter(‘table_exists’).wait(TableName=‘users1’)
#Print out some data about the table. print(table.item_count)
But i am getting the following error -
An error occurred (UnrecognizedClientException) when calling the CreateTable operation: The security token included in the request is invalid.
Is there any problem with settings in the boto3 even though i have configured the credentials, config files are having the right data ?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
@jschwarzwalder Yes. Thankyou. I have tried it and working.
It looks like if you want to access the local repo you need to add the flag
--endpoint-url http://localhost:8000