I’d like to use Elastic Beanstalk service for my application. It’s very important that one of the feature will be to download user’s images from Facebook. It’s not only about profile image. I’d like to download let’s say images from all albums.
Using Facebook SDK we have to use a token to get access to these images.
Here is the problem. I don’t want to store images directly on EBS instance. I’d like to copy them directly to S3 or Cloudinary. I’ve made a research and it seems that I cannot fetch remotely to S3. It seems that I have to download it firstly to EBS instance and than upload to S3. It doesn’t sound like a good solution for me. Of course I can use API Gateway + Lambda to make it possible but I’d prefer to keep it simpler.
In Cloudinary we have a feature called – Fetch Remote. I’m not sure if it works with Facebook images. My doubts come from Facebook security protection. I’m not sure if we can get those files without token/session.
Questions:
1. Assuming that I have urls to these files/images Can I use Cloudinary Fetch Remote feature to get them?
2. How can I solve this issue using S3 and Elastic Beanstalk? Do I have to download an image to Elastic Beanstalk instance before I upload it to S3? Maybe there is better approach?
3. Do you have any suggestion what solution is the best using Amazon EBS and S3 or Cloudinary?
2
Answers
Probably. I don’t see why not. Why don’t you try it out?
You have to download it somewhere first, and then upload it to S3. There isn’t another/better way. Some service has to download the file and upload to S3, that can be Elastic Beanstalk or maybe an AWS Lambda function, but S3 won’t download the files by itself.
That’s primarily opinion-based, which is off-topic for this site. It all depends on what features you want, and how much you are willing to pay.
Without understanding your application and stack, I don’t know if this will work, but if you have a JS based front-end, and the front-end is getting the image (say, showing the image) before it needs to be uploaded to S3, a good solution would be for your front end to upload the image directly to S3.
Basically the front-end will request your server to sign the S3 URL, and then it will do the upload directly.
You will have to implement something similar to what image uploader do (see https://fineuploader.com/), but in your case, the user would not drag an image, but instead, your will just upload it from memory (as it was already downloaded from Facebook for displaying on your front end).
Again, this assumes the image is downloaded to the front-end for displaying to the user anyway, so you can do the upload on the client side.