Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion plugin/trino-exchange/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<properties>
<air.main.basedir>${project.parent.basedir}</air.main.basedir>
<awsjavasdk.version>2.17.102</awsjavasdk.version>
<awsjavasdk.version>2.17.151</awsjavasdk.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -114,6 +114,10 @@
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-classes</artifactId>
</exclusion>
</exclusions>
</dependency>

Expand All @@ -127,6 +131,13 @@
<artifactId>utils</artifactId>
</dependency>

<!-- use of WebIdentityTokenFileCredentialsProvider requires the 'sts' module to be on the classpath -->
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sts</artifactId>
<scope>runtime</scope>
</dependency>

<!-- Trino SPI -->
<dependency>
<groupId>io.trino</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class ExchangeS3Config
private String s3AwsSecretKey;
private Optional<Region> s3Region = Optional.empty();
private Optional<String> s3Endpoint = Optional.empty();
private boolean s3UseWebIdentityTokenCredentials;
private int s3MaxErrorRetries = 3;
// Default to S3 multi-part upload minimum size to avoid excessive memory consumption from buffering
private DataSize s3UploadPartSize = DataSize.of(5, MEGABYTE);
Expand Down Expand Up @@ -91,6 +92,18 @@ public ExchangeS3Config setS3Endpoint(String s3Endpoint)
return this;
}

public boolean isS3UseWebIdentityTokenCredentials()
{
return s3UseWebIdentityTokenCredentials;
}

@Config("exchange.s3.use-web-identity-token-credentials")
public ExchangeS3Config setS3UseWebIdentityTokenCredentials(boolean s3UseWebIdentityTokenCredentials)
{
this.s3UseWebIdentityTokenCredentials = s3UseWebIdentityTokenCredentials;
return this;
}

@Min(0)
public int getS3MaxErrorRetries()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider;
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
import software.amazon.awssdk.auth.credentials.WebIdentityTokenFileCredentialsProvider;
import software.amazon.awssdk.core.async.AsyncRequestBody;
import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration;
import software.amazon.awssdk.core.retry.RetryPolicy;
Expand Down Expand Up @@ -362,6 +363,11 @@ private static AwsCredentialsProvider createAwsCredentialsProvider(ExchangeS3Con
if (config.getS3AwsAccessKey() != null && config.getS3AwsSecretKey() != null) {
return StaticCredentialsProvider.create(AwsBasicCredentials.create(config.getS3AwsAccessKey(), config.getS3AwsSecretKey()));
}

if (config.isS3UseWebIdentityTokenCredentials()) {
return WebIdentityTokenFileCredentialsProvider.create();
}

return DefaultCredentialsProvider.create();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public void testDefaults()
.setS3AwsSecretKey(null)
.setS3Region(null)
.setS3Endpoint(null)
.setS3UseWebIdentityTokenCredentials(false)
.setS3MaxErrorRetries(3)
.setS3UploadPartSize(DataSize.of(5, MEGABYTE)));
}
Expand All @@ -46,6 +47,7 @@ public void testExplicitPropertyMappings()
.put("exchange.s3.aws-secret-key", "secret")
.put("exchange.s3.region", "us-west-1")
.put("exchange.s3.endpoint", "https://s3.us-east-1.amazonaws.com")
.put("exchange.s3.use-web-identity-token-credentials", "true")
.put("exchange.s3.max-error-retries", "8")
.put("exchange.s3.upload.part-size", "10MB")
.buildOrThrow();
Expand All @@ -55,6 +57,7 @@ public void testExplicitPropertyMappings()
.setS3AwsSecretKey("secret")
.setS3Region("us-west-1")
.setS3Endpoint("https://s3.us-east-1.amazonaws.com")
.setS3UseWebIdentityTokenCredentials(true)
.setS3MaxErrorRetries(8)
.setS3UploadPartSize(DataSize.of(10, MEGABYTE));

Expand Down