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