Client-Side Encryption with AWS and Ruby

1 · Andrew Kane · Sept. 23, 2017, 7 a.m.
AWS makes it easy to enable server-side encryption on many of its services, but it also provides ways to do client-side encryption well. Here are a few ways in Ruby. S3 Gem: aws-sdk-s3 client = Aws::S3::Encryption::Client.new( kms_key_id: "alias/my-key" ) client.put_object( body: File.read("test.txt"), bucket: "my-bucket", key: "test.txt" ) resp = client.get_object( bucket: "my-bucket", key: "test.txt" ) puts resp.body.read Use encryption_key instead of kms_key_id to manage keys ...