Exams GCP Developer - Group Flashcards
You need to copy directory local-scripts and all of its contents from your local workstation to a Compute Engine virtual machine instance.
Which command should you use?
A.gsutil cp –project “my-gcp-project” -r ~/local-scripts/ gcp-instance-name:~/server-scripts/ –zone “us-east1-b”
B.gsutil cp –project “my-gcp-project” -R ~/local-scripts/ gcp-instance-name:~/server-scripts/ –zone “us-east1-b”
C.gcloud compute scp –project “my-gcp-project” –recurse ~/local-scripts/ gcp-instance-name:~/server-scripts/ –zone“us-east1-b”
D.gcloud compute mv –project “my-gcp-project” –recurse ~/local-scripts/ gcp-instance-name:~/server-scripts/ –zone“us-east1-b”
C.gcloud compute scp –project “my-gcp-project” –recurse ~/local-scripts/ gcp-instance-name:~/server-scripts/ –zone“us-east1-b”
NOTES:
gsutil only is valid to google cloud storage - https://cloud.google.com/storage/docs/gsutil
gcloud compute scp - https://cloud.google.com/sdk/gcloud/reference/compute/scp
You are deploying your application to a Compute Engine virtual machine instance with the Stackdriver Monitoring Agent installed. Your application is a unix processon the instance. You want to be alerted if the unix process has not run for at least 5 minutes. You are not able to change the application to generate metrics or logs.
Which alert condition should you configure? A. Uptime check B. Process health C. Metric absence D. Metric threshold
B. Process health
NOTES:
https://cloud.google.com/monitoring/alerts/ui-conditions-ga
Metric absence AND Metric threshold are types of alerting not conditions
You have two tables in an ANSI-SQL compliant database with identical columns that you need to quickly combine into a single table, removing duplicate rows fromthe result set.
What should you do?
A. Use the JOIN operator in SQL to combine the tables.
B. Use nested WITH statements to combine the tables.
C. Use the UNION operator in SQL to combine the tables.
D. Use the UNION ALL operator in SQL to combine the tables.
C. Use the UNION operator in SQL to combine the tables.
NOTES:
https://www.w3schools.com/sql/sql_union.asp
You have an application deployed in production. When a new version is deployed, some issues don’t arise until the application receives traffic from users inproduction. You want to reduce both the impact and the number of users affected.
Which deployment strategy should you use? A. Blue/green deployment B. Canary deployment C. Rolling deployment D. Recreate deployment
B. Canary deployment
NOTES:
https://dev.to/mostlyjason/intro-to-deployment-strategies-blue-green-canary-and-more-3a3
You need to migrate an internal file upload API with an enforced 500-MB file size limit to App Engine.
What should you do? A. Use FTP to upload files. B. Use CPanel to upload files. C. Use signed URLs to upload files. D. Change the API to be a multipart file upload API.
C. Use signed URLs to upload files.
NOTES:
https://cloud.google.com/appengine/docs/standard/python/blobstore?hl=es-419
You are planning to deploy your application in a Google Kubernetes Engine (GKE) cluster The application exposes an HTTP-based health check at /healthz. Youwant to use this health check endpoint to determine whether traffic should be routed to the pod by the load balancer.
Which code snippet should you include in your Pod configuration? A. livenesssProve: httpGet: path: /healthz port: 80 B. readinessProbe: httpGet: path: /healthz port: 80 C. loadbalancerHealthCheck: httpGet: path: /healthz port:80 D. healthCheck: httpGet: path: /healthz port: 80
B. readinessProbe: httpGet: path: /healthz port: 80
NOTES:
https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
The kubelet uses liveness probes to know when to restart a container. For example, liveness probes could catch a deadlock, where an application is running, but unable to make progress. Restarting a container in such a state can help to make the application more available despite bugs.
The kubelet uses readiness probes to know when a container is ready to start accepting traffic. A Pod is considered ready when all of its containers are ready. One use of this signal is to control which Pods are used as backends for Services. When a Pod is not ready, it is removed from Service load balancers.
The kubelet uses startup probes to know when a container application has started. If such a probe is configured, it disables liveness and readiness checks until it succeeds, making sure those probes don’t interfere with the application startup. This can be used to adopt liveness checks on slow starting containers, avoiding them getting killed by the kubelet before they are up and running.
Your teammate has asked you to review the code below. Its purpose is to efficiently add a large number of small rows to a BigQuery table.
BigQuery service = BigQueryOptions.newBuilder().build().getService(); public void writeToBigQuery (Collection> rows) { for (Map row: rows) { InsertAllRequest insertRequest = InsertAllRequest.newBuilder("datasetId", "tableId", InsertAllRequest.RowToInsert.of(row)).build(); service.insertAll(insertRequest); } }
Which improvement should you suggest your teammate make?
A. Include multiple rows with each request.
B. Perform the inserts in parallel by creating multiple threads.
C. Write each row to a Cloud Storage object, then load into BigQuery.
D. Write each row to a Cloud Storage object in parallel, then load into BigQuery.
B. Perform the inserts in parallel by creating multiple threads.
You are building an API that will be used by Android and iOS apps The API must:
• Support HTTPs
• Minimize bandwidth cost
• Integrate easily with mobile apps
Which API architecture should you use? A. RESTful APIs B. MQTT for APIs C. gRPC-based APIs D. SOAP-based APIs
A. RESTful APIs
Your application takes an input from a user and publishes it to the user’s contacts. This input is stored in a table in Cloud Spanner. Your application is more sensitive to latency and less sensitive to consistency.
How should you perform reads from Cloud Spanner for this application?
A. Perform Read-Only transactions.
B. Perform stale reads using single-read methods.
C. Perform strong reads using single-read methods.
D. Perform stale reads using read-write transactions.
D. Perform stale reads using read-write transactions.
NOTES:
A stale read is read at a timestamp in the past. If your application is latency sensitive but tolerant of stale data, then stale reads can provide performance benefits.
https://cloud.google.com/spanner/docs/reads
Your application is deployed in a Google Kubernetes Engine (GKE) cluster. When a new version of your application is released, your CI/CD tool updates the spec.template.spec.containers[0].image value to reference the Docker image of your new application version. When the Deployment object applies the change, you want to deploy at least 1 replica of the new version and maintain the previous replicas until the new replica is healthy.
Which change should you make to the GKE Deployment object shown below?
apiVersion: apps/v1 kind: Deployment metadata: name: ecommerce-frontend-deployment spec: replicas: 3 selector: matchLabels: app: ecommerce-frontend template: metadata: labels: app: ecommerce-frontend spec: containers: -name: ecommerce-frontend-webapp image: ecommerce-frontend-webapp: 1.7.9 ports: - containerPort: 80
A. Set the Deployment strategy to RollingUpdate with maxSurge set to 0, maxUnavailable set to 1.
B. Set the Deployment strategy to RollingUpdate with maxSurge set to 1, maxUnavailable set to 0.
C. Set the Deployment strategy to Recreate with maxSurge set to 0, maxUnavailable set to 1.
D.Set the Deployment strategy to Recreate with maxSurge set to 1, maxUnavailable set to 0.
B. Set the Deployment strategy to RollingUpdate with maxSurge set to 1, maxUnavailable set to 0.
NOTES:
- maxUnavailable: the maximum number of pods that can be unavailable during the update process. This can be an absolute number or percentage of the replicas count; the default is 25%.
- maxSurge: the maximum number of pods that can be created over the desired number of pods. Again this can be an absolute number or a percentage of the replicas count; the default is 25%.
https://kubernetes.io/blog/2018/04/30/zero-downtime-deployment-kubernetes-jenkins/
You plan to make a simple HTML application available on the internet. This site keeps information about FAQs for your application. The application is static andcontains images, HTML, CSS, and Javascript. You want to make this application available on the internet with as few steps as possible.
What should you do?
A. Upload your application to Cloud Storage.
B. Upload your application to an App Engine environment.
C. Create a Compute Engine instance with Apache web server installed. Configure Apache web server to host the application.
D. Containerize your application first. Deploy this container to Google Kubernetes Engine (GKE) and assign an external IP address to the GKE pod hosting theapplication.
A. Upload your application to Cloud Storage.
NOTES:
https://cloud.google.com/storage/docs/hosting-static-website
Your company has deployed a new API to App Engine Standard environment. During testing, the API is not behaving as expected. You want to monitor the application over time to diagnose the problem within the application code without redeploying the application.
Which tool should you use? A. Stackdriver Trace B. Stackdriver Monitoring C. Stackdriver Debug Snapshots D. Stackdriver Debug Logpoints
B. Stackdriver Monitoring
NOTES:
https://cloud.google.com/monitoring/docs
You want to use the Stackdriver Logging Agent to send an application’s log file to Stackdriver from a Compute Engine virtual machine instance. After installing the Stackdriver Logging Agent,
what should you do first?
A. Enable the Error Reporting API on the project.
B. Grant the instance full access to all Cloud APIs.
C. Configure the application log file as a custom source.
D. Create a Stackdriver Logs Export Sink with a filter that matches the application’s log entries.
C. Configure the application log file as a custom source.
NOTES:
https: //cloud.google.com/logging/docs/agent/logging/configuration#third-party_application_log_input_configuration
https: //medium.com/cloudadventure/streaming-custom-application-logs-on-compute-engine-with-stackdriver-agent-cdc1fee529f0
Your company has a BigQuery dataset named “Master” that keeps information about employee travel and expenses. This information is organized by employee department. That means employees should only be able to view information for their department. You want to apply a security framework to enforce this requirement with the minimum number of steps.
What should you do?
A. Create a separate dataset for each department. Create a view with an appropriate WHERE clause to select records from a particular dataset for the specific department. Authorize this view to access records from your Master dataset. Give employees the permission to this department-specific dataset.
B. Create a separate dataset for each department. Create a data pipeline for each department to copy appropriate information from the Master dataset to the specific dataset for the department. Give employees the permission to this department-specific dataset.
C. Create a dataset named Master dataset. Create a separate view for each department in the Master dataset. Give employees access to the specific view for their department.
D. Create a dataset named Master dataset. Create a separate table for each department in the Master dataset. Give employees access to the specific table fortheir department.
B. Create a separate dataset for each department. Create a data pipeline for each department to copy appropriate information from the Master dataset to the specific dataset for the department. Give employees the permission to this department-specific dataset.
You have an application in production. It is deployed on Compute Engine virtual machine instances controlled by a managed instance group. Traffic is routed to the instances via a HTTP(s) load balancer. Your users are unable to access your application. You want to implement a monitoring technique to alert you when the application is unavailable.
Which technique should you choose? A. Smoke tests B. Stackdriver uptime checks C. Cloud Load Balancing - heath checks D. Managed instance group - heath checks
B. Stackdriver uptime checks
NOTES:
Stackdriver uptime checks =>
https://cloud.google.com/monitoring/uptime-checks
Managed instance group = > https://cloud.google.com/compute/docs/instance-groups/autohealing-instances-in-migs
You are load testing your server application. During the first 30 seconds, you observe that a previously inactive Cloud Storage bucket is now servicing 2000 write requests per second and 7500 read requests per second. Your application is now receiving intermittent 5xx and 429 HTTP responses from the Cloud Storage JSON API as the demand escalates. You want to decrease the failed responses from the Cloud Storage API.
What should you do?
A. Distribute the uploads across a large number of individual storage buckets.
B.Use the XML API instead of the JSON API for interfacing with Cloud Storage.
C.Pass the HTTP response codes back to clients that are invoking the uploads from your application.
D. Limit the upload rate from your application clients so that the dormant bucket’s peak request rate is reached more gradually.
A. Distribute the uploads across a large number of individual storage buckets
NOTES:
https://cloud.google.com/storage/docs/request-rate
Your application is controlled by a managed instance group. You want to share a large read-only data set between all the instances in the managed instance group. You want to ensure that each instance can start quickly and can access the data set via its filesystem with very low latency. You also want to minimize the total cost of the solution.
What should you do?
A. Move the data to a Cloud Storage bucket, and mount the bucket on the filesystem using Cloud Storage FUSE.
B. Move the data to a Cloud Storage bucket, and copy the data to the boot disk of the instance via a startup script.
C. Move the data to a Compute Engine persistent disk, and attach the disk in read-only mode to multiple Compute Engine virtual machine instances.
D. Move the data to a Compute Engine persistent disk, take a snapshot, create multiple disks from the snapshot, and attach each disk to its own instance.
C. Move the data to a Compute Engine persistent disk, and attach the disk in read-only mode to multiple Compute Engine virtual machine instances.
NOTES:
https://cloud.google.com/compute/docs/disks/gcs-buckets
https://cloud.google.com/compute/docs/disks/snapshot-best-practices
You are developing an HTTP API hosted on a Compute Engine virtual machine instance that needs to be invoked by multiple clients within the same Virtual PrivateCloud (VPC). You want clients to be able to get the IP address of the service.
What should you do?
A. Reserve a static external IP address and assign it to an HTTP(S) load balancing service’s forwarding rule. Clients should use this IP address to connect to theservice.
B. Reserve a static external IP address and assign it to an HTTP(S) load balancing service’s forwarding rule. Then, define an A record in Cloud DNS. Clientsshould use the name of the A record to connect to the service.
C. Ensure that clients use Compute Engine internal DNS by connecting to the instance name with the url https://[INSTANCE_NAME].[ZONE].c.[PROJECT_ID].internal/.
D. Ensure that clients use Compute Engine internal DNS by connecting to the instance name with the url https://[API_NAME]/[API_VERSION]/.
C. Ensure that clients use Compute Engine internal DNS by connecting to the instance name with the url https://[INSTANCE_NAME].[ZONE].c.[PROJECT_ID].internal/.
NOTES:
https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names
You are planning to deploy your application in a Google Kubernetes Engine (GKE) cluster. Your application can scale horizontally, and each instance of your application needs to have a stable network identity and its own persistent disk.
Which GKE object should you use? A. Deployment B. StatefulSet C. ReplicaSet D. ReplicaController
B. StatefulSet
NOTES:
https://kubernetes.io/es/docs/concepts/workloads/controllers/statefulset/#usar-statefulsets
You are using Cloud Build to build a Docker image. You need to modify the build to execute unit and run integration tests. When there is a failure, you want the build history to clearly display the stage at which the build failed.
What should you do?
A. Add RUN commands in the Dockerfile to execute unit and integration tests.
B. Create a Cloud Build build config file with a single build step to compile unit and integration tests.
C. Create a Cloud Build build config file that will spawn a separate cloud build pipeline for unit and integration tests.
D.Create a Cloud Build build config file with separate cloud builder steps to compile and execute unit and integration tests.
D.Create a Cloud Build build config file with separate cloud builder steps to compile and execute unit and integration tests.
NOTES:
https://cloud.google.com/build/docs/building-leaner-containers