rxjs-aws-bindings
TypeScript icon, indicating that this package has built-in type declarations

0.1.5 • Public • Published

RxJS-AWS-Bindings

RxJS bindings for the AWS JavaScript SDK

Installing

npm i --save rxjs-aws-bindings

Importing into your project

JavaScript

const RxAWS = require('rxjs-aws-bindings');

TypeScript

import * as RxAWS from 'rxjs-aws-bindings';

Example

Submit an AWS Batch job, using config obtained from an S3 bucket.

import * as RxAWS from 'rxjs-aws-bindings';

const S3 = new RxAWS.S3({
  region: 'eu-west-2'
});

const Batch = new RxAWS.Batch({
  maxRetries: 1
});

const getObjectParams = {
  Bucket: process.env.MY_CONFIG_BUCKET,
  Key: process.env.MY_CONFIG_FILENAME
};

S3.getObject(getObjectParams).pipe(
  flatMap((s3GetObjectResponse) => {

    const config = JSON.parse(s3GetObjectResponse.Body.toString('utf8'));

    return Batch.submitJob({
      jobDefinition: config.JOB_DEFINITION,
      jobName: config.JOB_NAME,
      jobQueue: config.JOB_QUEUE
    });
  })
)
.subscribe({
  error: (err) => console.error('Somethings gone wrong!!!:', err),
  complete: () => console.log('Successfully submitted batch job!!!')
});

License

This project is licensed under the MIT License - see the LICENSE file for details

Dependents (0)

Package Sidebar

Install

npm i rxjs-aws-bindings

Weekly Downloads

1

Version

0.1.5

License

MIT

Unpacked Size

56.1 kB

Total Files

40

Last publish

Collaborators

  • lemmingworks