Search code examples
amazon-web-servicesamazon-ec2amazon-dynamodbaws-java-sdk

AWS error when connecting to DYNAMODB from cloud


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


Solution

  • 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 !!