Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS DynamoDB resource not found exception

I have a problem with connection to DynamoDB. I get this exception:

com.amazonaws.services.dynamodb.model.ResourceNotFoundException: Requested resource not found (Service: AmazonDynamoDB; Status Code: 400; Error Code: ResourceNotFoundException; Request ID: ..

But I have a table and region is correct.

like image 544
Игорь Голяк Avatar asked Oct 22 '16 12:10

Игорь Голяк


4 Answers

From the docs it's either you don't have a Table with that name or it is in CREATING status.

I would double check to verify that the table does in fact exist, in the correct region, and you're using an access key that can reach it

like image 54
Chen Harel Avatar answered Oct 19 '22 17:10

Chen Harel


My problem was stupid but maybe someone has the same... I changed recently the default credentials of aws (~/.aws/credentials), I was testing in another account and forgot to rollback the values to the regular account.

like image 26
pmiranda Avatar answered Oct 19 '22 17:10

pmiranda


If DynamoDB table is in a different region, make sure to set it before initialising the DynamoDB by

AWS.config.update({region: "your-dynamoDB-region" });

This works for me:)

like image 7
RISHU GUPTA Avatar answered Oct 19 '22 17:10

RISHU GUPTA


I spent 1 day researching the problem in my project and now I should repay a debt to humanity and reduce the entropy of the universe a little. Usually, this message says that your client can't reach a table in your DB. You should check the next things:

1. Your database is running
2. Your accessKey and secretKey are valid for the database
3. Your DB endpoint is valid and contains correct protocol ("http://" or "https://"), and correct hostname, and correct port
4. Your table was created in the database.
5. Your table was created in the database in the same region that you set as a parameter in credentials. Optional, because some
database environments (e.g. Testcontainers Dynalite) don't have an incorrect value for the region. And any nonempty region value will be correct

In my case problem was that I couldn't save and load data from a table in tests with DynamoDB substituted by Testcontainers and Dynalite. I found out that in our project tables creates by Spring component marked with @Component annotation. And in tests, we are using a global setting for lazy loading components to test, so our component didn't load by default because no one call it in the test explicitly. ¯_(ツ)_/¯

like image 6
Oleg Ushakov Avatar answered Oct 19 '22 18:10

Oleg Ushakov