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

Replace us-west-2 with the AWS Region you're using for Amazon S3.
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'
  local_path = "./#{object_key}"
  region = 'us-west-2'
  s3_client = Aws::S3::Client.new(region: region)
  if object_downloaded?(s3_client, bucket_name, object_key, local_path)
    puts "Object '#{object_key}' in bucket '#{bucket_name}' " \
      "downloaded to '#{local_path}'."
  else
    puts "Object '#{object_key}' in bucket '#{bucket_name}' not downloaded."
  end
end
def run_me bucket_name = 'doc-example-bucket' object_key = 'my-file.txt' local_path = "./#{object_key}" region = 'us-west-2' s3_client = Aws :: S3 :: Client . new ( region : region ) if object_downloaded? ( s3_client , bucket_name , object_key , local_path ) puts "Object '#{object_key}' in bucket '#{bucket_name}' " "downloaded to '#{local_path}'." else puts "Object '#{object_key}' in bucket '#{bucket_name}' not downloaded." end end
Replace us-west-2 with the AWS Region you're using for Amazon S3.
Replace us - west - 2 with the AWS Region you ' re using for Amazon S3 .