How to Upload File to Amazon S3 using from Ruby Application

Amazon S3 Using From A Ruby Application

You must be quite acquainted uploading files especially images S3 using Paperclip, CarrierWave, etc., gems. But what if you just want to upload a file without any kind of pre/post-processing or ActiveRecord integration? Paperclip, CarrierWave are great gems but it would be overkilling to use such gems where you need very limited functionality of the gem.

I recently need to upload the large number of xml to S3 in a microservice that doesn’t have DB integration. So that is the very clear case of using aws-sdk library directly overusing such flashy gems.

I tried googling around it and mostly landed on articles that were using the older version of aws-sdk API but I have to use latest one.

The latest version of aws-sdk(~> 2) had different API to upload a file to S3. So most of those example gives errors. I read docs and spec from the aws-sdk and come up with the working example.

Here is a quick gist which help you get going without stumbling and trying obsolete APIs.

Click here for more details

At BoTree Technologies, we build enterprise applications with our RoR team of 25+ engineers.

We also specialize in Python, RPA, AI, Django, JavaScript and ReactJS.

Consulting is free – let us help you grow!

Related posts

Proven Case Study of Caregiver Website built with Ruby on Rails

byBoTree Technologies
3 years ago

Reasons Why React Native is the Future of Mobile App Development (Updated)

byShardul Bhatt
3 years ago

Top 10 Ruby on Rails Tools for App Development

byShardul Bhatt
2 years ago
Exit mobile version