A background data processing pipeline requires access to send telemetry events to Cloud Pub/Sub topics located within a dedicated analytics project. The service account assigned to the pipeline should only have permissions to publish messages, without the ability to create topics, read messages from subscriptions, or alter topic configurations. To adhere to the principle of least privilege, which IAM role configuration should be applied to the service account?
- Grant the Pub/Sub Publisher (roles/pubsub.publisher) role at the project level.Answer
- BGrant the Editor (roles/editor) role at the project level.
- CGrant the Pub/Sub Publisher (roles/pubsub.publisher) role at the organization level.
- DGrant the Pub/Sub Admin (roles/pubsub.admin) role at the project level.
Answer
Grant the Pub/Sub Publisher (roles/pubsub.publisher) role at the project level.
Granting the predefined Pub/Sub Publisher role at the project level satisfies the principle of least privilege by providing only the permissions needed to publish messages within the designated project, preventing excessive access to non-required actions or other projects.
Step-by-Step Solution
Key Concept
Principle of Least Privilege and Resource Hierarchy Scoping in GCP IAM