You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/aws.md
+98Lines changed: 98 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,6 +28,19 @@ aws iam create-open-id-connect-provider \
28
28
> **Note:** A `--thumbprint-list` parameter is no longer required. AWS validates GitHub's OIDC tokens directly without certificate pinning. See [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials) for details.
29
29
30
30
**Step 2: Create the trust policy file** (`cleancloud-trust-policy.json`)
31
+
32
+
Choose the subject format that matches how your GitHub Actions workflow runs:
> ⚠️ **Common mistake:** If your workflow uses `environment: production`, GitHub sends the `environment` subject claim — not the `ref` one. Using the wrong format causes `AccessDenied` when assuming the role. See [OIDC subject mismatch](#oidc-subject-claim-mismatch) in Troubleshooting.
41
+
42
+
**For branch-based workflows:**
43
+
31
44
```json
32
45
{
33
46
"Version": "2012-10-17",
@@ -47,6 +60,29 @@ aws iam create-open-id-connect-provider \
> 💡 **Tip:** To allow multiple triggers (branch push and GitHub Environment), list both subject values in the same `StringEquals` condition — see [OIDC subject mismatch](#oidc-subject-claim-mismatch) in Troubleshooting.
85
+
50
86
Replace:
51
87
-`<ACCOUNT_ID>` — Your AWS account ID
52
88
-`<YOUR_ORG>/<YOUR_REPO>` — Your GitHub organization and repository
**Symptom:**`Error assuming role` or `AccessDenied` during the AWS credentials step, even though the IAM role and OIDC provider exist.
418
+
419
+
**Cause:** The subject claim in your IAM role trust policy does not match what GitHub actually sends in the JWT token. GitHub generates different subject claims depending on how your workflow is triggered.
> 💡 GitHub Environments are the recommended approach for production pipelines — they add deployment protection rules, required reviewers, and environment-scoped secrets on top of OIDC.
0 commit comments