|
1 | 1 | An upcoming release of the **AWS SDK for Kotlin** will change the order of |
2 | 2 | credentials resolution for the [default credentials provider chain](https://docs.aws.amazon.com/sdk-for-kotlin/latest/developer-guide/credential-providers.html#default-credential-provider-chain) |
3 | | -and the order of credentials resolution for the AWS shared config files. |
| 3 | +and the order of credentials resolution for AWS shared config files. |
4 | 4 |
|
5 | 5 | # Release date |
6 | 6 |
|
7 | | -This feature will ship with the **v1.4.x** release on xx/xx/xxxx. |
| 7 | +This change will be included in the upcoming **v1.4.x** release, expected in the |
| 8 | +upcoming months. |
8 | 9 |
|
9 | 10 | # What's changing |
10 | 11 |
|
11 | | -The SDK will be changing the order in which credentials are resolved when |
12 | | -using the default credentials provider chain. The new order will be: |
| 12 | +The order of credentials resolution for the default credentials provider chain, |
| 13 | +and the order of credentials resolution for AWS shared config files (profile chain). |
13 | 14 |
|
14 | | -1. System properties |
15 | | -2. Environment variables |
16 | | -3. Assume role with web identity token |
17 | | -4. Shared credentials and config files (profile) |
18 | | -5. Amazon ECS container credentials |
19 | | -6. Amazon EC2 Instance Metadata Service |
| 15 | +## Default credentials provider chain |
| 16 | + |
| 17 | +The table below outlines the current and new order in which the SDK will |
| 18 | +resolve credentials from the default credentials provider chain. |
| 19 | + |
| 20 | +| # | Current Order | New Order | |
| 21 | +|---|------------------------------------------------------------------------|------------------------------------------------------------------------| |
| 22 | +| 1 | System properties | System properties | |
| 23 | +| 2 | Environment variables | Environment variables | |
| 24 | +| 3 | **Shared credentials and config files (profile credentials provider)** | **Assume role with web identity token** | |
| 25 | +| 4 | **Assume role with web identity token** | **Shared credentials and config files (profile credentials provider)** | |
| 26 | +| 5 | Amazon ECS container credentials | Amazon ECS container credentials | |
| 27 | +| 6 | Amazon EC2 Instance Metadata Service | Amazon EC2 Instance Metadata Service | |
20 | 28 |
|
21 | 29 | The [default credentials provider chain documentation](https://docs.aws.amazon.com/sdk-for-kotlin/latest/developer-guide/credential-providers.html#default-credential-provider-chain) |
22 | 30 | contains more details on each credential source. |
23 | 31 |
|
24 | | -The SDK will also be changing the order in which credentials are resolved from |
25 | | -in the shared credentials and config files. The new order will be: |
| 32 | +## Profile chain |
| 33 | + |
| 34 | +The table below outlines the current and new order in which the SDK will |
| 35 | +resolve credentials from AWS shared config files. |
26 | 36 |
|
27 | | -1. Static credentials |
28 | | -2. Assume role with source profile OR assume role with named provider (mutually exclusive) |
29 | | -3. Web identity token |
30 | | -4. SSO session |
31 | | -5. Legacy SSO |
32 | | -6. Process |
| 37 | +| # | Current Order | New Order | |
| 38 | +|---|----------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------| |
| 39 | +| 1 | **Assume role with source profile OR assume role with named provider (mutually exclusive)** | **Static credentials** | |
| 40 | +| 2 | Web identity token | **Assume role with source profile OR assume role with named provider (mutually exclusive)** | |
| 41 | +| 3 | SSO session | Web identity token | |
| 42 | +| 4 | Legacy SSO | SSO session | |
| 43 | +| 5 | Process | Legacy SSO | |
| 44 | +| 6 | **Static credentials (moves up to #1 when in a source profile, shifting other credential sources down)** | Process | |
33 | 45 |
|
34 | 46 | # How to migrate |
35 | 47 |
|
36 | 48 | 1. Upgrade all of your AWS SDK for Kotlin dependencies to **v.1.4.x**. |
37 | | -2. Verify that the changes to the default credentials provider chain and credentials files do not introduce any issues in your program. |
38 | | -3. If issues arise review the new credentials resolution order and adjust your configuration as needed. |
| 49 | +2. Verify that the changes to the default credentials provider chain and profile chain do not introduce any issues in your program. |
| 50 | +3. If issues arise review the new credentials resolution order, the subsections below, and adjust your configuration as needed. |
| 51 | + |
| 52 | +## Default credentials provider chain |
| 53 | + |
| 54 | +You can preserve the current default credentials provider chain behavior by setting |
| 55 | +the credentials provider to a credentials provider chain with the current order, e.g. |
| 56 | + |
| 57 | +```kotlin |
| 58 | +S3Client{ |
| 59 | + region = "..." |
| 60 | + credentialsProvider = CredentialsProviderChain( |
| 61 | + SystemPropertyCredentialsProvider(), |
| 62 | + EnvironmentCredentialsProvider(), |
| 63 | + StsWebIdentityProvider(), |
| 64 | + ProfileCredentialsProvider(), |
| 65 | + EcsCredentialsProvider(), |
| 66 | + ImdsCredentialsProvider(), |
| 67 | + ) |
| 68 | +} |
| 69 | +``` |
| 70 | + |
| 71 | +## Profile credentials provider |
| 72 | + |
| 73 | +The order in which credentials are resolved for shared credentials and config |
| 74 | +files cannot be customized. If your AWS config file(s) contain multiple valid |
| 75 | +credential sources within a single profile, you may need to update them to align |
| 76 | +with the new resolution order. For example, config file `A` should be updated to |
| 77 | +match config file `B`. This is necessary because static credentials will now |
| 78 | +take precedence and be selected before assume role credentials with a source profile. |
| 79 | +Similar adjustments to your configuration may be necessary to maintain current |
| 80 | +behavior. Use the new order as a guide for any required changes. |
| 81 | + |
| 82 | +Config file `A` |
| 83 | +```ini |
| 84 | +[default] |
| 85 | +role_arn = arn:aws:iam::123456789:role/Role |
| 86 | +source_profile = A |
| 87 | +aws_access_key_id = 0 |
| 88 | +aws_secret_access_key = 0 |
| 89 | + |
| 90 | +[profile A] |
| 91 | +aws_access_key_id = 1 |
| 92 | +aws_secret_access_key = 2 |
| 93 | +``` |
| 94 | + |
| 95 | +Config file `B` |
| 96 | +```ini |
| 97 | +[default] |
| 98 | +role_arn = arn:aws:iam::123456789:role/Role |
| 99 | +source_profile = A |
| 100 | + |
| 101 | +[profile A] |
| 102 | +aws_access_key_id = 1 |
| 103 | +aws_secret_access_key = 2 |
| 104 | +``` |
39 | 105 |
|
40 | 106 | # Feedback |
41 | 107 |
|
42 | 108 | If you have any questions concerning this change, please feel free to engage |
43 | | -with us in this discussion. If you encounter a bug with these changes, please |
44 | | -[file an issue](https://github.com/awslabs/aws-sdk-kotlin/issues/new/choose). |
| 109 | +with us in this discussion. If you encounter a bug with these changes when |
| 110 | +released, please [file an issue](https://github.com/awslabs/aws-sdk-kotlin/issues/new/choose). |
0 commit comments