diff --git a/src/main/java/io/kestra/plugin/aws/s3/AbstractS3Object.java b/src/main/java/io/kestra/plugin/aws/s3/AbstractS3Object.java index a30ab5c..94d5eed 100644 --- a/src/main/java/io/kestra/plugin/aws/s3/AbstractS3Object.java +++ b/src/main/java/io/kestra/plugin/aws/s3/AbstractS3Object.java @@ -16,4 +16,10 @@ public abstract class AbstractS3Object extends AbstractConnection implements Abs protected String requestPayer; protected String bucket; + + static { + // Initializing CRT will download the S3 native library into /tmp. + // With Java Security enabled, we need to do it early so it is done out of a task execution. + S3Service.initCrt(); + } } diff --git a/src/main/java/io/kestra/plugin/aws/s3/S3Service.java b/src/main/java/io/kestra/plugin/aws/s3/S3Service.java index a5febe6..f0fb05d 100644 --- a/src/main/java/io/kestra/plugin/aws/s3/S3Service.java +++ b/src/main/java/io/kestra/plugin/aws/s3/S3Service.java @@ -9,6 +9,7 @@ import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; +import software.amazon.awssdk.crt.CRT; import software.amazon.awssdk.services.s3.S3AsyncClient; import software.amazon.awssdk.services.s3.S3Client; import software.amazon.awssdk.services.s3.model.GetObjectRequest; @@ -27,6 +28,12 @@ import java.util.stream.Collectors; public class S3Service { + + public static void initCrt() { + // This will init CRT and loads the native library + CRT.getArchIdentifier(); + } + public static Pair download(RunContext runContext, S3AsyncClient client, GetObjectRequest request) throws IOException, ExecutionException, InterruptedException { // s3 require non existing files File tempFile = runContext.workingDir().createTempFile(FileUtils.getExtension(request.key())).toFile();