Amazon S3 Utilities

Overview

The Amazon S3 Utilities Plug-in leverages the Amazon AWS Java API to connect with Amazon S3 to store and retrieve files.  

Key Features & Functionality

The following smart services are included:

  • Upload documents to AWS S3
  • Download documents from AWS S3
  • Create Folders in AWS S3
  • Delete documents from AWS S3

The plug-in also includes a function:

  • getPreSignedURLForS3 that generates a V4 pre signed url that expires after 5s. This allows for a short term access grant to a secured resource. It can be used in a WebAPI object to redirect a user from Appian to a resource on S3.

Amazon S3 Utilities supports the following Amazon S3 features:

 

Note:  The plug-in requires Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files when using client side encryption.

(https://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html)

 

The Appian Secure Credential Store is leveraged for the credentials to integrate with Amazon S3. Before executing the plug-in, create an new secure credential store with the following 3 attributes.  These values are obtained from Amazon AWS IAM console.

  • accesskeyid: this is the access key id for connecting to AWS S3
  • accesskeysecret: this is the access key secret for connecting to AWS S3
  • kmscmkid: this attribute is only required if using AWS Client Side Encryption
Anonymous
  • Update- It is Chrome browser not able to load the pdf, if the content-type is set to pdf while uploading the doc to s3, loading of doc fails in Chrome so the fix is to set the content-type= application/pdf while uploading.
    Also I hope Appian add 'responsecontentdisposition' parameter to getPreSignedURLForS3 function to force the download of the documents always instead of loading the document.
    Thanks

  • We are trying to download documents from s3 inside the interfaces using getpresignedurlfors3 functions, we are able to download almost all other type of documents except we have identified that when we are trying to download pdf docs we are getting error- Failed to load PDF document.(PFA the screenshot).Fyi we are using chrome.
    Please advise what should be the fix for the is sue.

  • Just a note for anyone having a similar issue. Support helped me. The filename didn't need the URL, but it is important to specify the region even though it is optional. 

  • These are my logs:

    2025-06-27 07:45:12,203 [Appian Work Item - 2885 - WorkID 930 - execution01 - process 268464249 - model 1545 : UnattendedJavaActivityRequest] ERROR com.appiancs.plugins.amazonS3Utils.ss.DownloadObjectsFromAmazonS3 - Error closing file stream
    com.amazonaws.services.s3.model.AmazonS3Exception: The specified key does not exist. (Service: Amazon S3; Status Code: 404; Error Code: NoSuchKey; Request ID: MSZ26TTCVREFYKY8; S3 Extended Request ID: 6c2JJ0h8QrPokOH+UKIfTSLBeOS99+zAHeCkn3OF4bwetQnZp8Kv1ZAHTmSJ5HieqqZRvZWLpKY=; Proxy: null), S3 Extended Request ID: 6c2JJ0h8QrPokOH+UKIfTSLBeOS99+zAHeCkn3OF4bwetQnZp8Kv1ZAHTmSJ5HieqqZRvZWLpKY=
    	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1879)
    	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleServiceErrorResponse(AmazonHttpClient.java:1418)
    	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1387)
    	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1157)
    	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:814)
    	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:781)
    	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:755)
    	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:715)
    	at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:697)
    	at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:561)
    	at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:541)
    	at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:5558)
    	at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:5505)
    	at com.amazonaws.services.s3.AmazonS3Client.getObject(AmazonS3Client.java:1555)
    	at com.appiancs.plugins.amazonS3Utils.ss.S3Operations.downloadFromS3(S3Operations.java:122)
    	at com.appiancs.plugins.amazonS3Utils.ss.DownloadObjectsFromAmazonS3.getInputStream(DownloadObjectsFromAmazonS3.java:140)
    	at com.appiancs.plugins.amazonS3Utils.ss.DownloadObjectsFromAmazonS3.run(DownloadObjectsFromAmazonS3.java:87)
    	at com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.lambda$call$0(DefaultActivityExecutor.java:129)
    	at com.appiancorp.plugins.PluginUsageLogger.runWithPluginInformation(PluginUsageLogger.java:54)
    	at com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.call(DefaultActivityExecutor.java:129)
    	at com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.call(DefaultActivityExecutor.java:123)
    	at com.appiancorp.common.ContextClassLoaderSwitcher.runInContext(ContextClassLoaderSwitcher.java:30)
    	at com.appiancorp.process.runtime.framework.DefaultActivityExecutor.execute(DefaultActivityExecutor.java:123)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequest.execute(UnattendedJavaActivityRequest.java:110)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequestResponseCreator.getJavaActivityResultResponse(UnattendedJavaActivityRequestResponseCreator.java:23)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequest.getJavaActivityResultResponse(UnattendedJavaActivityRequest.java:89)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequest.execute0(UnattendedJavaActivityRequest.java:72)
    	at com.appiancorp.common.persistence.data.AppianDataUserContextProvider.executeWithConsistentDataReads(AppianDataUserContextProvider.java:143)
    	at com.appiancorp.process.engine.ProcessContinuationRequest.executeOuter(ProcessContinuationRequest.java:68)
    	at com.appiancorp.process.engine.ActivityRequest.executeOuter(ActivityRequest.java:41)
    	at com.appiancorp.process.engine.ContinuationRequest.execute(ContinuationRequest.java:136)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequest.execute(UnattendedJavaActivityRequest.java:125)
    	at com.appiancorp.process.workpoller.UnattendedRequestHandlerBean.onMessage(UnattendedRequestHandlerBean.java:36)
    	at com.appiancorp.process.workpoller.WorkItem.run(WorkItem.java:110)
    	at org.springframework.jca.work.SimpleTaskWorkManager$DelegatingWorkAdapter.run(SimpleTaskWorkManager.java:241)
    	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    	at java.base/java.lang.Thread.run(Thread.java:840)
  • Just to clarify further...

    When I use s3://somepath/foobar.json or https://somepath/foobar.json   then I get variations of 

    Error closing file stream.The specified key does not exist. (Service: Amazon S3; Status Code: 404; Error Code: NoSuchKey; 

    From https://stackoverflow.com/questions/28653249/amazon-s3-exception-the-specified-key-does-not-exist it seems people get this error when the file doesn't exist on the bucket. Am I specifying the file details incorrectly?

    If I leave out the optional Region field I get Error closing file stream.Endpoint does not contain a valid host name: null

    If I include the region to be eu-west-1 then I get the The specified key does not exist errors.

    Any suggestions would be great.

    regards

    Rod

  • Hi there,

    I am getting an error Error closing file stream.Endpoint does not contain a valid host name: null

    I get the same error whether I specify the bucket name or the bucket arn.

    For the file I am specifying an array with one element which is a full JSON filename (e.g. foobar.json).

    Any help would be appreciated.

    Regards

    Rod

  • v1.5.0 Release Notes
    • Updated function `getPreSignedURLForS3`. Added new parameter `newFilename`, to allow files to be renamed upon download from S3. This is handy if the S3 file uses a non-user friendly naming convention, and you want to rename it to something else.
  • Please note the function description - the call to get the presigned url needs to be wrapped in a webAPI so that 1. you need to check security on the document since S3 does not provide that, 2. the download is initiated before the url expires

  • unable to view videos from S3 bucket using getPreSignedURLForS3 function as the preSignedURL always gets expired while receving the video chunks.

    Also, downloading video in Appian and then deleting it after the task completion isn't a feasible option for us at this moment.

    There should be another option to change the expiration time so we can receive the larger contents as 5 seconds aren't enough.

     

  • Is it compatible with all versions after 23.2 or only till 23.2? Currently we are on 24.4 version