amazon-archives / aws-scala-sdk

It's like the AWS SDK for Java, but more Scala-y
Apache License 2.0
73 stars 12 forks source link

DynamoDB Local endpoint setting #4

Closed hghina0 closed 9 years ago

hghina0 commented 9 years ago

Hello david-at-aws,

We are using aws-scala-sdk to connect to DynamoDB Local. We observed that setting dynamodb local endpoint in AmazonDynamoDBAsync gets overwritten by region specific endpoint URL.

case class DynamoConfig(accessKey : String,secret: String,endpointUrl: String, region: Region)

val config = DynamoConfig("foo","bar","http://localhost:8000",
                                        Region.getRegion(Regions.US_EAST_1))

val client : AmazonDynamoDBAsync = new AmazonDynamoDBAsyncClient(new
                                        BasicAWSCredentials(config.accessKey,config.secret))

client.setEndpoint(config.endpointUrl) // This has no effect

val dbClient = new AmazonDynamoDBClient(client,config.region)

dbClient... // Perform DB operation

Gives us following error

Aug 24, 2015 11:12:12 AM com.amazonaws.http.AmazonHttpClient executeHelper INFO: Unable to execute HTTP request: dynamodb.us-east-1.amazonaws.com java.net.UnknownHostException: dynamodb.us-east-1.amazonaws.com at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901) at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1293) at java.net.InetAddress.getAllByName0(InetAddress.java:1246) at java.net.InetAddress.getAllByName(InetAddress.java:1162) at java.net.InetAddress.getAllByName(InetAddress.java:1098)

Is it potential bug? We expect it to connect to localhost.

Thanks Hiren

david-at-aws commented 9 years ago

Yep, that's a bug in the current design - I'm requiring you to provide a region even if you're also providing a client, and configuring the client for that region regardless of whether you've already configured it differently. :( #2 fixes this (by coincidence more than design :)) - you can provide just a client, and I'll use it as-is.

I was hoping to get feedback from @manikandanrs before merging that in, but he's out on vacation. I'll happily accept feedback from anyone else who's using the library as a stand-in. Or if this is blocking you, I can also put together a quick fix on the current codebase.

david-at-aws commented 9 years ago

I went ahead and merged #2 so this should be fixed now. Let us know if you're having any other issues!