A DevOps team needs to allow an application running on an external AWS EC2 instance to retrieve database credentials from GCP Secret Manager without creating or downloading service account keys. Sequence the steps required to establish Workload Identity Federation and securely access the secret following Google Cloud security best practices.
- 1Create a Workload Identity Pool and an AWS Workload Identity Provider in Google Cloud IAM to establish trust with the AWS account.
- 2Grant the external AWS IAM role permission to impersonate a dedicated GCP service account by assigning the Workload Identity User role (`roles/iam.workloadIdentityUser`) on the service account.
- 3Grant the dedicated GCP service account the Secret Manager Secret Accessor role (`roles/secretmanager.secretAccessor`) on the required secret.
- 4Configure the application on the AWS EC2 instance to exchange its AWS credentials for a short-lived GCP access token using the Security Token Service (STS) API and fetch the secret.
Cevap
The correct order of steps is: 1) Create a Workload Identity Pool and AWS Provider in Google Cloud. 2) Grant the AWS IAM role permission to impersonate the GCP service account using the Workload Identity User role. 3) Grant the GCP service account the Secret Manager Secret Accessor role. 4) Exchange the AWS credentials for short-lived GCP tokens via the Security Token Service API to retrieve the secret.
Configuring Workload Identity Federation requires establishing trust with the external AWS provider first. Next, the external identity must be authorized to impersonate the designated GCP service account using the `roles/iam.workloadIdentityUser` role. Then, the GCP service account must be granted the specific secret access permission (`roles/secretmanager.secretAccessor`). Finally, the external application uses STS to exchange its native AWS security token for short-lived GCP credentials to fetch the secret payload.
Adım Adım Çözüm
Anahtar Kavram
Workload Identity Federation for external workloads accessing GCP Secret Manager