Skip to content

Quick Start Guide#

In this guide, we will;

  1. Create a kubernetes cluster and set it up as an Ametnes Data Service Location.
  2. Create a simple MageAI service.
  3. Connect to the MageAI service.

Setting up an Ametnes Data Services Location#

Create a kubernetes cluster.#

Create an Ametnes Data Service location on your local computer

  1. If you do not have docker installed on your local computer, download and install it as instructured here.
  2. Then if you do not have KinD install on your local computer, install it by following these instructions.
  3. Save this file on your local computer
    kind.yml
    kind: Cluster
    apiVersion: kind.x-k8s.io/v1alpha4
    # 1 control plane node and 1 worker
    nodes:
    # the control plane node config
    # For image, see https://github.com/kubernetes-sigs/kind/releases
    - role: control-plane
      image: kindest/node:v1.25.2@sha256:9be91e9e9cdf116809841fc77ebdb8845443c4c72fe5218f3ae9eb57fdb4bace
      kubeadmConfigPatches:
      - |
        kind: InitConfiguration
        nodeRegistration:
          kubeletExtraArgs:
            node-labels: "location.ametnes.io/platform=kind,location.ametnes.io/ipv4-address=<your-ip-address>"
      extraPortMappings:
      - containerPort: 80
        hostPort: 80
        protocol: TCP
      - containerPort: 443
        hostPort: 443
        protocol: TCP
    
    # the workers
    - role: worker
      image: kindest/node:v1.25.2@sha256:9be91e9e9cdf116809841fc77ebdb8845443c4c72fe5218f3ae9eb57fdb4bace
    
  4. Get your local IP address e.g. for the mac, use ipconfig getifaddr en0
  5. Replace the text <your-ip-address> in saved file from 3. above with the IP address from 4.
  6. Create the cluster with kind create cluster --config=/path/to/kind.yml

Create an Ametnes Data Service location using an AWS EKS cluster

  1. Ensure that you have setup the AWS CLI on your local workstation
  2. Save the following file to your local work station

    eks-1-24.yml
    apiVersion: eksctl.io/v1alpha5
    kind: ClusterConfig
    
    metadata:
    name: &cluster_name ametnes-data-location-1-24
    region: us-east-2
    version: "1.24"
    
    addons:
    - name: aws-ebs-csi-driver
    
    availabilityZones:
    - us-east-2b
    - us-east-2c
    
    managedNodeGroups:
    - name: *cluster_name
    amiFamily: AmazonLinux2
    desiredCapacity: 3
    disableIMDSv1: false
    disablePodIMDS: false
    iam:
      withAddonPolicies:
        autoScaler: false
        awsLoadBalancerController: false
        ebs: true
        efs: false
    instanceTypes:
    - c4.2xlarge
    - c5.2xlarge
    labels:
      alpha.eksctl.io/cluster-name: *cluster_name
      alpha.eksctl.io/nodegroup-name: *cluster_name
    maxSize: 4
    minSize: 3
    
    spot: true
    ssh:
      allow: false
    tags:
      alpha.eksctl.io/nodegroup-name: *cluster_name
      alpha.eksctl.io/nodegroup-type: managed
    volumeType: gp3
    
  3. Create the cluster

    eksctl create cluster -f eks-1-24.yml
    

  4. Ensure kubeconfig has been updated

    aws eks update-kubeconfig --name ametnes-data-location-1-24 --region us-east-2
    

Install the Ametnes Cloud Agent#

  1. Add the helm repository.

    helm repo add ametnes https://ametnes.github.io/helm && helm repo update
    
  2. Generate a UUID on your command line with uuidgen.

    26F522B3-E412-44D0-9992-F47F03F3192B
    
  3. Install the Ametnes Cloud Agent and set the agent.config.location.

    helm upgrade --install --create-namespace --namespace ametnes-system ametnes-cloud-agent ametnes/cloud-agent --set agent.config.location=26F522B3-E412-44D0-9992-F47F03F3192B
    
  4. In your Ametnes Cloud console account, create a Data Service Location with

    1. Login into your Ametnes Cloud account here.
    2. Nagivate to the Service Locations menu on the left
    3. Click New Location
    4. Enter the following
      1. User Supplied Id: 26F522B3-E412-44D0-9992-F47F03F3192B
      2. Name: Demo
      3. Code: DSL1
      4. Click Create
  5. After a short while, the data service location should come online.

Create the service#

Sign into your Ametnes Cloud console at here.#

Create a MageAI data service.#

  1. Using the Services left menu, navigate to the service management dashboard.
  2. Click New Service.
  3. Enter the Mage to filter from the list and select Create
  4. In the displayed form, enter the following info.
    1. Enter the Name: Mage-Service-DSL1 and Description: Mage-Service-DSL1.
    2. Select a Version from the list.
    3. Select the Location: Demo/DSL1.
    4. Enter an email and password that will be used to authenticate into the Mage service.
    5. Click Create.
    6. Wait a short while and your data service will be ready.

Deploying data services at scale is easier with the Ametnes Cloud terraform provider. We will create a data service in the location Demo that we created above using terraform.

Create an API token#

In your Ametnes Cloud account.

  1. Navigate to Users.
  2. Click Edit on your user.
  3. Click Get User Token and a user token will be generated for you.
  4. Ensure the generated user token is kept in a secure place as it will not be visible again.

Install terraform#

Follow instructions here to install terraform on your computer.

Create your project#

Add these files to an empty folder on your workstation.

Set up the variables#
variables.tf
variable "token" {
  type = string
  description = "The Ametnes cloud api doken to use. You'd need to create one in the ametnes cloud console corresponding to your regsitered email"
}

variable "username" {
  type = string
  description = "This is your ametnes cloud registered email address"
}

variable "project" {
  type = string
  description = "The project you'd like to create your resources in"
   default = "Default"
}
Add your API key secrets#
secrets.auto.tfvars
username = "Your.Email@domain.com"
token = "YourApiToken"
Define your resources#
main.tf
terraform {
  required_providers {
    ametnes = {
      source  = "ametnes.com/cloud/ametnes"
    }
  }
}

# Init and create the provider
provider "ametnes" {
  token = var.token
  username = var.username
}

# Read location.
data "ametnes_location" "location" {
  name = "Demo"
  code = "DSL1"
}

# Read the project that will host all your resources.
data "ametnes_project" "project" {
  name = var.project
}

# Create a service resource.
resource "ametnes_service" "service" {
  name = "Weaviate-Demo-Instance"
  project = ametnes_project.project.id
  location = data.ametnes_location.location.id
  kind = "weaviate:1.19"
  description = "Weaviate Demo Instance"
  capacity {
    storage = 10
    memory = 1
    cpu = 1
  }
   config = {
     "admin.user" = "adminuser"
     "admin.password" = "fo9ruk3kee7uJe1vi>sh&ei0thoogh0Oogh[u4Ci3shaethoi:Ng2oh"
   }
  nodes = 1
}

output "service_connections" {
  value = ametnes_service.service.connections
}

Deploy your terraform resources#

  1. Run terraform init.
  2. Once terraform has been initialized, then terraform plan to see what resources will be created.
  3. Then lastly run terraform apply -auto-approve.
  4. Once terraform is done creating your resources, the output will be the service_connections object containing the endpoint of your data service e.g. your.instance.host.name.

Test connectivity#

  1. In your browser, paste the URL https://<your.instance.host.name>/.
  2. You should get a prompt to login.

Cleaning up resources#

  1. Delete the data services you created above with terraform destroy -auto-approve.
  2. Delete the kubernetes cluster with eksctl delete cluster -f eks-1-24.yml --disable-nodegroup-eviction.