Registering certificate bundles in Node.js - Amazon SDK for JavaScript
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.

The Amazon SDK for JavaScript V3 API Reference Guide describes in detail all the API operations for the Amazon SDK for JavaScript version 3 (V3).

Starting October 1, 2022, Amazon SDK for JavaScript (v3) will end support for Internet Explorer 11 (IE 11). For details, see Announcing the end of support for Internet Explorer 11 in the Amazon SDK for JavaScript (v3).

Registering certificate bundles in Node.js

The default trust stores for Node.js include the certificates needed to access Amazon services. In some cases, it might be preferable to include only a specific set of certificates.

In this example, a specific certificate on disk is used to create an https.Agent that rejects connections unless the designated certificate is provided. The newly created https.Agent is then used by the DynamoDB client.

import fs from "fs"; import https from "https"; import { DynamoDBClient } from "@aws-sdk/client-dynamodb"; const certs = [ fs.readFileSync("/path/to/cert.pem") ]; const dynamodbClient = new DynamoDBClient({ httpOptions: { agent: new https.Agent({ rejectUnauthorized: true, ca: certs }) } });import { DynamoDBClient } from '@aws-sdk/client-dynamodb'; import { NodeHttpHandler } from '@aws-sdk/node-http-handler'; import { Agent } from 'https'; import { readFileSync } from 'fs'; const certs = [readFileSync("/path/to/cert.pem")]; const agent = new Agent({ rejectUnauthorized: true, ca: certs }); const dynamodbClient = new DynamoDBClient({ requestHandler: new NodeHttpHandler({ httpAgent: agent, httpsAgent: agent }) });