3.4.1 • Published 8 months ago

@sparkpost/aws v3.4.1

Weekly downloads
550
License
-
Repository
github
Last release
8 months ago

Build Status

aws

Thin wrappers around the aws-sdk libraries we use.

Initialization

Rather than having to assemble all the necessary connection config in every file that needs aws services, this wrapper provides a simple way to set up the AWS credentials in one place, one time for the whole service. This also allows the service to remove this initialization step later in favor of ENV_VAR or instance profile auth management, if possible.

For example, in app.js:

'use strict';

const AWS = require('@sparkpost/aws');
// ... whatever else you need, besides the actual models etc. that use aws

/*
 * This needs to occur before the resources module tree is required
 * because the AWS module needs to be globally configured before any
 * usage / instantiation can occur.
 */
if (config.get('aws.enabled') && config.get('aws.enabled') === true) {
  AWS.initialize({
    accessKeyId: config.get('aws.accessKeyId'),
    secretAccessKey: passwords.maybeDecrypt(config.get('aws.secretAccessKey')),
    region: config.get('aws.region'),
    proxy: process.env.HTTPS_PROXY
  });
}

// the files that use aws are required *after* the setup (note: better auth strategies might avoid this order-dependencies in the future)
const resources = require('./resources');

AWS SDK Client

If you want access to the raw aws-sdk client you can use the SDK property.

const AWS = require('@sparkpost/aws');
const marketplaceMeteringService = new AWS.SDK.MarketplaceMetering({ apiVersion: '2016-01-14' });
marketplaceMeteringService.resolveCustomer({ RegistrationToken: token }, (err, data) => { ... });

Supported Services

3.4.1

8 months ago

3.4.0

2 years ago

3.3.2

2 years ago

3.3.1

3 years ago

3.3.1-0

3 years ago

3.3.0

3 years ago

3.2.0

3 years ago

3.1.0

3 years ago

3.0.0

3 years ago

2.8.0

4 years ago

2.7.1

4 years ago

2.7.0

4 years ago

2.5.0

4 years ago

2.3.0

4 years ago

2.2.2

5 years ago

2.2.1

5 years ago

2.2.0

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.19.1

5 years ago

1.19.0

5 years ago

1.18.0

5 years ago

1.17.0

5 years ago

1.16.0

5 years ago

1.15.0

6 years ago

1.14.0

6 years ago

1.13.0

6 years ago

1.12.0

6 years ago

1.11.2

6 years ago

1.11.1

6 years ago

1.11.0

6 years ago

1.10.0

6 years ago

1.9.1

6 years ago

1.9.0

6 years ago

1.8.2

6 years ago

1.8.1

6 years ago

1.8.0

6 years ago

1.7.2

6 years ago

1.7.1

6 years ago

1.7.0

6 years ago

1.6.0

6 years ago

1.5.0

7 years ago

1.4.0

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago