goodby/csv

reading amazon s3 file

chrisvidal opened this issue · 6 comments

Hi,
how would we read a file stored on a amazon s3 services?
I saw that the method parse is accepting a string and then the method is using a SplFileObject PHP class to handle the file.
I didnt have time to try yet,
Would that work or will I need any adaptation ?

thanks

suin commented

@chrisvidal I have never tried that, but I think you will be able to read the CSV file after you download it from S3 bucket and store it as a temporary file in your EC2 instance.

Thanks @suin for your answer
my issue is that I am having an Autoscaling config, so I might have 2 EC2 instances and I wont know which one is used after the copy.
Does my question make sense ?

suin commented

@chrisvidal I don't think that there is problem, even if some autoscaled-instances share, copy and read a same file. To make it clear, could you tell me a specific use case which makes problems?

and how would i copy the file from the s3 bucket to the hard disk of my server?

suin commented

@chrisvidal

how would i copy the file from the s3 bucket to the hard disk of my server?

Here is tutorial to download S3 object to the hard disk.
Get an Object Using the AWS SDK for PHP - Amazon Simple Storage Service

thanks @suin
I will try to implement that over the week then the CSV file import should follow the same principle in that case.