0

Help: How do you transfer a PDF File from S3 to a local desktop file directory when the rails app is deployed in Pivotal Cloud Foundry? Using ruby and the aws-sdk to download a PDF File from S3 to local client machine directory.

get_object(bucket: @s3_bucket, key: file_name, response_target: "#{Rails.root}/Downloads/#{file_name}")

The above ruby code works. The file appears inside the Download Directory on the Mac. Problem: deploying the rails app into Pivotal Clown Foundry breaks the placement of the PDF File and where it gets stored. It seems as if get_object returns the PDF to the Cloud Foundry Container in directory in "/home/vcap/app" rather than getting pulled down to the user's remote computer file directory. But that's not available to the person to open up the file.

1 Answers1

0

Pivotal Cloud Foundry will not download any files onto your local work machine by default.

When code is run on Pivotal Cloud Foundry the code only has access to the filesystem in the app instance (container).

If you wish to retrieve a file from a app instance you may SCP it from the Application Instance. Here are the docs on how to do that

dfedde
  • 852
  • 7
  • 19
  • Likewise, the ruby aws-sdk call "get_object" does not seem to place a file into the cloud foundry directory /home/vcap/app... Suppose this aws-sdk call needs to be wrapped in an scp call to get the file into PCF? There has got to be better way to transfer a PDF from S3 to local client machine via a PCF deployment. – user6337901 Jul 02 '17 at 15:35