npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@aws/workbench-core-datasets

v1.0.0

Published

Access and management of data files for the purpose of connecting to various AWS environments.

Downloads

9

Readme

Workbench Core Datasets

main branch coverage

codecov

develop branch coverage

codecov

Description

The DataSet Service provides configuration and tracking for sharing data among researchers. The reference implementation given assumes data is stored under prefixes in S3 buckets. S3 Buckets are shared with others by adding an access point and sufficient permissions for a provided IAM role to access the files.

Usage

At minimum, DataSets requires

  • an AWS account
  • a DynamoDb table within that account using
    • partition key named "pk"
    • a sort key named "sk"
    • a GSI: "getResourceByCreatedAt"
      • partition key: resource type
      • sort key: createdAt
  • an S3 bucket to hold your DataSet prefixes

Initializaton

import { AuditService, BaseAuditPlugin, Writer } from '@aws/workbench-core-audit';

// the AwsService is a wrapper around @aws-sdk and handles interaction with AWS Services.
import { AwsService } from '@aws/workbench-core-base';

// the DataSets components
import {
    DataSetService,
    DdbDataSetMetadataPlugin,
    S3DataSetStoragePlugin,
    DataSet,
    ExternaEndpoint } from '@aws/workbench-core-datasets';
import { LoggingService } from '@aws/workbench-core-logging';

// set up the logger and the audit services.
const logger: LoggingService = new LoggingService({
  maxLogLevel: 'info',
  includeLocation: false,
  metadata: {
    serviceName: 'DataSets'
  }
});

class AuditLogger implements Writer {  
    private logger:Logger;  
    public constructor(logger: Logger) {  
        this.logger = logger;  
    }  
    public async write(metadata:Metadata, auditEntry: AuditEntry): Promise<void> {  
    logger.info(auditEntry);  
    }  
}

const writer: Writer = new AuditLogger(logger);  
const baseAuditPlugin: BaseAuditPlugin = new BaseAuditPlugin(writer);

const audit = new AuditService({
  continueOnError: true,
  auditPlugin: baseAuditPlugin,
  requiredAuditValues: [],
  fieldsToMask: []
});

// initialize an instance of AwsService. This instance should have access to the DynamoDb
// table you intend to use to store DataSets metadata.
// for simplicity, it will be assumed this service also has access to the S3 bucket where
// DataSets data is stored however a different AwsService instance initialized to a different
// account could be used in that case.
const aws: AwsService = new AwsService( {region: 'us-east-1', DdbTableName: 'my-datasets-table' });

// the DdbDataSetMetadataPlugin will allow the DataSetService to communicate with DynamoDb.
// alternative databases may be chosen by implementing the DataSetMetadataPlugin interface
// for that service however that is beyond the scope of this documentation.
// the arguments are as follows:
// aws: this is the initialized AwsService instance from above.
// 'DS': this is the prefix used to distinguish DataSet keys from others in the database.
//       In this case, all DataSet keys will have the form: DS#...
// 'EP': DataSet Endpoints are another entity stored in DynamoDb, and this is the prefix
//       for those keys (EP#...).
// Alter these values as needed to avoid collisions with any other components which may
// share the same table.
const metadataPlugin: DdbDataSetMetadataPlugin = new DdbDataSetMetadataPlugin(aws, 'DS', 'EP');

// instantiate the service.
const service: DataSetService = new DataSetService(audit, logger, metadataPlugin);

// set up a storage (S3) plugin. This example assumes the same role associated with the previously
// initialized AwsService instance can handle the S3 bucket used for DataSets.
const storagePlugin: S3DataSetStoragePlugin = new S3DataSetStoragePlugin(aws);

Creating a DataSet

// create a prefix on the bucket for the first DataSet
const dataSet = await service.provisionDataSet(
  'my-dataset',
  'my-bucket',
  'my-dataset-prefix',
  '123456789012',
  storagePlugin);

// add an endpoint to the dataset and get the string needed to mount it to an
// external environment.
const mountString = await service.addDataSetExternalEndpoint(
  'my-data-set'
  'my-access-point',
  'arn:....:role/some-execution-role',
  storagePlugin);