class AWS::S3::Bucket

def exists?

Returns:
  • (Boolean) - Returns true if the bucket exists in S3.

Other tags:
    Note: - This method only indicates if there is a bucket in S3, not
def exists?
  begin
    versioned? # makes a get bucket request without listing contents
               # raises a client error if the bucket doesn't exist or
               # if you don't have permission to get the bucket 
               # versioning status.
    true
  rescue Errors::NoSuchBucket => e
    false # bucket does not exist
  rescue Errors::ClientError => e
    true # bucket exists
  end
end