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
Copy file name to clipboardExpand all lines: UPGRADING.md
+297-3Lines changed: 297 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -110,14 +110,13 @@ might not have the same name either.
110
110
-**v2**: The Agent object to perform HTTP requests with. Used for connection pooling.
111
111
-**v3**: You can configure `httpAgent` or `httpsAgent` as shown in the examples above.
112
112
113
-
-`connectionTimeout`
113
+
-`connectTimeout`
114
114
-**v2**: Sets the socket to timeout after failing to establish a connection with the server after connectTimeout
115
115
milliseconds.
116
116
-**v3**: `connectionTimeout` is available [in `NodeHttpHandler` options](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/classes/_aws_sdk_node_http_handler.nodehttphandler-1.html).
117
117
-`timeout`
118
118
-**v2**: The number of milliseconds a request can take before automatically being terminated.
119
-
-**v3**: Hard request timeout is not available in `NodeHttpHandler`, but available as `requestTimeout`[in
120
-
`FetchHttphandler` in browsers](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/classes/_aws_sdk_fetch_http_handler.fetchhttphandler-1.html)
119
+
-**v3**: `socketTimeout` is available [in `NodeHttpHandler` options](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/classes/_aws_sdk_node_http_handler.nodehttphandler-1.html).
121
120
-`xhrAsync`
122
121
-**v2**: Whether the SDK will send asynchronous HTTP requests.
123
122
-**v3**: **Deprecated**. Requests are _always_ asynchronous.
@@ -179,6 +178,277 @@ might not have the same name either.
179
178
-**v2**: Whether to use the Accelerate endpoint with the S3 service.
180
179
-**v3**: No change.
181
180
181
+
## Credential Providers
182
+
183
+
In v2, the SDK provides a list of credential providers to choose from, as well as a credentials provider chain,
184
+
available by default on Node.js, that tries to load the AWS credentials from all the most common providers. V3 simplifies
185
+
the credential provider's interface, making it easier to use and write custom credential providers. On top of a new
186
+
credentials provider chain, V3 all provides a list of credential providers aiming to provide equivalent to v2.
187
+
188
+
Here is all the credential providers in v2 and their equivalents in v3.
189
+
190
+
### Default Credential Provider
191
+
192
+
Default credential provider is how SDK resolve the AWS credential if you DO NOT provide one explicitly.
The credential sources and fallback order _does not_ change in v3. It also supports [AWS Single Sign-On credentials](https://aws.amazon.com/single-sign-on/).
Represents temporary credentials retrieved from `AWS.STS`. Without any extra parameters, credentials will be
216
+
fetched from the `AWS.STS.getSessionToken()` operation. If an IAM role is provided, the `AWS.STS.assumeRole()` operation
217
+
will be used to fetch credentials for the role instead.
218
+
`AWS.ChainableTemporaryCredentials` differs from `AWS.TemporaryCredentials` in the way masterCredentials and refreshes
219
+
are handled. `AWS.ChainableTemporaryCredentials` refreshes expired credentials using the masterCredentials passed by
220
+
the user to support chaining of STS credentials. However, `AWS.TemporaryCredentials` recursively collapses the
221
+
masterCredentials during instantiation, precluding the ability to refresh credentials which require intermediate, temporary credentials.
222
+
223
+
The original [`TemporaryCredentials`](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/TemporaryCredentials.html)
224
+
has been **deprecated** in favor of `ChainableTemporaryCredentials` in v2 and ``
225
+
226
+
-**v3**: Partially supported. You can retrieve the temporary credential from STS with the
227
+
[role assumer function based on `sts:AssumeRole`](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-sts/globals.html#getdefaultroleassumer). The difference to v2 is that `sts:getSessionToken` is not called
228
+
if no `RoleArn` is supplied. Please open a [feature request](https://github.com/aws/aws-sdk-js-v3/issues/new?assignees=&labels=feature-request&template=---feature-request.md&title=)
The [`@aws/credential-provider-cognito-identity` package](https://www.npmjs.com/package/@aws-sdk/credential-provider-cognito-identity)
262
+
provides two credential provider functions, one of which [`fromCognitoIdentity`](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_credential_provider_cognito_identity.html#fromcognitoidentity-1)
263
+
takes an identity ID and calls `cognitoIdentity:GetCredentialsForIdentity`, while the other
takes an identity pool ID, calls `cognitoIdentity:GetId` on the first invocation, and then calls`fromCognitoIdentity`.
266
+
Subsequent invocations of the latter do not re-invoke GetId
267
+
268
+
The provider implements the "Simplified Flow" described in the [Cognito developer guide](https://docs.aws.amazon.com/cognito/latest/developerguide/authentication-flow.html).
269
+
The "Classic Flow" which involves calling `cognito:GetOpenIdToken` and then calling `sts:AssumeRoleWithWebIdentity` is
270
+
NOT supported. Please open a [feature request](https://github.com/aws/aws-sdk-js-v3/issues/new?assignees=&labels=feature-request&template=---feature-request.md&title=)
-**v3**: [`fromInstanceMetadata`](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_credential_provider_imds.html#frominstancemetadata-1): Creates a credential provider that will source credentials from the EC2 Instance Metadata Service.
Represents credentials received from specified URL. This provider will request temporary credentials from
344
+
URI specified by the `AWS_CONTAINER_CREDENTIALS_RELATIVE_URI` or the `AWS_CONTAINER_CREDENTIALS_FULL_URI` environment
345
+
variable.
346
+
347
+
-**v2**: `ECSCredentials` or [`RemoteCredentials`](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/RemoteCredentials.html).
348
+
-**v3**: [`fromContainerMetadata`](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_credential_provider_imds.html#fromcontainermetadata-1) creates a credential provider that will source credentials from the ECS Container Metadata Service.
-**v3**: **Not available**. Please open a [feature request](https://github.com/aws/aws-sdk-js-v3/issues/new?assignees=&labels=feature-request&template=---feature-request.md&title=)
375
+
to us if you need it.
376
+
377
+
### Shared Credential File Credentials
378
+
379
+
Loads credentials from shared credentials file (defaulting to `~/.aws/credentials` or defined by the
380
+
`AWS_SHARED_CREDENTIALS_FILE` environment variable). This file is supported across different AWS SDKs and tools. You can
381
+
refer to the [shared config and credentials files document](https://docs.aws.amazon.com/sdkref/latest/guide/creds-config-files.html)
roleAssumer:getDefaultRoleAssumer(), // Optional. Required if you specify role to assume
403
+
roleAssumerWithWebIdentity:getDefaultRoleAssumerWithWebIdentity(), // Optional. Required if you specify role to assume using `sts:AssumeRoleWithWebIdentity` API
404
+
}),
405
+
});
406
+
```
407
+
408
+
### Web Identity Credentials
409
+
410
+
Retrieves credentials using OIDC token from a file on disk. It's commonly used in EKS.
roleArn:"arn:xxxx"// Otherwise read from `AWS_ROLE_ARN` environmental variable
447
+
roleSessionName:"session:a"// Otherwise read from `AWS_ROLE_SESSION_NAME` environmental variable
448
+
})
449
+
});
450
+
```
451
+
182
452
## S3 Multipart Upload
183
453
184
454
In v2, the S3 client contains an [`upload()`](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#upload-property)
@@ -231,3 +501,27 @@ await ddbDocClient.send(
231
501
```
232
502
233
503
More examples and configurations are available in the [package README](https://github.com/aws/aws-sdk-js-v3/blob/main/lib/lib-dynamodb/README.md).
504
+
505
+
## Waiters
506
+
507
+
In v2, all waiters are bound to the service client class, you need to specify in waiter's input which designed state the
508
+
client will be waiting for. For example, you need to [call `waitFor("bucketExists")`](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#bucketExists-waiter)
509
+
to wait for a newly created bucket to be ready.
510
+
511
+
In v3, you don't need to import waiters if your application doesn't need one. Moreover, you can import only the waiter
512
+
you need to wait for the particular desired state you want. Thus, you can reduce your bundle size and improve
513
+
performance. Here's the example of waiting for bucket to be ready after creation:
You can find everything of how to configure the waiters in the [blog post of waiters in v3 SDK](https://aws.amazon.com/blogs/developer/waiters-in-modular-aws-sdk-for-javascript/).
0 commit comments