For a project, I'll need to know if my user has finished to download a file to delete it on my remote server. Is there a way to do that ?
-
Is this for S3 or EC2? – Lorenzo Aiello Jul 21 '14 at 15:51
-
Both. A file stored in my EC2 server or on S3. – cappie013 Jul 21 '14 at 16:00
1 Answers
There are a couple ways of doing this, some more efficient than others, but here is what I've come up with.
Download through your application
If your application is downloading/passing the file through to the user you can trigger a function at the end of the stream to delete the file.
S3 Bucket Access Logging
S3 has access server logs (http://docs.aws.amazon.com/AmazonS3/latest/dev/ServerLogs.html) that log information for each request. Depending on how your application is structured, you may be able to process these to see what's been accessed.
There may be up to a 30-60 minute delay in log availability
Other Options
There are some other options, though perhaps not ideal (without knowing the specifics of your application I don't know whether these are acceptable).
- Use Object Expiration (http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectExpiration.html)
- Related SO question (PHP instead of ROR, but the concepts should apply) Resumable downloads when using PHP to send the file?

- 1
- 1

- 497
- 1
- 7
- 18