Usage instructions

Pre-Stack Configuration

Before running the CloudFormation stack, please ensure that you have completed the following steps:
  1. Domain Registration: Register a domain either with a third-party registrar or using AWS. For detailed instructions, refer to the official documentation.
  1. Create a Public Hosted Zone in Route53: Create a public hosted zone in Route53 with a name such as datrics.<your domain name>. Follow the instructions provided in the official documentation.
  1. Create an SSH Key Pair: Generate a PEM key pair for SSH access to the instance, if necessary.
  1. Define VPC CIDR Block: Decide on a VPC CIDR block that does not conflict with other blocks, especially in case of VPC peering.
  1. Prepare Email and Password: Have an email and password ready. They will be used for signing in once the stack is created. As well as the full name to be used in the service.
  1. Customize Stack Parameters: Consider modifying default parameters of the stack, such as SnapshotRetentionCount (number of EBS volume snapshots to retain),InstanceType (CPU and memory specifications) and EBSVolumeSize(you can increase the volume if there is a lot of data which is going to be used in the analysis). Adjust these parameters according to your requirements. Check the instance types here.
  1. Launch the Stack: Fill in the prepared parameters and launch the CloudFormation stack.

Post-Stack Creation actions

After successfully creating the stack, follow these steps:
  1. Obtain the Datrics Link: Retrieve the Datrics link from the stack outputs.
  1. Wait for EC2 Instance Launch: Allow some time for the Datrics EC2 instance to launch. You can check the status in the EC2 service for the respective region where the stack was launched.
  1. Access Datrics: Open the Datrics link in your web browser.
  1. Sign In: Use the email and password provided as parameters in the stack to sign in to Datrics.
  1. Service initialisation. Wait for 5-10 minutes for the service to start before running templates / loading the files / datasets etc to the platform
  1. Explore the Service: Refer to the Datrics Wiki for detailed instructions on exploring and utilizing the service.

Upgrading Datrics

To upgrade Datrics to a new Amazon Machine Image (AMI) release, follow these steps:
  1. Update the Existing Stack: Update the existing stack with the new stack.
  1. Launch New EC2 Instance: A new EC2 instance will be launched, causing a short downtime.
  1. Preserved Service Data: All service data is preserved since it is stored in a separate EBS volume. No need for manual backups, the EBS snapshot is backed up every day via lifecycle service.

CloudFormation Breakdown

The CloudFormation stack consists of the following components:
  1. Roles: Two roles are created within the stack:
      • Allows the Datrics EC2 instance to attach and detach the EBS volume for persistent data storage.
      • Enables the lifecycle service to create and manage snapshots of the Datrics EBS volume, utilizing EBS KMS default keys for encryption and decryption.
  1. Networking:
      • Stack creates a VPC, private and public subnets, routes, and gateways for internet access.
      • Security groups are created to restrict access to the load balancer via ports 80 and 443 (from 0.0.0.0/0), and to allow access to the Datrics instance only from the load balancer.
  1. Encryption and Security:
      • The EBS volume, which stores user data, is encrypted using EBS KMS default key.
      • Traffic to the load balancer is encrypted via an SSL certificate
      • Instance in the private subnet + with ssh key
      • Security groups in place to limit inbound rules
      • No rotation keys are configured on the instance

SSH to the instance

  1. Create bastion host with security group of inbound 22 port open in public subnet of datrics vpc and <key>.pem that was used in stack creation to access datrics instance
  1. Add inbound rule to datrics instance security group to allow bastion to access the instance
  1. Ssh to the datrics instance through bastion’s IP using commands
      • scp -i <key>.pem <key>.pem ec2-user@<bastion_ip>
      • ssh -i <key>.pem ec2-user@<bastion_ip>
      • ssh -i <key>.pem ec2-user@<datrics_ip>

User & service data

  1. All the data from the service is persisted in /data folder locally
  1. User files are uploaded in /data/minio-data/storage
  1. Postgres data is saved in /data/postgres-data
  1. In order to ssh to the database use the credentials from /usr/share/datrics/datrics.env
      • get the postgres docker container
      • run docker exec -it <container_id> bash
      • run su postgres and psql -d <database>