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 (PDF).

The Amazon SDK for JavaScript version 3 (v3) is a rewrite of v2 with some great new features, including modular architecture. For more information, see the Amazon SDK for JavaScript v3 Developer Guide.

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 to update the SDK configuration.

var fs = require('fs'); var https = require('https'); var certs = [ fs.readFileSync('/path/to/cert.pem') ]; AWS.config.update({ httpOptions: { agent: new https.Agent({ rejectUnauthorized: true, ca: certs }) } });