1.0.32 • Published 2 years ago

easy-aws-utils v1.0.32

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
2 years ago

AWS SSO SDK Wrapper

This is a library for calling AWS services dynamically across orgs, accounts and services.

It takes in an access provider which will handle refreshing SSO creds, fetching account access creds and managing the organsations you work with.

It has been designed to work in the ipcRenderer part of an electron app.

You should NEVER import any of the "brianfoody-*" libraries under src/. These are provided as devDeps to test the library by directly connecting the accessProvider.

In an electron app this will be divided through message passing in preload.js so as not to expose the file system.

Helper libraries

It also provides helper libraries for things like listing all items in an S3 bucket as a tree, listening to a dynamo tables updates etc...

AWS Client

You can create an AWS client easily. All you need to pass in is a service for local storage.

This makes it easy to use between web, mobile and your local desktop.

const { aws, s3Client } = await createAWSClient();

AWS Wrapper

The aws variable returned can be used to move between accounts and roles dynamically.

For example, here we can scan a Dynamo table in one account and insert into another.

const item = await aws.account("Account1").role("DevAccess").dynamo.getItem({
  TableName: "table-name",
  Key: {
    id: { S: "id" }
  }
})

await aws.account("Account2").role("DevAccess").dynamo.putItem({
  TableName: "table-name",
  Item: item
})

S3 Helper

The SDK has been augmented to make interacting with S3 easy.

const buckets = await aws.s3Helper.listBuckets()

const objectsUnderFolder = await aws
  .account("Account1")
  .role("Role")
  .s3Helper
  .listObjects({
    Bucket: bucket,
    Prefix: "/folder1/folder2"
  })

const details = await await aws
  .account("Account1")
  .role("Role")
  .s3Helper.getObjectDetails({
    Bucket: bucket,
    Key: "folder1/folder2/file.txt"
  })

const download = await await aws
  .account("Account1")
  .role("Role")
  .s3Helper.download({
    Bucket: bucket,
    Key: "folder1/folder2/file.txt",
  })
1.0.32

2 years ago

1.0.31

2 years ago

1.0.30

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.26

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.29

2 years ago

1.0.28

2 years ago

1.0.27

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago