RUBY ON GOOGLE CLOUD PLATFORM

Try It Free View Documentation

Ruby tools to build cloud-native apps, deploy at scale, and analyze data

  • Build planet-scale web apps and APIs
  • Use Google’s machine learning APIs with native library support
  • Run containerized applications at scale
  • Orchestrate infrastructure with Puppet and Chef
LOVINGLY-CRAFTED RUBY GEMS

Take advantage of our APIs and services using the Google Cloud Ruby Gems and test run our code samples.

1
Install
gem install google-cloud-storage
2
Set up a Cloud Platform Console project
  1. Sign in to your Google Account.

    If you don't already have one, sign up for a new account.

  2. Set up a Cloud Console project.

    Set up a project

    Click to:

    • Create or select a project.
    • Enable the Cloud Storage API for that project.
    • Create a service account.
    • Download a private key as JSON.

    You can view and manage these resources at any time in the Cloud Console.

3
Write your code
# project_id        = "Your Google Cloud project ID"
# bucket_name       = "Your Google Cloud Storage bucket name"
# local_file_path   = "Path to local file to upload"
# storage_file_path = "Path to store the file in Google Cloud Storage"

require "google/cloud/storage"

storage = Google::Cloud::Storage.new project_id: project_id
bucket  = storage.bucket bucket_name

file = bucket.create_file local_file_path, storage_file_path

puts "Uploaded #{file.name}"
RUBY QUICK STARTS
QUICKLY FIND AND DEBUG ISSUES

Google Stackdriver provides powerful monitoring, logging, and diagnostics. It equips you with insight into the health, performance, and availability of cloud-powered applications, enabling you to find and fix issues faster.

Google Stackdriver
Unified monitoring, logging, and diagnostics for applications on Google Cloud Platform and AWS.
Stackdriver Error Reporting
A walk through of getting an error alert and investigating the error in the Google Cloud Console.
Stackdriver Monitor, diagnose, and fix
In this video, Aja Hammerly uses Stackdriver to find and fix some subtle errors in an example app, and you'll learn how to use Stackdriver on your own projects.
Learn more
RUBY ON GCP COMMUNITIES

Got something to say? Join our community to ask questions, or just chat with the experts at Google who help build Ruby for Google Cloud Platform.