Test class code is below
`private static AmazonDynamoDB ddb;
private static DynamoDB dynamoDB ;
ddb = AmazonDynamoDBClientBuilder
.standard()
.withEndpointConfiguration(
new AwsClientBuilder.EndpointConfiguration
("http://localhost:8000",
"us-west-2"))
.build();
dynamoDB = new DynamoDB(ddb);
`
i have created Dynamodb local using docker
docker run -p 8000:8000 -v $(pwd)/local/dynamodb:/data/ amazon/dynamodb-local -jar DynamoDBLocal.jar -sharedDb -inMemory
包含以下代码的实际类
client = AmazonDynamoDBClientBuilder.standard().build();
dynamoDB = new DynamoDB(client);
在测试用例类中,我可以创建表,向表中插入数据,从表中读取数据以及从表中删除数据。
但是当我调用实际的类来读取dynamodb local的数据时,我得到了以下错误
com.amazonaws.services.dynamodbv2.model.AmazonDynamoDBException: The security token included in the request is expired (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ExpiredTokenException