ruby/example_code/s3/s3_get_cskms_decrypt_item.rb
# Full example call:
# Replace us-west-2 with the AWS Region you're using for Amazon S3.

Full example call:
Replace us-west-2 with the AWS Region you're using for Amazon S3.
Full example call : Replace us - west - 2 with the AWS Region you ' re using for Amazon S3 .
def run_me
  bucket_name = 'doc-example-bucket'
  object_key = 'my-file.txt'
  region = 'us-west-2'
  kms_key_id = '9041e78c-7a20-4db3-929e-828abEXAMPLE'
  s3_encryption_client = Aws::S3::EncryptionV2::Client.new(
    region: region,
    kms_key_id: kms_key_id,
    key_wrap_schema: :kms_context,
    content_encryption_schema: :aes_gcm_no_padding,
    security_profile: :v2
  )
  puts get_decrypted_object_content(
    s3_encryption_client,
    bucket_name,
    object_key
  )
end
def run_me bucket_name = 'doc-example-bucket' object_key = 'my-file.txt' region = 'us-west-2' kms_key_id = '9041e78c-7a20-4db3-929e-828abEXAMPLE' s3_encryption_client = Aws :: S3 :: EncryptionV2 :: Client . new ( region : region , kms_key_id : kms_key_id , key_wrap_schema : :kms_context , content_encryption_schema : :aes_gcm_no_padding , security_profile : :v2 ) puts get_decrypted_object_content ( s3_encryption_client , bucket_name , object_key ) end
Full example call:
Replace us-west-2 with the AWS Region you're using for Amazon S3.
Full example call : Replace us - west - 2 with the AWS Region you ' re using for Amazon S3 .
# Note that in the following call:
 # - key_wrap_schema must be kms_context for AWS KMS.
 # - To allow reading and decrypting objects that are encrypted by the
 #   Amazon S3 V1 encryption client instead, use :v2_and_legacy instead of :v2.
