Database Reference
In-Depth Information
java -D java.library.path=./DynamoDBLocal_lib -jar
DynamoDBLocal.jar -port 8888
Tip
Even the java -D java.library.path = ./DynamoDBLocal_lib -jar
DynamoDBLocal.jar command is enough to start DynamoDB Local, but it starts it on
port 8000, which is occupied by my PC. That's why I use port 8888.
Once you put in this command from the CLI, you will get the following output:
Once DynamoDB Local starts, it's easier to configure the client. We need to make changes
in three lines of our initializeCredentials method (we have discussed this in the
Java SDK operations section in this chapter). We need to insert a new line pointing to the
DynamoDB Local host and port using the client.setEndpoint() method (as
shown next). Then we need to remove other client-related setters such as setRegion .
Take a look at the following code:
private static void initializeCredentials() throws
Exception {
AWSCredentials credentials = null;
try {
credentials = new ProfileCredentialsProvider()
.getCredentials();
} catch (Exception e) {
thrownew AmazonClientException(
"Invalid location or format of credentials file.",e);
Search WWH ::




Custom Search