ruby/example_code/s3/s3-ruby-example-bucket-accessible.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'
  region = 'us-west-2'
  s3_client = Aws::S3::Client.new(region: region)
  if bucket_in_region?(s3_client, bucket_name, region)
    puts "Bucket '#{bucket_name}' exists in Region '#{region}'."
  else
    puts "Bucket '#{bucket_name}' does not exist, " \
      "does not exist in AWS Region '#{region}', " \
      'the Region was not specified when the bucket was initially created, ' \
      'or the bucket is not otherwise accessible to you.'
  end
end
def run_me bucket_name = 'doc-example-bucket' region = 'us-west-2' s3_client = Aws :: S3 :: Client . new ( region : region ) if bucket_in_region? ( s3_client , bucket_name , region ) puts "Bucket '#{bucket_name}' exists in Region '#{region}'." else puts "Bucket '#{bucket_name}' does not exist, " "does not exist in AWS Region '#{region}', " 'the Region was not specified when the bucket was initially created, ' 'or the bucket is not otherwise accessible to you.' end 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 .