Access Files from SEA

Required security profile permissions: Secure External Access Edit

Secure External Access (SEA) allows you to securely retrieve files from active storage so you can save them to your own server. The files are automatically removed from the SEA bucket after 30 days but you can manually remove them before then. You are only allowed one set of SEA credentials per business unit. You must use an FTP client or a script to browse or download files from your SEA bucket. You can use any FTP client, but the following instructions demonstrate the process using S3 Browser, CrossFTP, and a custom script.

Access Files from SEA Using S3 Browser

  1. Download and install S3 Browser.
  2. Open S3 Browser.
  3. In the Add New Account window, type an Account Name you want to associate with the account.
  4. Select Amazon S3 Storage as the Account Type.
  5. Type the Access Key ID and Secret Access Key you generated when you set up SEA in Central into the corresponding fields. If you have not already generated the Access Key ID and Secret Access Key, do so now.
  6. Clear the Use secure transfer (SSL/TLS) checkbox.
  7. Click Add new account.
  8. In the main S3 Browser window, click BucketsAdd External Bucket...
  9. In the Add External Bucket window, type your assigned File Location path.
  10. Click Add External bucket.
  11. Browse and download files in the main S3 Browser window as needed.

Access Files from SEA Using CrossFTP

  1. Download and install CrossFTP.
  2. Open Cross FTP and click SitesSite Manager....
  3. In the Site Manager window, select a category to contain the new site by clicking a folder on the left or creating a new one. Click New Site.
  4. Select S3 as the Protocol.
  5. Set the Label to the name you want to give this site.
  6. Set the Host to s3.amazonaws.com.
  7. Set the Port to 80.
  8. In the Access Key and Secret fields, type the Access Key ID and Secret Access Key you generated when you set up SEA in Central, respectively. If you have not already generated the Access Key ID and Secret Access Key, do so now.
  9. In the Remote Path field, type the portion of the File Location path that comes after "https://s3.amazonaws.com/". For example, if your File Location is https://s3.amazonaws.com/my-s3-bucket/folder/, type my-s3-bucket/folder/ in the Remote Path field.
  10. Click Apply.
  11. Click Connect.
  12. Browse and download files in the main CrossFTP window as needed.

Access Files from SEA Using a Script

  1. If you have not already done so, generate your SEA credentials so you can include them in the script.
  2. Locate or create a destination on your machine where you want to download the files. Note the path to the location so you can include it in the script.
  3. Open a text editor, copy the following script, and paste it into the text editor window. Replace the underlined information with the values for your SEA implementation. In the following sample, accessKeyUser is the Access Key ID, secretKeyUser is the Secret Access Key, seaPath is the File Location, and downloadDirectory is the file destination on your machine.

    import java.io.{File, FileNotFoundException, FileOutputStream, IOException}
    						import com.amazonaws.AmazonServiceException
    						import com.amazonaws.auth.{AWSCredentialsProvider, AWSStaticCredentialsProvider, BasicAWSCredentials}
    						import com.amazonaws.auth.profile.ProfileCredentialsProvider
    						import com.amazonaws.services.s3.model.ListObjectsRequest
    						import com.amazonaws.services.s3.{AmazonS3Client, AmazonS3ClientBuilder}
    						class S3Browser {
    						def downloadS3Content(): Unit = {
    						var accessKeyUser="ACCESSKEYID"
    						var secretKeyUser="SECRETACCESSKEY"
    						var seaPath="https://s3.amazonaws.com/YOUR-SEA-FILE-PATH/YOUR-FOLDER-NAME/"
    						var seaBucketName = "YOUR-SEA-FILE-PATH"
    						var seaFolderName = "YOUR-FOLDER-NAME/"
    						var downloadDirectory = "DESTINATIONPATH"
    						var credentials = new BasicAWSCredentials(accessKeyUser,secretKeyUser)
    						var s3Client = AmazonS3ClientBuilder.standard()
    						.withCredentials(new AWSStaticCredentialsProvider(credentials))
    						.build()
    						var listObjectsRequest = new ListObjectsRequest()
    						.withBucketName(seaBucketName)
    						.withPrefix(seaFolderName)
    						.withEncodingType("url")
    						var objectList = s3Client.listObjects(listObjectsRequest)
    						var listObjIterator = objectList.getObjectSummaries.listIterator()
    						println("Listing the bucket(Folder) content")
    						while(listObjIterator.hasNext()){
    						var item = listObjIterator.next()
    						println("File : "+item.getKey+" Size : "+item.getSize)
    						if(item.getSize>0){
    						println("Downloading : "+item.getKey + " at : "+downloadDirectory)
    						try {
    						var o = s3Client.getObject(seaBucketName, item.getKey)
    						var s3is = o.getObjectContent
    						val targetFile = new File(downloadDirectory+item.getKey)
    						val parent = targetFile.getParentFile
    						if (!parent.exists && !parent.mkdirs) throw new IllegalStateException("Couldn't create dir: " + parent)
    						var fos = new FileOutputStream(targetFile)
    						var read_buf = new Array[Byte](1024)
    						var read_len = 0
    						while ({read_len = s3is.read; read_len != -1}) {
    						fos.write(read_len)
    						}
    						} catch {
    						case e: AmazonServiceException =>
    						System.err.println(e.getErrorMessage)
    						System.exit(1)
    						case e: FileNotFoundException =>
    						System.err.println(e.getMessage)
    						System.exit(1)
    						case e: IOException =>
    						System.err.println(e.getMessage)
    						System.exit(1)
    						}
    					}
    		}
    	}
    }
  4. Save the file.
  5. Run the script in a command line.
  6. Navigate to the chosen destination folder to access the files.