Skip to content

kbrashears5/typescript-aws-s3-helper

Repository files navigation

typescript-aws-s3-helper

Typescript helper functions for AWS S3 service

CI/CD codecov NPM Version Downloads

Install

npm install typescript-aws-s3-helper@latest

Usage

Default - running in Lambda in your own account

const logger = new Logger(LogLevel.Trace);

const helper = new S3Helper(logger);

const response = await helper.CreateBucketAsync('name');

Running in separate account or not in Lambda

import * as S3 from '@aws-sdk/client-s3';

const logger = new Logger(LogLevel.Trace);

const options: S3.S3ClientConfig = {
  accessKeyId: '{access_key}',
  secretAccessKey: '{secret_key}',
  region: 'us-east-1',
};

const repository = new S3.S3(options);

const helper = new S3Helper(logger, repository);

const response = await helper.CreateBucketAsync('name');

Notes

If no options are supplied, will default to us-east-1 as the region

Development

Clone the latest and run

npm run prep

to install packages and prep the git hooks