Panduan memulai: Men-deploy ke Cloud Run

Halaman ini menunjukkan cara menggunakan Cloud Run untuk men-deploy container contoh.

Sebelum memulai

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Google Cloud project.

  4. Make sure that you have the following role or roles on the project: Cloud Run Developer, Service Account Creator, Service Account User

    Check for the roles

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.

    4. For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.

    Grant the roles

    1. In the Google Cloud console, go to the IAM page.

      Buka IAM
    2. Pilih project.
    3. Klik Berikan akses.
    4. Di kolom Akun utama baru, masukkan ID pengguna Anda. Biasanya berupa alamat email untuk Akun Google.

    5. Di daftar Pilih peran, pilih peran.
    6. Untuk memberikan peran tambahan, klik Tambahkan peran lain, lalu tambahkan setiap peran tambahan.
    7. Klik Simpan.
  5. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  6. Make sure that billing is enabled for your Google Cloud project.

  7. Make sure that you have the following role or roles on the project: Cloud Run Developer, Service Account Creator, Service Account User

    Check for the roles

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.

    4. For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.

    Grant the roles

    1. In the Google Cloud console, go to the IAM page.

      Buka IAM
    2. Pilih project.
    3. Klik Berikan akses.
    4. Di kolom Akun utama baru, masukkan ID pengguna Anda. Biasanya berupa alamat email untuk Akun Google.

    5. Di daftar Pilih peran, pilih peran.
    6. Untuk memberikan peran tambahan, klik Tambahkan peran lain, lalu tambahkan setiap peran tambahan.
    7. Klik Simpan.

Men-deploy contoh container

Untuk men-deploy container, ikuti langkah-langkah berikut:

  1. Di konsol Google Cloud , buka halaman Cloud Run:

    Buka Cloud Run

  2. Pilih Layanan dari menu, lalu klik Deploy container.

  3. Di formulir Create service, pastikan opsi Deploy one revision from an existing container image dipilih.

  4. Di halaman Create service, untuk Container image URL, klik Test with a sample container.

  5. Di kolom Nama layanan, masukkan nama layanan atau gunakan nilai default.

  6. Dalam daftar Region, gunakan nilai default us-central1, atau pilih region tempat Anda ingin men-deploy penampung.

  7. Di bagian Autentikasi, pilih Izinkan pemanggilan tanpa autentikasi.

  8. Klik Buat, lalu tunggu hingga container di-deploy ke Cloud Run. Setelah deployment, URL penampung akan ditampilkan di samping teks URL:.

  9. Untuk melihat penampung yang sedang berjalan, klik Salin ke papan klip untuk menyalin URL-nya, lalu tempel URL ke kolom URL browser Anda.

    Jika Anda dikenai kebijakan organisasi pembatasan domain yang membatasi pemanggilan yang tidak diautentikasi untuk project, Anda perlu mengakses layanan yang di-deploy seperti yang dijelaskan di bagian Menguji layanan pribadi.

Lokasi Cloud Run

Cloud Run bersifat regional, berarti infrastruktur yang menjalankan layanan Cloud Run Anda terletak di region tertentu dan dikelola oleh Google agar tersedia secara redundan di semua zona dalam region tersebut.

Memenuhi persyaratan latensi, ketersediaan, atau ketahanan adalah faktor utama untuk memilih region tempat layanan Cloud Run dijalankan. Pada umumnya, Anda dapat memilih region yang paling dekat dengan pengguna Anda, tetapi Anda harus mempertimbangkan lokasi produk Google Cloud lainnya yang digunakan oleh layanan Cloud Run Anda. Menggunakan Google Cloud produk secara bersamaan di beberapa lokasi dapat memengaruhi latensi serta biaya layanan Anda.

Cloud Run tersedia di region berikut:

Tergantung harga Tingkat 1

  • asia-east1 (Taiwan)
  • asia-northeast1 (Tokyo)
  • asia-northeast2 (Osaka)
  • asia-south1 (Mumbai, India)
  • europe-north1 (Finlandia) ikon daun CO2 Rendah
  • europe-north2 (Stockholm) ikon daun CO2 Rendah
  • europe-southwest1 (Madrid) ikon daun CO2 Rendah
  • europe-west1 (Belgia) ikon daun CO2 Rendah
  • europe-west4 (Belanda) ikon daun CO2 Rendah
  • europe-west8 (Milan)
  • europe-west9 (Paris) ikon daun CO2 Rendah
  • me-west1 (Tel Aviv)
  • northamerica-south1 (Meksiko)
  • us-central1 (Iowa) ikon daun CO2 Rendah
  • us-east1 (South Carolina)
  • us-east4 (North Virginia)
  • us-east5 (Columbus)
  • us-south1 (Dallas) ikon daun CO2 Rendah
  • us-west1 (Oregon) ikon daun CO2 Rendah

Tergantung harga Tingkat 2

  • africa-south1 (Johannesburg)
  • asia-east2 (Hong Kong)
  • asia-northeast3 (Seoul, Korea Selatan)
  • asia-southeast1 (Singapura)
  • asia-southeast2 (Jakarta)
  • asia-south2 (Delhi, India)
  • australia-southeast1 (Sydney)
  • australia-southeast2 (Melbourne)
  • europe-central2 (Warsawa, Polandia)
  • europe-west10 (Berlin) ikon daun CO2 Rendah
  • europe-west12 (Turin)
  • europe-west2 (London, Inggris Raya) ikon daun CO2 Rendah
  • europe-west3 (Frankfurt, Jerman) ikon daun CO2 Rendah
  • europe-west6 (Zurich, Swiss) ikon daun CO2 Rendah
  • me-central1 (Doha)
  • me-central2 (Dammam)
  • northamerica-northeast1 (Montreal) ikon daun CO2 Rendah
  • northamerica-northeast2 (Toronto) ikon daun CO2 Rendah
  • southamerica-east1 (Sao Paulo, Brasil) ikon daun CO2 Rendah
  • southamerica-west1 (Santiago, Cile) ikon daun CO2 Rendah
  • us-west2 (Los Angeles)
  • us-west3 (Salt Lake City)
  • us-west4 (Las Vegas)

Jika sudah membuat layanan Cloud Run, Anda dapat melihat region di dasbor Cloud Run di Google Cloud konsol.

Cloud Run secara otomatis menskalakan instance container Anda berdasarkan permintaan, dan Anda hanya membayar untuk CPU, memori, dan jaringan yang terpakai selama pemrosesan permintaan.

Langkah berikutnya

Untuk mempelajari cara mem-build container dari sumber kode, mengirim ke Artifact Registry, dan men-deploynya, lihat: