ruby/example_code/s3/create_bucket_snippet.rb
def run_me
  bucket_name = 'doc-example-bucket'
  region = 'us-west-2'

  s3_client = Aws::S3::Client.new(region: region)

  puts "Creating the bucket '#{bucket_name}'..."

  if bucket_created?(s3_client, bucket_name)
    puts 'The bucket was created.'
  else
    puts 'The bucket was not created. Stopping program.'
    exit 1
  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.
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)
  puts "Creating the bucket '#{bucket_name}'..."
  if bucket_created?(s3_client, bucket_name)
    puts 'The bucket was created.'
  else
    puts 'The bucket was not created. Stopping program.'
    exit 1
  end
end
def run_me bucket_name = 'doc-example-bucket' region = 'us-west-2' s3_client = Aws :: S3 :: Client . new ( region : region ) puts "Creating the bucket '#{bucket_name}'..." if bucket_created? ( s3_client , bucket_name ) puts 'The bucket was created.' else puts 'The bucket was not created. Stopping program.' exit 1 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 .