p1100i
p1100i

Reputation: 3740

Can I use transactional file remove/upload on AWS S3 with aws-sdk-ruby?

I find ActiveRecord::Base.transaction very effective in complex methods.

I was wondering if its possible to upload/remove files from AWS S3 within a transaction like:

S3Object.transaction do
   # write into files
   # raise an exception
end

After the exception is raised every action should be rolled back on S3. Is this possible with S3Object?

Upvotes: 10

Views: 8383

Answers (1)

dcro
dcro

Reputation: 13649

Although the S3 API has a bulk delete functionality, it does not support transactions as each delete operation can succeed/fail independently of the others.

The API does not provide any bulk upload functionality (through PUT or POST) so each upload operation is done through an independent API call that can succeed or fail.

As a result, the Ruby API client or any other API clients can not provide any transactional support for S3 operations.

Upvotes: 14

Related Questions