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
- name: Copy files to the production website with the AWS CLI
@@ -72,19 +68,39 @@ See [action.yml](action.yml) for the full documentation for this action's inputs
72
68
## Credentials
73
69
74
70
We recommend following [Amazon IAM best practices](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html) for the AWS credentials used in GitHub Actions workflows, including:
75
-
* Do not store credentials in your repository's code. You may use [GitHub Actions secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets) to store credentials and redact credentials from GitHub Actions workflow logs.
76
-
* [Create an individual IAM user](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#create-iam-users) with an access key for use in GitHub Actions workflows, preferably one per repository. Do not use the AWS account root user access key.
71
+
* Do not store credentials in your repository's code.
77
72
* [Grant least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege) to the credentials used in GitHub Actions workflows. Grant only the permissions required to perform the actions in your GitHub Actions workflows.
78
-
* [Rotate the credentials](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#rotate-credentials) used in GitHub Actions workflows regularly.
79
73
* [Monitor the activity](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#keep-a-log) of the credentials used in GitHub Actions workflows.
80
74
81
75
## Assuming a Role
82
-
If you would like to use the static credentials you provide to this action to assume a role, you can do so by specifying the role ARN in `role-to-assume`.
83
-
The role credentials will then be configured in the Actions environment instead of the static credentials you have provided.
84
-
The default session duration is 6 hours, but if you would like to adjust this you can pass a duration to `role-duration-seconds`.
76
+
We recommend using GitHub's OIDC provider to get short-lived credentials needed for your actions.
77
+
Specifying `role-to-assume` without providing an `aws-access-key-id` or a `web-identity-token-file` will signal to the action that you wish to use the OIDC provider.
78
+
The default session duration is 1 hour when using the OIDC provider to directly assume an IAM Role.
79
+
The default session duration is 6 hours when using an IAM User to assume an IAM Role (by providing an `aws-access-key-id`, `aws-secret-access-key`, and a `role-to-assume`) .
80
+
If you would like to adjust this you can pass a duration to `role-duration-seconds`, but the duration cannot exceed the maximum that was defined when the IAM Role was created.
85
81
The default session name is GitHubActions, and you can modify it by specifying the desired name in `role-session-name`.
86
82
87
-
Example:
83
+
The following table describes which identity is used based on which values are supplied to the Action:
In this example, the Action will load the OIDC token from the GitHub-provided environment variable and use it to assume the role `arn:aws:iam::123456789100:role/my-github-actions-role` with the session name `MySessionName`.
103
+
88
104
```yaml
89
105
- name: Configure AWS Credentials
90
106
uses: aws-actions/configure-aws-credentials@v1
@@ -99,48 +115,52 @@ Example:
99
115
```
100
116
In this example, the secret `AWS_ROLE_TO_ASSUME` contains a string like `arn:aws:iam::123456789100:role/my-github-actions-role`. To assume a role in the same account as the static credentials, you can simply specify the role name, like `role-to-assume: my-github-actions-role`.
101
117
102
-
### Permissions for assuming a role
103
-
104
-
In order to assume a role, the IAM user for the static credentials must have the following permissions:
The GitHub OIDC Provider only needs to be created once per account (i.e. multiple IAM Roles that can be assumed by the GitHub's OIDC can share a single OIDC Provider)
144
164
145
165
### Session tagging
146
166
The session will have the name "GitHubActions" and be tagged with the following tags:
@@ -158,7 +178,10 @@ The session will have the name "GitHubActions" and be tagged with the following
158
178
159
179
_Note: all tag values must conform to [the requirements](https://docs.aws.amazon.com/STS/latest/APIReference/API_Tag.html). Particularly, `GITHUB_WORKFLOW` will be truncated if it's too long. If `GITHUB_ACTOR` or `GITHUB_WORKFLOW` contain invalid characters, the characters will be replaced with an '*'._
160
180
161
-
The action will use session tagging by default during role assumption. You can skip this session tagging by providing `role-skip-session-tagging` as true in the action's inputs:
181
+
The action will use session tagging by default during role assumption.
182
+
Note that for WebIdentity role assumption, the session tags have to be included in the encoded WebIdentity token.
183
+
This means that Tags can only be supplied by the OIDC provider and not set during the AssumeRoleWithWebIdentity API call within the Action.
184
+
You can skip this session tagging by providing `role-skip-session-tagging` as true in the action's inputs:
162
185
163
186
```yaml
164
187
uses: aws-actions/configure-aws-credentials@v1
@@ -189,7 +212,8 @@ with:
189
212
```
190
213
In this case, your runner's credentials must have permissions to assume the role.
191
214
192
-
You can also assume a role using a web identity token file, such as if using [Amazon EKS IRSA](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts-technical-overview.html). Pods running in EKS worker nodes that do not run as root can use this file to assume a role with a web identity.
215
+
You can also assume a role using a web identity token file, such as if using [Amazon EKS IRSA](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts-technical-overview.html).
216
+
Pods running in EKS worker nodes that do not run as root can use this file to assume a role with a web identity.
193
217
194
218
You can configure your workflow as follows in order to use this file:
0 commit comments