A software engineer is developing a Python microservice running on Compute Engine instances that programmatically uploads reports to Cloud Storage and publishes events to Cloud Pub/Sub. Enterprise security policy strictly prohibits storing downloadable service account JSON keys on virtual machine disks. Additionally, the microservice must handle high-volume API requests without failing due to transient API quota limits. Which TWO design patterns should the developer implement to satisfy security policy and handle API interactions resiliently? (Select TWO)
- Configure the microservice SDK client to utilize Application Default Credentials (ADC) to retrieve identity tokens directly from the Compute Engine metadata server.Answer
- BGenerate a service account JSON key during VM startup script execution and store it in local ephemeral storage referenced by the GOOGLE_APPLICATION_CREDENTIALS environment variable.
- Implement exponential backoff retry algorithms with randomized jitter when receiving HTTP 429 rate limit responses from GCP APIs.Answer
- DAssign the primitive Owner IAM role to the service account attached to the Compute Engine instance to prevent permission denial errors across target resources.
Answer
The developer should configure the microservice SDK to use Application Default Credentials (ADC) fetching identity from the metadata server, and implement exponential backoff with randomized jitter for API retry handling.
The correct approach combines credential-less authentication via Application Default Credentials (ADC) leveraging the VM metadata server, and resilient client-side API error handling using exponential backoff with randomized jitter for rate limits.
Step-by-Step Solution
Key Concept
Programmatic Authentication and Resilient API Design