@copper/plugin-timestream v1.0.1
plugin-timestream
Architect serverless framework plugin that defines AWS Timestream databases and tables
AWS Timestream is a time series database. This arc plugin allows you to define a Timestream database per arc application, and as many Timestream tables in this database as you want.
Installation
- Install this plugin: npm i @copper/plugin-timestream
- Add the following line to the - @pluginspragma in your Architect project manifest (usually- app.arc):- @plugins copper/plugin-timestream
Usage
Define as many tables as you want under a @timestream section, optionally
nesting Timestream retention options under each table:
@timestream
simple-table
custom-retention-table
  MagneticStoreRetentionPeriodInDays 90
  MemoryStoreRetentionPeriodInHours 72To access your defined tables at runtime from within your project's Lambda
functions, import the TimestreamWrite and TimestreamQuery
AWS SDK service objects. The methods available on these objects will require you
to provide the database and table name for your Timestream tables. The values
you should use for these are:
- Database name: the name of your arc application as defined at the top of your
  app.arcfile.
- Table name: the name of each table as defined under the @timestreamsection of yourapp.arcfile.
For an example, see the sample application's get-index code under
./sample-app/src/http/get-index/index.js.
Options
The following options can be passed, nested (indented) under each table name definition in
your app.arc file:
| Option | Description | Example | 
|---|---|---|
| MagneticStoreRetentionPeriodInDays | Specifies the retention properties for magnetic storage for the table in number of days. Default is 1 day. | MagneticStoreRetentionPeriodInDays 90 | 
| MemoryStoreRetentionPeriodInHours | Specifies the retention properties for memory storage for the table in number of hours. Default is 1 hour. | MemoryStoreRetentionPeriodInHours 72 | 
Sample Application
There is a sample application located under sample-app/. cd into that
directory, npm install and you can run locally via arc sandbox or deploy to
the internet via arc deploy.
Testing Locally
TODO: This plugin does not provide a local development experience at this time. Coming soon!
Testing the Deployed Version
The sample application (under ./sample-app) is ready deploy to arc deploy:
- cd sample-app
- npm install
- arc deploy
- Load the deployed URL.
- The main route of the application will both write a time series data point as
well as query for all data points and list them out in the HTTP response. For
details, check out the get-indexroute code under./sample-app/src/http/get-index.
Contributing
Thanks for considering contributing to this project! Check out the contribution guidelines for details.