Skip to content

Commit

Permalink
Add a concrete example of a AWS IAM trust policy
Browse files Browse the repository at this point in the history
granting access to a particular job in a particular instance.
  • Loading branch information
Vlatombe committed Jul 5, 2024
1 parent c6c5928 commit 4d34955
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,29 @@ and a permissions policy granting specific abilities.
The audience should conventionally be `sts.amazonaws.com`.
AWS requires the TLS certificate fingerprint of the issuer to be saved.

Here is an example of such trust policy with account `1234567890` and Jenkins instance running on `https://jenkins.acme.com/`, restricting access to a job named `my-job`:

```json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Federated": "arn:aws:iam::1234567890:oidc-provider/jenkins.acme.com/oidc"
},
"Action": "sts:AssumeRoleWithWebIdentity",
"Condition": {
"StringEquals": {
"jenkins.acme.com/oidc:aud": "sts.amazonaws.com",
"jenkins.acme.com/oidc:sub": "https://jenkins.acme.com/job/my-job/"
}
}
}
]
}
```

If you set the environment variable `AWS_ROLE_ARN`
and bind `AWS_WEB_IDENTITY_TOKEN_FILE` to a temporary file containing an id token,
you can run `aws` CLI commands without further ado.
Expand Down

0 comments on commit 4d34955

Please sign in to comment.