Pre-Stack Configuration
Before running the CloudFormation stack, please ensure that you have completed the following steps:
- Domain Registration: Register a domain either with a third-party registrar or using AWS. For detailed instructions, refer to the official documentation.
- 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.
- Create an SSH Key Pair: Generate a PEM key pair for SSH access to the instance, if necessary.
- Define VPC CIDR Block: Decide on a VPC CIDR block that does not conflict with other blocks, especially in case of VPC peering.
- 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.
- 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) andEBSVolumeSize
(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.
- 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:
- Obtain the Datrics Link: Retrieve the Datrics link from the stack outputs.
- 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.
- Access Datrics: Open the Datrics link in your web browser.
- Sign In: Use the email and password provided as parameters in the stack to sign in to Datrics.
- Service initialisation. Wait for 5-10 minutes for the service to start before running templates / loading the files / datasets etc to the platform
- 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:
- Update the Existing Stack: Update the existing stack with the new stack.
- Launch New EC2 Instance: A new EC2 instance will be launched, causing a short downtime.
- 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:
- 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.
- 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.
- 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
- 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
- Add inbound rule to datrics instance security group to allow bastion to access the instance
- 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
- All the data from the service is persisted in
/data
folder locally
- User files are uploaded in
/data/minio-data/storage
- Postgres data is saved in
/data/postgres-data
- 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
andpsql -d <database>