@@ -3683,3 +3683,43 @@ Run an aggregate operation on `db.csfle` with the following pipeline:
36833683` ` `
36843684
36853685Expect an exception to be thrown with a message containing the substring ` Upgrade ` .
3686+
3687+ ### 26. Custom AWS Credentials
3688+
3689+ These tests require valid AWS credentials . Refer :
3690+ [Automatic AWS Credentials ](../ client - side - encryption .md #automatic - credentials ).
3691+
3692+ #### Case 1 : Explicit encryption with credentials and custom credential provider
3693+
3694+ Create a MongoClient named ` setupClient ` .
3695+
3696+ Create a [ClientEncryption ](../ client - side - encryption .md #clientencryption ) object with the following options :
3697+
3698+ ` ` ` typescript
3699+ class ClientEncryptionOpts {
3700+ keyVaultClient: <setupClient>,
3701+ keyVaultNamespace: "keyvault.datakeys",
3702+ kmsProviders: { "aws": { "accessKeyId": <set from environment>, "secretAccessKey": <set from environment> } },
3703+ credentialProviders: { "aws": <default provider from AWS SDK> }
3704+ }
3705+ ` ` `
3706+
3707+ Assert that an error is thrown .
3708+
3709+ #### Case 2 : Explicit encryption with custom credential provider
3710+
3711+ Create a MongoClient named ` setupClient ` .
3712+
3713+ Create a [ClientEncryption ](../ client - side - encryption .md #clientencryption ) object with the following options :
3714+
3715+ ` ` ` typescript
3716+ class ClientEncryptionOpts {
3717+ keyVaultClient: <setupClient>,
3718+ keyVaultNamespace: "keyvault.datakeys",
3719+ kmsProviders: { "aws": {} },
3720+ credentialProviders: { "aws": <default provider from AWS SDK> }
3721+ }
3722+ ` ` `
3723+
3724+ Use the client encryption to create a datakey using the " aws" KMS provider . This should successfully load and use
3725+ the AWS credentials that were defined in the environment .
0 commit comments