AWS SDK for Ruby
Developer Guide

Changing the Properties for an Amazon S3 Bucket Item

The following example adds public read-only access, sets server-side encryption to AES-256, and sets the storage class to Reduced Redundancy for the item my-item in the bucket my-bucket in the us-west-2 region.

require 'aws-sdk-s3' # v2: require 'aws-sdk' args_list = {} args_list[:bucket] = 'my-bucket' args_list[:key] = 'my-item' # Where we are getting the source to copy from args_list[:copy_source] = 'my-bucket/my-item' # The acl can be any of: # private, public-read, public-read-write, authenticated-read, aws-exec-read, bucket-owner-read, bucket-owner-full-control args_list[:acl] = 'public-read' # The encryption can be any of: # AES256, aws:kms args_list[:server_side_encryption] = 'AES256' # The storage_class can be any of: # STANDARD, REDUCED_REDUNDANCY, STANDARD_IA args_list[:storage_class] = 'REDUCED_REDUNDANCY' client = Aws::S3::Client.new(region: 'us-west-2') client.copy_object(args_list)