This repository was archived by the owner on Aug 31, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
src/main/scala/com/audienceproject/spark/dynamodb/connector Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -75,11 +75,20 @@ private[dynamodb] trait DynamoConnector {
75
75
**/
76
76
private def getCredentials (chosenRegion : String , roleArn : Option [String ]) = {
77
77
roleArn.map(arn => {
78
- val stsClient = AWSSecurityTokenServiceClientBuilder
79
- .standard()
80
- .withCredentials(new DefaultAWSCredentialsProviderChain )
81
- .withRegion(chosenRegion)
82
- .build()
78
+ val stsClient = Option (System .getProperty(" aws.sts.endpoint" )).map(endpoint => {
79
+ AWSSecurityTokenServiceClientBuilder
80
+ .standard()
81
+ .withCredentials(new DefaultAWSCredentialsProviderChain )
82
+ .withEndpointConfiguration(new EndpointConfiguration (endpoint, chosenRegion))
83
+ .build()
84
+ }).getOrElse(
85
+ // STS without an endpoint will sign from the region, but use the global endpoint
86
+ AWSSecurityTokenServiceClientBuilder
87
+ .standard()
88
+ .withCredentials(new DefaultAWSCredentialsProviderChain )
89
+ .withRegion(chosenRegion)
90
+ .build()
91
+ )
83
92
val assumeRoleResult = stsClient.assumeRole(
84
93
new AssumeRoleRequest ()
85
94
.withRoleSessionName(" DynamoDBAssumed" )
You can’t perform that action at this time.
0 commit comments