简体   繁体   中英

aws s3 ruby aws-sdk file transer using pivotal cloud foundry

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM