Accessing the table
  • 14 Jan 2022
  • 1 Minute to read
  • Contributors
  • Dark
    Light
  • PDF

Accessing the table

  • Dark
    Light
  • PDF

Article summary

The method of accessing your table depends on what type of Node is requesting access. This is broken down into two generic Node types; internal Nodes (Nodes that are in the EchoStream Cloud) and external Nodes (Nodes whose computational resources are outside of EchoStream Cloud).

Internal Node Access

There are certain Nodes within EchoStream that allow you to provide custom Python code to tailor their execution, such as Router Nodes and Transformer Nodes. For these Nodes, you provide a custom Python function with a specified signature. One of the parameters that EchoStream will pass to your function at runtime is a context. That context object contains a table property that, when accessed, returns a boto3.DynamoDB.Table resource for you to use.

External Node Access

To access your Tenant's table from outside of the EchoStream Cloud, you must follow the following procedures:

  1. All external Nodes belong to an App. Call the EchoStream API for your App's GetAwsCredentials field to obtain temporary AWS credentials to your Tenant's resources. This will return you an accessKeyId, expiration, secretAccessToken and sessionToken.

NOTE - these credentials are temporary and it is up to you to refresh them when they expire.

  1. Create an AWS Session in the AWS SDK for the language of your choice (e.g. - boto3.Session in Python) using the values returned from Step 1.
  2. Get your Tenant's table name by calling the EchoStream API to get your Tenant, accessing the table field.
  3. Create the DynamoDB table resource in the AWS SDK for your langugage using the value obtained in Step 3 and the Session created in Step 2 (e.g. - session.resource("dynamodb").Table(table) in Python).

Controlling external Node Access

Because External Nodes, by definition, are run by computational resources outside of the EchoStream Cloud, you may want to limit some of those Nodes from accessing your Tenant's table. For example, you may create an External App with and External Node for a vendor of yours, but you do not trust that vendor to access your Tenant's state table.

In this case, simply turn off access to the table in the External App, and all Nodes created in that App will be prevented from accessing your table.