I'm migrating my rails app to Heroku and need to change my file upload functionality to use Amazon S3 instead of local storage. I am using the aws-s3 gem and have this working but just want to make sure that I'm doing things right and not creating problems for myself.
In my uploading code I have the following;
AWS::S3::Base.establish_connection!(
:access_key_id => 'Not telling',
:secret_access_key => 'Really not telling'
)
AWS::S3::S3Object.store("#{self.name}", upload_file_field.read, 'my_bucket')
This works perfectly but I'm concerned that I'm leaving some sort of connection to the server open. Do I need to close the connection once I'm done (e.g. with AWS::S3::Base.disconnect
) or can I just leave this as it is?
Clearly I don't have a good understanding of the protocols being used behind the scenes with my connection to S3 but I don't particularly want to - I just want to make sure that this will work without causing problems.