I want to do some CRUD operations in DynamoDB local in java. I don't have any aws credentials. I have done all the settings to setup the local environment and also I created the tables and can see in aws CLI also.
Already refered Working on DynamoDB in your computer without AWS credentials question but it has no java code examples to do the operations.
I tried the code,
AmazonDynamoDB ddb = AmazonDynamoDBClientBuilder.defaultClient();
try {
ddb.deleteTable("book");
} catch (AmazonServiceException e) {
System.err.println(e.getErrorMessage());
System.exit(1);
}
but this gives an error
"The AWS Access Key Id needs a subscription for the service"
Can anyone please help me with this.
Try creating the client like this then you can execute CRUD operation,
AmazonDynamoDB dynamoDBClient = AmazonDynamoDBClientBuilder.standard().build();
AWSCredentialsProvider credentialsProvide = new DefaultAWSCredentialsProviderChain();
AmazonDynamoDBClientBuilder clientBuilder = AmazonDynamoDBClientBuilder.standard();
clientBuilder.setCredentials(credentialsProvide);
EndpointConfiguration endpointConfiguration = new EndpointConfiguration("http://localhost:8000/", "local");
clientBuilder.setEndpointConfiguration(endpointConfiguration);
dynamoDBClient = clientBuilder.build();