Architectural and design question about uploading photos from iPhone app and S3?

I've discussed this issue on the AWS forums before. As I say there, the proper solution for accessing AWS from a mobile device is to use the AWS Identity and Access Management service to generate temporary, limited-privilege access keys for each user. The service is great, but it's still in beta for now and it's not part of the mobile SDK yet.

I have a feeling once this thing is released for good, you'll see it out on the mobile SDK immediately afterwards Until then generate presigned URLs for your users, or proxy through your own server like some others have suggested. The presigned URL will allow your users to temporarily GET or PUT to an S3 object in one of your buckets without actually having your credentials (they are hashed into the signature). You can read about the details here EDIT : I've implemented a proper solution for this problem, using the preview beta of IAM.It's available on GitHub, and you can read about it here.

I've discussed this issue on the AWS forums before. As I say there, the proper solution for accessing AWS from a mobile device is to use the AWS Identity and Access Management service to generate temporary, limited-privilege access keys for each user. The service is great, but it's still in beta for now and it's not part of the mobile SDK yet.

I have a feeling once this thing is released for good, you'll see it out on the mobile SDK immediately afterwards. Until then, generate presigned URLs for your users, or proxy through your own server like some others have suggested. The presigned URL will allow your users to temporarily GET or PUT to an S3 object in one of your buckets without actually having your credentials (they are hashed into the signature).

You can read about the details here. EDIT: I've implemented a proper solution for this problem, using the preview beta of IAM. It's available on GitHub, and you can read about it here.

Thanks for the tip on the AWS IAM. Too bad it's still in beta. Can you elaborate on the "presigned URLs" solution you mention?

Is this just using HTTP POST with json policy doc? – TMC Dec 21 '10 at 1:28 I added more details (and two links) about presigned URLs to my answer. Hope that helps :) – Adrian Petrescu Dec 21 '10 at 1:35 In my quick read, the client would have to request the pre-signed URL from my server since it's based on the AWS secret key.

Then it would use that pre-signed URL to do it's file upload. So essentially, this is no different than the HTTP POST method mentioned earlier, correct? – TMC Dec 21 '10 at 2:09 You would still need a server of your own, but by using presigned URLs this server's job is much easier -- all he has to do is return a URL, not do the upload himself as hipplar is suggesting.

That's a huge difference. – Adrian Petrescu Dec 21 '10 at 2:14 Presumably after the upload is completed to S3, the client should tell the server it was successful? Additionally, why in the world does the AWS iOS SDK have "S3GetPreSignedURLRequest" which requires the access key to be on the client?

– TMC Dec 21 '10 at 6:38.

Upload to your server and then post to S3. From an architecture standpoint you will want to do this from your server. There are many things that could go wrong during the data transfer you can handle better on the server and if you want to store any data about the image you are sending to S3 you are probably going to have a server side call anyway.

Plus, your Secret Access Key is stored in a more secure environment. Your own. If you are worried about scalability and you are going to be doing a considerable number of S3 transfers I would consider hosting your server on and EC2 instance.

Transferring data between the two is free (given you store you data in following data centers). There is no Data Transfer charge for data transferred between Amazon EC2 and Amazon S3 within the same Region or for data transferred between the Amazon EC2 Northern Virginia Region and the Amazon S3 US Standard Region. " Amazon Simple Storage Service (Amazon S3) There are many post here on SO Amazon - EC2 cost?(example) about the pros and cons of using EC2.

Major +1 for the EC2S3 info. – ceejayoz Dec 20 '10 at 14:17 We run in Azure so moving to EC2 not an option. I mentioned in my original post that my server being proxy doesn't appear to be the only way since amazon supports uploads by HTTP POST with json policy files.

If there is a way to get away from my server being the middleman that is the ideal approach for obvious reasons. – TMC Dec 20 '10 at 22:47.

I m confused. Why would amazon come up w/ the ios sdk to upload data to s3 then tell us not to use it (Embedding credentials in source code is problematic for software, including mobile applications, because malicious users can de-compile the software or view the source code to retrieve the Secret Access Key)?

Joe, amazon provides an iPhone SDK which explains Dat's confusion. – TMC Dec 20 '10 at 22:42.

E. G an app that lets users store files in their own (user's) bucket instead of provider? I feel a security flaw in merging the keys with application and distributing it.

Anyone can (mis)use them once the keys are revealed anyhow (its never secure when you're giving it out). On the other hand, keeping the functionality reserved to server will keep your keys transparent to user,isn't it?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions