-1

I am developing an web application for the AWS cloud , i have developed the application in local ENV and now moving it to the cloud. I am using dynamoDB as the database. I have done all the developments in local and now i am moving to the cloud. The following is my dynamoDB connection settings .

AmazonDynamoDBClient client = new AmazonDynamoDBClient(); client.setEndpoint("https://myclouddynamodburl:8000"); DynamoDB dynamoDB = new DynamoDB(client);

I use this dynamoDB instance for communicating to the database. But now the problem is when i moved to the cloud , it is not getting connected. I am getting an error like this

com.amazonaws.AmazonClientException: Unable to execute HTTP request: Connection refused

I am using aws java-sdk for the connection. And i am using an EC2 instance and docker for the deployment . Roles are tagged in the IAM roles.

Any help would be highly appreciated

Java Programmer
  • 1,347
  • 3
  • 12
  • 31
  • What is `https://myclouddynamodburl:8000`? Why are you setting a custom endpoint at all? – Mark B Jul 14 '16 at 18:26
  • This is an example "myclouddynamodburl" will replace my original cloud end point of dynamo DB. By the way i have figured out the problem – Java Programmer Jul 15 '16 at 03:42

1 Answers1

1

I have figured out the problem . Since i was connecting to the https . I should use the the default port 443 rather than the 8000 . 8000 was for the local . So the URL has been changed to

https://myclouddynamodburl:443

Works !!

Java Programmer
  • 1,347
  • 3
  • 12
  • 31
  • Again, why specify an endpoint at all? Why not just remove that line of code and use the default endpoint? – Mark B Jul 15 '16 at 13:15
  • I don't understand what you meant by default end point . I have not found anywhere that it works without that line of code . Can you post an example if i am missing something – Java Programmer Jul 18 '16 at 10:34
  • If you are using the official AWS SDK then you just have to set a region, not a specific service endpoint URL. For an example you could look at nearly any code example for the AWS SDK, such as this: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/JavaDocumentAPIItemCRUD.html Notice how they are not specifying an endpoint in that example. – Mark B Jul 18 '16 at 12:31
  • Yes i agree with you. Thank you !! – Java Programmer Jul 20 '16 at 07:01