All practice questions
1591 questions
A cloud engineer needs to grant a specific service account named `[email protected]` permission to invoke an existing internal Cloud Run service named `payment-processor`. Following Google Cloud best practices and the principle of least privilege, which `gcloud` command should the engineer execute?
An operations engineer needs to expand the primary IPv4 address range of an existing custom subnet named `prod-subnet-us-east` located in region `us-east1` from to without disrupting existing workloads running in the Virtual Private Cloud (VPC). Which `gcloud` command should the engineer execute to perform this operation?
An enterprise cloud security architect is standardizing access controls on a Cloud Storage bucket named `enterprise-data-repository` by transitioning from legacy Access Control Lists (ACLs) to Uniform Bucket-Level Access (UBLA). Arrange the following administrative actions in the correct chronological sequence to complete this migration without causing access disruption for existing service accounts.
Drag items to arrange them in the correct order
A system administrator needs to restrict outbound network connections from Compute Engine instances with the network tag `database-node` in a custom Virtual Private Cloud (VPC) named `production-vpc`. The requirement specifies blocking all egress traffic originating from these instances to a legacy external IP address `198.51.100.50/32`, while taking precedence over standard default rules. Which `gcloud` command correctly implements this security requirement?
A cloud administrator manages a stateless batch data processing application running on Compute Engine virtual machines. The workload is fault-tolerant and can easily tolerate intermittent node terminations. To minimize compute costs, the administrator plans to transition the workload to Spot VMs. Which approach recommended by Google Cloud best practices should the administrator implement to ensure terminated instances are automatically recreated while maintaining the desired pool capacity?
An infrastructure engineer is configuring VPC firewall rules for web workloads running on Compute Engine instances tagged `web-tier`. An existing ingress firewall rule named `allow-web` allows TCP traffic on port 8080 from `0.0.0.0/0` with a priority of 1000. To meet security requirements, incoming traffic on port 8080 from the external subnet `198.51.100.0/24` must be blocked, while continuing to allow port 8080 traffic from all other external IP addresses. Which configuration will successfully achieve this requirement?
During a security incident investigation, a Cloud Operations Security Analyst needs to review Google Cloud Audit Logs to identify every instance where a user or service account read secret payloads from Secret Manager within project `prod-sec-vault`. The analyst wants to run a `gcloud logging read` command that strictly filters for Data Access audit logs generated by Secret Manager payload access methods, excluding Admin Activity logs and unrelated services. Which filter expression should the analyst pass to the command?
An organization requires developers to run local database migration scripts against a Cloud SQL instance by assuming the identity of a dedicated service account `[email protected]`. In accordance with Google Cloud security best practices, static service account key creation is strictly disabled by organizational policy. Which configuration allows the developers to authenticate as the service account while adhering to the security policy?
An application developer needs to deploy a stateless HTTP web service named report-generator packaged as a container image to Google Cloud Run in the us-east1 region. The containerized application is built to listen on the port defined by the standard PORT environment variable injected by the Cloud Run container runtime at startup. Which command should the developer execute to deploy this container image from Artifact Registry to Cloud Run while adhering to Google Cloud serverless best practices?
A cloud engineer needs to update an existing running Compute Engine virtual machine instance named `app-worker-1` to use a custom IAM service account named `[email protected]` instead of the default Compute Engine service account. The configuration update must be completed using the Google Cloud CLI (`gcloud`) without deleting the instance or losing disk state. Which sequence of actions should the cloud engineer execute?
A cloud engineer needs to deploy a new Compute Engine virtual machine instance into a specific VPC subnet using a pre-reserved static internal IP address. Additionally, the instance requires a secondary persistent disk populated from an existing disk snapshot. What is the correct sequence of steps to execute this deployment using the Google Cloud CLI?
Drag items to arrange them in the correct order
An Associate Cloud Engineer needs to perform a controlled canary rollout of a new application revision across an existing Managed Instance Group (MIG) named `frontend-mig`. The deployment strategy requires testing the updated software on a fraction of the instances before fully updating the entire group. In what order should the engineer execute the following `gcloud` operations to complete this canary deployment safely?
Drag items to arrange them in the correct order
A cloud engineer is deploying a Compute Engine virtual machine instance named `web-app-frontend` in zone `us-east1-b`. The engineer has written a setup shell script stored on their local workstation at `./scripts/install-web.sh` that must execute automatically whenever the instance boots up for the first time. Which `gcloud` command correctly creates the virtual machine instance and passes the local script file as a startup script?
A cloud engineer needs to execute a gcloud CLI command to deploy a new Compute Engine VM instance named batch-processor. The instance must execute initialization tasks on startup using a shell script located on the local workstation at ./scripts/init.sh. Additionally, the instance must run under a custom user-managed service account named [email protected]. Which flags must be included in the gcloud compute instances create command to meet these requirements? (Select TWO.)
Select all that apply
A cloud architecture team requires a newly deployed Compute Engine virtual machine instance named analytics-node in zone us-central1-a to connect directly to two isolated Virtual Private Cloud (VPC) subnets: subnet-analytics and subnet-management. Which gcloud command correctly provisions the virtual machine with multiple network interfaces?
A cloud engineer needs to deploy a new Compute Engine virtual machine instance that relies on a custom OS image stored in a separate centralized image-repository project. The VM must be assigned a reserved static internal IP address within a specific subnet and execute an automated initialization script upon first boot. What is the correct sequence of steps required to prepare resources, deploy the instance, and verify startup execution?
Drag items to arrange them in the correct order
A cloud engineer needs to deploy a containerized web application to Google Cloud Run from local application source code in a newly created Google Cloud project. Place the operational steps in the correct execution sequence from first to last.
Drag items to arrange them in the correct order
A solutions team is building an automated file processing solution on Google Cloud. Every time a JPEG file is created in a Cloud Storage bucket named `raw-image-uploads`, a lightweight Node.js routine must run to create a thumbnail. The team chooses Cloud Functions (2nd gen) because of its native Eventarc integration and event-driven execution model. Which `gcloud` CLI command should the team run to correctly deploy this function triggered by file uploads?
An organization is deploying a Compute Engine virtual machine instance named `data-worker` to process batch analytics. The application running inside `data-worker` must read files from a Cloud Storage bucket using a custom service account named `[email protected]`. To follow Google Cloud security best practices, the custom service account has been granted only the Storage Object Viewer IAM role on the bucket. Which `gcloud compute instances create` command correctly attaches the custom service account while allowing IAM roles to govern the instance's access?
A DevOps team is setting up an automated worker pool on Compute Engine to execute nightly video encoding jobs. The encoding tasks process independent chunks of data, persist progress checkpoints to Cloud Storage, and can automatically resume if an instance terminates unexpectedly. The team wants to minimize compute costs while maintaining processing capacity across the region. Which deployment strategy should the team implement?