Prepare and test your skills

Prepare and test your skills

Free sample question with answers and detailed explanation below. The Professional Cloud Developer practice bank has an additional 608 practice questions.Try 10 free realistic questions: instant score, no credit card, and no account required.
A media-sharing backend running on Cloud Run lets unauthenticated mobile users upload profile images directly to a private Cloud Storage bucket. Your security and architecture teams enforce the following requirements:
Content-Type header matches image/png.Which implementation strategy should you use to generate these signed URLs?
PUT method, and content-type set to image/png in the signed canonical headers, authenticating with iam.serviceAccounts.signBlob permissions.A V4 signed URL grants time-limited, cryptographically authenticated access to a specific Cloud Storage object without requiring the end user to hold a Google identity or IAM permissions. Using a Cloud Storage client library (such as Python, Node.js, Go, or Java) lets your application compute the GOOG4-RSA-SHA256 canonical request and signature directly in code.
iam.serviceAccounts.signBlob), making them fast and scalable for high-concurrency Cloud Run workloads.900-second) x-goog-expires window follows least-privilege security best practices.Content-Type: Specifying content-type (image/png) adds it to x-goog-signedheaders in the canonical request. Cloud Storage verifies the incoming PUT request's Content-Type header against the signature and rejects any mismatched upload with a 403 SignatureDoesNotMatch error.iam.serviceAccounts.signBlob with Application Default Credentials avoids storing or rotating long-lived service account JSON key files.Compared to shelling out to CLI tools like gsutil or gcloud storage, programmatic generation via Cloud Storage client libraries provides lower latency, stronger error handling, and seamless IAM integration without managing local keys or subprocesses.
gsutil signurl command from a subprocess in the Cloud Run service with a 15m duration and PUT method, using a mounted service account JSON key file.gsutil signurl Doesgsutil is a legacy Python command-line tool for interacting with Cloud Storage buckets and objects. Its signurl subcommand was historically used by administrators to generate signed URLs interactively or in simple operational scripts from a local terminal.
gsutil is minimally maintained and is not recommended for Cloud Storage workflows; the gcloud storage CLI (gcloud storage sign-url) replaces it for interactive and administrative command-line tasks.iam.serviceAccounts.signBlob.Content-Type validation unless explicitly configured via -c flags and handled carefully across environments.An administrator needed to generate a quick, one-off signed URL manually from a workstation terminal and only had an older legacy script relying on gsutil—though gcloud storage sign-url with --impersonate-service-account is still preferred for CLI usage.
generate_signed_url or getSignedUrl helper with a 15-minute expiration and image/png content type.HMAC (Hash-based Message Authentication Code) keys are access ID and secret pairs associated with a service account or user account in Cloud Storage. They are primarily used to authenticate requests to the Cloud Storage XML API for tools and workloads migrating from Amazon S3.
gcloud storage sign-url do not support HMAC credentials for generating signed URLs. Passing HMAC credentials to standard client library signing methods fails because V4 signed URL helpers use RSA-SHA256 (GOOG4-RSA-SHA256) asymmetric signing.iam.serviceAccounts.signBlob, or a custom signing callback—not HMAC access keys.AWS4-HMAC-SHA256 or GOOG4-HMAC-SHA256) when using third-party S3 SDKs.gcloud storage tools explicitly exclude HMAC credentials for URL signing.You were using a third-party S3-compatible client library configured to hit the Cloud Storage XML API endpoint (storage.googleapis.com) using AWS Signature Version 4 interoperability rather than Google Cloud Storage's native client libraries.
content-type from the signed parameters so clients can set the header dynamically at upload time.In V4 signing, expiration limits define the maximum lifetime of a signed URL (x-goog-expires), while canonical headers (x-goog-signedheaders) determine which HTTP request headers Cloud Storage validates against the cryptographic signature before allowing an operation.
Content-Type: Omitting content-type from the signed parameters removes it from x-goog-signedheaders. Without content-type bound to the signature, any user holding the URL can upload arbitrary files—such as text/html or executable scripts—bypassing the image/png restriction.x-goog-expires at 604,800 seconds to limit the blast radius of leaked URLs.x-goog-signedheaders are verified by Cloud Storage during the PUT request.x-goog-date) without needing multi-week lifetimes.No answer using a 14-day V4 signed URL would be valid because V4 signing prohibits expirations longer than 7 days. If longer-lived access were genuinely required, the application would need to refresh short-lived signed URLs on demand or use authenticated IAM access instead.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated Validated