How to use AWS S3 to store user uploaded images?

I am creating an iPhone application so that users can upload and share photos. Currently, uploaded photos are stored on my 1and1 cloud server, which I subscribed to. Now I want to try AWS. I signed up for the AWS Linux EC2 free tier and configured php / mysql. My question is, for scaling purposes, where should I store custom images: EC2 or S3? And how to connect EC2 to S3, so the photos uploaded by the user will be saved in S3? I understand that when a user uploads a photo to my EC2 instance, it is saved in EC2, and it will soon fill up the space, since I have only 5 GB of space.

With limited AWS knowledge, my question may sound st ** d, but any help and advice would be appreciated!

+7
source share
2 answers

You must store your photos on S3, the data stored in your EC2 instances is not permanent. Use the AWS SDK to upload data to S3.

+6
source

In this case, I would use S3.

The advantage of using S3 support for your photos is that you can easily use the Amazon Cloud Front CDN with S3 as a source (you can also use an EC2 instance, but it takes more work).

And how to connect EC2 to S3, so the photos uploaded by the user will be saved in S3

There is an S3 API for PHP

http://aws.amazon.com/sdkforphp/

+5
source

All Articles