Ockam Node for Amazon Timestream InfluxDB

Create an Ockam Timestream InfluxDB outlet node using Cloudformation template

This guide contains instructions to launch within AWS environment, an

  • An Ockam Timestream InfluxDB Outlet Node within an AWS environment

  • An Ockam Timestream InfluxDB Inlet Node:

    • Within an AWS environment, or

    • Using Docker in any environment

The walkthrough demonstrates:

  • Running an Ockam Timestream InfluxDB Outlet node in your AWS environment that contains a private Amazon Timestream InfluxDB Database

  • Setting up Ockam Timestream InfluxDB inlet nodes using either AWS or Docker from any location.

  • Verifying secure communication between InfluxDB clients and Amazon Timestream InfluxDB Database.

Read: “How does Ockam work?” to learn about end-to-end trust establishment.

PreRequisite

  • A private Amazon Timestream InfluxDB Database is created and accessible from the VPC and Subnet where the Ockam Node will be launched. You have the details of Organization, Username and Password

  • Security Group associated with the Amazon Timestream InfluxDBDatabase allows inbound traffic on the required port (TCP 8086) from the subnet where the Ockam Outlet Node will reside.

  • You have permission to subscribe and launch Cloudformation stack from AWS Marketplace on the AWS Account running Timestream InfluxDB Database.

  • Permission to create an "All Access" InfluxDB token to use by Ockam Node and store it in AWS Secrets Manager.

Create an Orchestrator Project

  1. Sign up for Ockam and pick a subscription plan through the guided workflow on Ockam.io.

  2. Run the following commands to install Ockam Command and enroll with the Ockam Orchestrator.

Completing this step creates a Project in Ockam Orchestrator

  1. Control which identities are allowed to enroll themselves into your project by issuing unique one-time use enrollment tickets. Generate two enrollment tickets, one for the Outlet and one for the Inlet.

Create an All Access InfluxDB Token and obtain Org ID

  • Use Influx CLI to create a token. For instructions, please see: Install and use the influx CLI.

  • Configure your CLI to use --username-password to be able to create the operator:

  • Find out Org ID to use as an input to cloudformation template

  • Create your new token.

  • Create influxDB token as secret within secret manager. Note the ARN of the secret.

Setup Ockam Timestream InfluxDB Outlet Node

  • Login to AWS Account you would like to use

  • Subscribe to "Ockam - Node for Amazon Timestream InfluxDB" in AWS Marketplace

  • Navigate to AWS Marketplace -> Manage subscriptions. Select Ockam - Node for Amazon Timestream InfluxDB from the list of subscriptions. Select Actions-> Launch Cloudformation stack

  • Select the Region you want to deploy and click Continue to Launch. Under Actions, select Launch Cloudformation

  • Create stack with the following details

    • Stack name: influxdb-ockam-outlet or any name you prefer

    • Network Configuration

      • VPC ID: Choose a VPC ID where the EC2 instance will be deployed.

      • Subnet ID: Select a suitable Subnet ID within the chosen VPC that has access to Amazon Timestream InfluxDB Database.

      • EC2 Instance Type: Default instance type is m6a.large Adjust instance type depending on your use case. If you would like to have predictable network bandwidth of 12.5 Gbps use m6a.8xlarge. Make sure the instance type is available in the subnet you are launching in.

    • Ockam Node Configuration

      • Enrollment ticket: Copy and paste the content of the outlet.ticket generated above

      • InfluxDBEndpoint: To configure the Ockam Timestream InfluxDB Outlet Node, you'll need to specify the Amazon Timestream InfluxDB Endpoint. This configuration allows the Ockam Postgres Outlet Node to connect to the database. In AWS Console, go to Timestream -> InfluxDB databases, select your influxdb database and copy "Endpoint" details

      • InfluxDBOrgID: Enter the Organization of InfluxDB instance.

      • InfluxDBTokenSecretArn: Enter the ARN of the Secret that contains the all access token.

      • InfluxDBLeasedTokenPermissions: JSON array of permission objects for InfluxDB leased token in the below format. Update as needed. Leave the variable INFLUX_ORG_ID as it will be replaced during runtime.

  • NodeConfig: Copy and paste the below configuration. Note that the configuration values match with the enrollment tickets created in the previous step. INFLUX_ENDPOINT, INFLUX_ORG_ID and INFLUX_TOKEN will be replaced during runtime.

  • Click Next to launch the CloudFormation run.

  • A successful CloudFormation stack run configures the Ockam Timestream InfluxDB Outlet node on an EC2 machine.

    • EC2 machine mounts an EFS volume created in the same subnet. Ockam state is stored in the EFS volume.

    • A security group with egress access to the internet will be attached to the EC2 machine.

  • Connect to the EC2 machine via AWS Session Manager.

    • To view the log file, run sudo cat /var/log/cloud-init-output.log.

      • Successful run will show Ockam node setup completed successfully in the logs

    • To view the status of Ockam node run curl http://localhost:23345/show | jq

  • View the Ockam node status in CloudWatch.

    • Navigate to Cloudwatch -> Log Group and select influxdb-ockam-outlet-status-logs. Select the Logstream for the EC2 instance.

    • The Cloudformation template creates a subscription filter that sends data to a Cloudwatch alarm influxdb-ockam-outlet-OckamNodeDownAlarm.Alarm will turn green upon ockam node successfully running.

  • An Autoscaling group ensures atleast one EC2 instance is running at all times.

Ockam Timestream InfluxDB outlet node setup is complete. You can now create Ockam Timestream InfluxDB inlet nodes in any network to establish secure communication.

Setup Ockam InfluxDB Inlet Node

You can set up an Ockam Timestream InfluxDB Inlet Node either in AWS or locally using Docker. Here are both options:

Option 1: Setup Inlet Node Locally with Docker Compose

To set up an Inlet Node locally and interact with it outside of AWS, use Docker Compose.

  • Find your Ockam project id by running the command where you created the enrollment tickets and use it to create to endpoint to use for REPLACE_WITH_YOUR_PROJECT_ID

  • Create a file named docker-compose.yml with the following content:

docker-compose.yml
  • Create a file named app.mjs and package.json.

    • Update REPLACE_WITH_* variables

    • Value of token doesn't matter as it will be injected with the temporary token by Ockam

app.mjs
package.json
  • Run the following command from the same location as the docker-compose.yml and the inlet.ticket to create an Ockam Timestream InfluxDB inlet that can connect to the outlet running in AWS , along with node client container

  • Check status of Ockam inlet node. You will see The node is UP when ockam is configured successfully and ready to accept connection

  • Connect to influxdb-client container and run commands

Option 2: Setup Inlet Node in AWS

  • Login to AWS Account you would like to use

  • Subscribe to "Ockam - Node" in AWS Marketplace

  • Navigate to AWS Marketplace -> Manage subscriptions. Select Ockam - Node from the list of subscriptions. Select Actions-> Launch Cloudformation stack

  • Select the Region you want to deploy and click Continue to Launch. Under Actions, select Launch Cloudformation

  • Create stack with below details

    • Stack name: influxdb-ockam-inlet or any name you prefer

    • Network Configuration

      • Select suitable values for VPC ID and Subnet ID

      • EC2 Instance Type: Default instance type is m6a.8xlarge because of the predictable network bandwidth of 12.5 Gbps. Adjust to a small instance type depending on your use case. Eg: m6a.large

    • Ockam Configuration

      • Enrollment ticket: Copy and paste the content of the inlet.ticket generated above

      • JSON Node Configuration: Copy and paste the below configuration.

  • Click Next to launch the CloudFormation run.

  • A successful CloudFormation stack run configures the Ockam inlet node on an EC2 machine.

  • EC2 machine mounts an EFS volume created in the same subnet. Ockam state is stored in the EFS volume.

  • Connect to the EC2 machine via AWS Session Manager.

    • To view the log file, run sudo cat /var/log/cloud-init-output.log.

      • Successful run will show Ockam node setup completed successfully in the logs

    • To view the status of Ockam node run curl http://localhost:23345/show | jq

  • View the Ockam node status in CloudWatch.

    • Navigate to Cloudwatch -> Log Group and select influxdb-ockam-inlet-status-logs. Select the Logstream for the EC2 instance.

    • Cloudformation template creates a subscription filter that sends data to a Cloudwatch alarm influxdb-ockam-inlet-OckamNodeDownAlarm.Alarm will turn green upon ockam node successfully running.

  • An Autoscaling group ensures atleast one EC2 instance is running at all times.

  • Find your Ockam project id and use it to create to endpoint to use for INFLUXDB_ENDPOINT

  • Follow testing steps in docker example above for node.js or use InfluxDB cli client with below details

Last updated

Was this helpful?