0

I did my due diligence in trying to find this answer. But sorry in advance if this is redundant (and thank you in advance for any advice/suggestions/resources):

I'm trying to create a Snapchat clone. I'm using Amplify as my client (to bring together AppSync, Cognito, and S3). Is it possible to, upon image uploads (and associated mutations), query a 24-hour delayed mutation to delete the image (for Snapchat-like disappearing)? I don't want the delete request to have to be triggered on the client... but it seems that there's a timeout for AppSync resolvers. Any ideas?

Thank you!

Harry Solovay
  • 483
  • 3
  • 14

1 Answers1

0

You can create a 24 hour rule in your S3 bucket to delete the images, which will be automatically taken care of. If you want to modify other data based on the delete, you can create a trigger to Lambda or SNS and perform any other actions you want to do on those ones.

To configure the rule in AWS S3, it is a onetime setting.

Detailed screenshot explanation is covered here,

https://www.joe0.com/2017/05/24/amazon-s3-how-to-delete-files-older-than-x-days/

Hope it helps.

Kannaiyan
  • 12,554
  • 3
  • 44
  • 83
  • awesome! I have a followup question: is there a solution that doesn't involve S3 rule configuration? I might want to––instead of deleting images––mark them as unreadable for users. This means that I'd need to be able to trigger an API call as well. – Harry Solovay Nov 11 '18 at 00:35
  • There is nothing like that with S3. You can create a timed trigger to Lambda to move from one S3 folder to another S3 folder or even to a different bucket. – Kannaiyan Nov 11 '18 at 07:11