I download an image from a url to an ec2 instance(wget), process it with imagemagick (convert -actions $savedfilename) and then save it to s3 (with a php api).
- Is it possible to process the image on ec2 and save it directly to s3 without writing to the s3 volume?
- If this is possible, does it make sense – would it be faster / cheaper?
- Is there anything else that can be done to improve the efficiency of the process?
- Is there an API to save to s3 directly from the shell?
I guess you meant “…without writing to the EBS volume” Am I right? You can pipe Wgets output directly to ImageMagicks convert, which looks like this:
Take a look at s3cmd, it will allow you to interact with S3 directly from the command line. Our example workflow will then look like this:
This will give you this result, which you can filter using regex to get the public URL:
Get URL from text:
I guess that’s an elegant way of doing your process 🙂 I’m not sure if it will be any faster or cheaper … Maybe a bit because of EBS’ bad disk I/O.