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. 登录您的 Google 帐号。

    如果您还没有 Google 帐号,请注册新帐号

  2. 设置 GCP Console 项目。

    设置项目

    点击即可执行以下操作:

    • 创建或选择项目。
    • 启用该项目Cloud Storage API。
    • 创建服务帐号。
    • 下载 JSON 格式的私钥。

    您可以随时在 GCP Console 中查看和管理这些资源。

3
Write your code
# 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
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 Cloud operations products provide 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.

Operations products
Unified monitoring, logging, and diagnostics for applications on Google Cloud and AWS.
Error Reporting
A walk through of getting an error alert and investigating the error in the Cloud Console.
Monitor, diagnose, and fix
In this video, Aja Hammerly uses Cloud Monitoring, Cloud Logging, Error Reporting, Cloud Debugger, and Cloud Trace to find and fix some subtle errors in an example app.
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.