# Quick start cluster setup

This page provides instructions for setting up an Amazon EKS cluster that supports NannyML Cloud. It is intended as a quick start when you just want to get going. For configuration options and  explanation please consult the [AWS documentation](https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html).

{% hint style="info" %}
You will need to have [AWS API credentials](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html) configured. The account used needs [permissions ](https://eksctl.io/installation/#prerequisite)to manage EKS clusters and IAM roles.
{% endhint %}

## Install eksctl

```shell
# for ARM systems, set ARCH to: `arm64`, `armv6` or `armv7`
ARCH=amd64
PLATFORM=$(uname -s)_$ARCH

curl -sLO "https://github.com/eksctl-io/eksctl/releases/latest/download/eksctl_$PLATFORM.tar.gz"

# (Optional) Verify checksum
curl -sL "https://github.com/eksctl-io/eksctl/releases/latest/download/eksctl_checksums.txt" | grep $PLATFORM | sha256sum --check

tar -xzf eksctl_$PLATFORM.tar.gz -C /tmp && rm eksctl_$PLATFORM.tar.gz

sudo mv /tmp/eksctl /usr/local/bin
```

## Define cluster name

```
CLUSTER_NAME=nannyml-cloud-demo
```

## Create cluster with EBS CSI driver

```shell
eksctl create cluster --name $CLUSTER_NAME --version=1.29 && \
eksctl utils associate-iam-oidc-provider --cluster $CLUSTER_NAME --approve && \
eksctl create iamserviceaccount \
    --name ebs-csi-controller-sa \
    --namespace kube-system \
    --cluster $CLUSTER_NAME \
    --role-name AmazonEKS_EBS_CSI_DriverRole \
    --role-only \
    --attach-policy-arn arn:aws:iam::aws:policy/service-role/AmazonEBSCSIDriverPolicy \
    --approve && \
eksctl create addon \
    --name aws-ebs-csi-driver \
    --cluster $CLUSTER_NAME \
    --service-account-role-arn arn:aws:iam::$(aws sts get-caller-identity --query "Account" --output text):role/AmazonEKS_EBS_CSI_DriverRole \
    --force
```

## Delete cluster

At some point you may decide to delete your cluster, e.g. after initial testing you want to create a cluster in your AWS organisation account.

{% hint style="danger" %}
Deleting a cluster containing a NannyML Cloud instance will cause models and configuration to be lost.
{% endhint %}

```
eksctl delete cluster --name $CLUSTER_NAME
```

{% hint style="info" %}
This deletes all cluster resources, including EC2 instances and IAM roles associated with cluster. However, it does not delete Elastic Block Store (EBS) volumes. If desired, you can delete these manually from [the AWS Console](https://eu-central-1.console.aws.amazon.com/ec2/home#Volumes:).
{% endhint %}
