Skip to Content

Google Professional Cloud Developer: How to Migrate Containerized Python Service to Google Cloud and Minimize Cost?

Learn the most cost-effective way to migrate an on-premises containerized Python service to Google Cloud and track error logs using Error Reporting. Discover how Cloud Run simplifies deployment and error handling.

Table of Contents

Question

You have an on-premises containerized service written in the current stable version of Python 3 that is available only to users in the United States. The service has high traffic during the day and no traffic at night. You need to migrate this application to Google Cloud and track error logs after the migration in Error Reporting. You want to minimize the cost and effort of these tasks. What should you do?

A. Deploy the code on Cloud Run. Configure your code to write errors to standard error.
B. Deploy the code on Cloud Run. Configure your code to stream errors to a Cloud Storage bucket.
C. Deploy the code on a GKE Autopilot cluster. Configure your code to write error logs to standard error.
D. Deploy the code on a GKE Autopilot cluster. Configure your code to write error logs to a Cloud Storage bucket.

Answer

A. Deploy the code on Cloud Run. Configure your code to write errors to standard error.

Explanation

Cloud Run is the most cost-effective and efficient solution for migrating this containerized Python service to Google Cloud for several reasons:

  1. Serverless: Cloud Run is a fully managed serverless platform, meaning you only pay for the resources your application uses during actual processing. This is ideal for a service with high traffic during the day and no traffic at night, as you won’t be charged for idle time.
  2. Container-native: Cloud Run supports deploying containerized applications, making it easy to migrate your existing Python service without significant modifications.
  3. Automatic scaling: Cloud Run automatically scales your application based on incoming requests, ensuring it can handle high traffic during the day and scale down to zero when there’s no traffic.
  4. Error Reporting integration: When you configure your Python code to write errors to standard error (stderr), Cloud Run automatically captures and forwards these logs to Error Reporting. This allows you to easily track and analyze error logs without additional setup.

In contrast, deploying the service on a GKE Autopilot cluster (options C and D) would be more expensive and require more management overhead. While GKE Autopilot simplifies cluster management compared to standard GKE, it still involves managing a Kubernetes cluster and doesn’t provide the same automatic scaling and cost optimization as Cloud Run.

Additionally, streaming errors to a Cloud Storage bucket (option B) or writing error logs to a Cloud Storage bucket (option D) would require extra configuration and potentially increase costs compared to using the built-in Error Reporting integration with Cloud Run.

Therefore, deploying the containerized Python service on Cloud Run and configuring the code to write errors to standard error is the most cost-effective and efficient solution for migrating the application to Google Cloud and tracking error logs in Error Reporting.

Google Professional Cloud Developer certification exam assessment practice question and answer (Q&A) dump including multiple choice questions (MCQ) and objective type questions, with detail explanation and reference available free, helpful to pass the Google Professional Cloud Developer exam and earn Google Professional Cloud Developer certification.