Your security team bans long-lived service account keys. A developer must run a local script that uploads files to a production Cloud Storage bucket for the next hour. The developer should not gain permanent Storage permissions. Which approach best meets the requirement?
Generate an HMAC access key for the service account, share it with the developer, and require them to rotate it after seven days.
Grant the developer the Storage Object Admin role on the bucket and have them authenticate with gcloud auth login before running the script.
Download a JSON key for the service account, set the GOOGLE_APPLICATION_CREDENTIALS environment variable, and run the script with gsutil.
Impersonate a dedicated service account by running gcloud auth print-access-token --impersonate-service-account and use the returned token with gsutil; give the developer only the Service Account Token Creator role on that account.
Using service account impersonation lets the developer create a short-lived OAuth 2.0 access token (typically valid for one hour) without downloading any key file. The developer is granted the Service Account Token Creator role on a service account that already has the Storage Object Admin role on the bucket. They then run:
Because the token expires quickly and no keys are stored locally, the solution respects the organisation's policy. Downloading a JSON key or an HMAC key creates long-lived credentials, and directly granting the developer Storage privileges would give them permanent access, violating least-privilege requirements.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is service account impersonation?
Open an interactive chat with Bash
How does OAuth 2.0 access tokens work in this context?
Open an interactive chat with Bash
What is the role of Service Account Token Creator in this solution?
Open an interactive chat with Bash
What is service account impersonation in GCP?
Open an interactive chat with Bash
What is the Service Account Token Creator role in GCP?
Open an interactive chat with Bash
Why are JSON keys or HMAC keys not recommended for temporary access in GCP?
Open an interactive chat with Bash
GCP Associate Cloud Engineer
Configuring access and security
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .