Collection of different AWS service helpers
Helper | Build | Test | Code Coverage | NPM | Downloads |
---|---|---|---|---|---|
APIGatewayHelper | |||||
CloudWatchHelper | |||||
DynamoHelper | |||||
KMSHelper | |||||
LambdaHelper | |||||
S3Helper | |||||
SESHelper | |||||
SNSHelper | |||||
SQSHelper | |||||
SSMHelper | |||||
STSHelper |
npm install typescript-aws-helpers@latest
Example of a handler for a lambda:
Execute
:
const handler = new Handler(LogLevel.Information);
export async function lambdaHandler(event: S3Event,
context: Context,
callback: Callback) {
return await handler.Execute<S3Event>(event,
context,
callback,
async () => {
this.Logger.Information('Executed')
})
}
Examples of how to use orchestrators:
Orchestrate
:
const handler = new Handler(LogLevel.Information);
const response = await handler.Orchestrate<string>(async () => {
// do stuff
this.Logger.Information(`Stuff was done`);
return `Done`;
});
OrchestrateSQS
:
const handler = new Handler(LogLevel.Information);
const sqsEvent: SQSEvent = { Records: [{ body: 'body', receiptHandle: 'receipt-handle' }] };
const response = await handler.OrchestrateSQS(sqsEvent.Records,
'queue-url',
async () => {
// do stuff
this.Logger.Information(`Stuff was done`);
});
See the appropriate helper repo for documentation on how to use them from the links in Associated Helpers