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. Configuration and credential files are detected by both the AWS SDKs and the AWS CLI for AWS API calls.
All CloudBees action repositories are listed at CloudBees, Inc. on GitHub. |
Inputs
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. |
Usage examples
Two methods for fetching credentials from AWS are supported: AssumeRole and authenticate as user.
AssumeRole with static IAM credentials in secrets
- 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
Authenticate as a user with static IAM credentials in secrets
- 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
AssumeRole using previous credentials
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.
Inline session policy
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:
Managed session policies
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