Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 47aef4d

Browse files
committed
fetch STS endpoint from properties
Even when providing `withRegion`, the `AWSSecurityTokenServiceClientBuilder` points the client to us-east-1. This fails in cases where you are using a VPC endpoint and access to the Internet is limited. This change looks up the property `aws.sts.endpoint` and uses that or `https://sts.amazonaws.com` to pass to `.withEndpointConfiguration` Closes #58
1 parent 3654d3a commit 47aef4d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/main/scala/com/audienceproject/spark/dynamodb/connector/DynamoConnector.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,12 @@ private[dynamodb] trait DynamoConnector {
7575
**/
7676
private def getCredentials(chosenRegion: String, roleArn: Option[String]) = {
7777
roleArn.map(arn => {
78+
val stsEndpoint = Option(System.getProperty("aws.sts.endpoint")).getOrElse("https://sts.amazonaws.com")
7879
val stsClient = AWSSecurityTokenServiceClientBuilder
7980
.standard()
8081
.withCredentials(new DefaultAWSCredentialsProviderChain)
8182
.withRegion(chosenRegion)
83+
.withEndpointConfiguration(new EndpointConfiguration(stsEndpoint, chosenRegion))
8284
.build()
8385
val assumeRoleResult = stsClient.assumeRole(
8486
new AssumeRoleRequest()

0 commit comments

Comments
 (0)