My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Best practice to upload images from mobile apps to S3 and notify server?

Alberto Fecchi's photo
Alberto Fecchi
·Dec 12, 2017

I'm using the AWS SDK for Android and iOS to upload images directly to an S3 buckets, but i also need to notify my servers about this upload. AFAIK i have two options:

1 - Make another request after the upload: in this case i first upload the image to S3 and, when i receive the uploaded image URL, i make a request to my server. Pros: all the logic is in one place. Cons: i need to do two requests and implement all the integrity checks if the second request fails.

2 - Make the upload request from the mobile apps and then implement a hook/lamba structure that automatically notifies the server after the upload. Pros: i need to make only one request from the apps. Cons: i need to implement the hook/lambda infrastructure.

What's your opinion? Which solution should i use?