Configure Amazon Web Services (AWS) Identity and Access Management (IAM) credentials, credential files, and a region for use in CloudBees workflows. This action implements the AWS SDK credential resolution chain and sets configuration and credential files for other CloudBees actions to use. Configuration and credential files are detected by both the AWS SDKs and the AWS CLI for AWS API calls.
Input name | Data type | Required? | Description |
---|---|---|---|
|
String |
Yes |
The AWS access key ID. |
|
String |
Yes |
The AWS secret key. |
|
String |
Yes |
The AWS region. |
|
String |
No |
The AWS role to assume. |
|
String |
No |
The AWS role external ID. |
|
String |
No |
The AWS role duration, in seconds. |
|
String |
No |
The AWS role session name. |
|
Boolean |
No |
Whether there is chaining of the AWS roles.
Default value is |
|
JSON |
No |
The AWS inline role session policy. |
|
String |
No |
The AWS managed role session policy. |
Two methods for fetching credentials from AWS are supported: AssumeRole and authenticate as user.
- name: Configure AWS credentials
uses: cloudbees-io/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-external-id: ${{ secrets.AWS_ROLE_EXTERNAL_ID }}
role-duration-seconds: 1200
role-session-name: MySessionName
- name: Configure AWS credentials
uses: cloudbees-io/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
This is effectively the same as the AssumeRole with static IAM credentials in secrets method above, but allows for more complex use cases that require switching roles.
- name: Configure AWS credentials
uses: cloudbees-io/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
# ...
- name: Configure other AWS credentials
uses: cloudbees-io/configure-aws-credentials@v1
with:
aws-region: us-east-2
role-to-assume: arn:aws:iam::987654321000:role/my-second-role
role-session-name: MySessionName
role-chaining: true
You can use an IAM policy in stringified JSON format as an inline session policy. Code the JSON as either a single line, or formatted.
Single-line JSON:
- name: Configure AWS credentials
uses: cloudbees-io/configure-aws-credentials@v1
with:
inline-session-policy: '{"Version":"2012-10-17","Statement":[{"Sid":"Stmt1","Effect":"Allow","Action":"s3:List*","Resource":"*"}]}'
Formatted JSON:
- name: Configure AWS credentials
uses: cloudbees-io/configure-aws-credentials@v1
with:
inline-session-policy: >-
{
"Version": "2012-10-17",
"Statement": [
{
"Sid":"Stmt1",
"Effect":"Allow",
"Action":"s3:List*",
"Resource":"*"
}
]
}
You can use Amazon Resource Names (ARNs) of the IAM managed policies as managed session policies. The policies must exist in the same account as the role.
Pass a single managed policy as:
- name: Configure AWS credentials
uses: cloudbees-io/configure-aws-credentials@v1
with:
managed-session-policies: arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess
Pass multiple managed policies as:
- name: Configure AWS credentials
uses: cloudbees-io/configure-aws-credentials@v1
with:
managed-session-policies: |
arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess
arn:aws:iam::aws:policy/AmazonS3OutpostsReadOnlyAccess
This code is made available under the MIT license.
-
Learn more about using actions in CloudBees workflows.
-
Learn about the CloudBees platform.