AmazonDynamoDBClient client = new AmazonDynamoDBClient(new ProfileCredentialsProvider());
public static void main(String [] args) throws Exception {
// Provide the correct path and password of the keystore file
System.setProperty("javax.net.ssl.trustStore","/path/to/keystore.jks");
System.setProperty("javax.net.ssl.trustStorePassword","password");
long ourTime = System.currentTimeMillis()/1000L; long awsTime = getAwsTime(); long diff = Math.abs(ourTime - awsTime);
if (diff > 30) { throw new Exception("The difference between the server time and the local time is greater than 30 seconds"); }
private long getAwsTime() throws Exception { URL url = new URL("https://dynamodb.us-west-2.amazonaws.com"); URLConnection conn = url.openConnection(); conn.connect(); return conn.getDate()/1000L; }
上一篇:AmazonDynamoDB异常:用户:用户名未被授权执行对资源的dynamodb:DescribeTable操作。
下一篇:AmazonDynamoDB遇到.NETFramework的ConditionalCheckFailedException异常