# Cloud(AWS/GCP/Azure)

### Requirements <a href="#requirements" id="requirements"></a>

To deploy Datasherlock Agent using Docker, you need:

* A working installation of Docker desktop.
* Datasherlock api token key

Self-hosted deployments also require the following:

* Ubuntu 22.04 or later
* 4GiB memory
* 2x vCPUs
* 20GiB storage.

### Register Database Metadata in the Cloud <a href="#register-database-metadata-in-the-cloud" id="register-database-metadata-in-the-cloud"></a>

You can register your database's metadata with Datasherlocks. Below is an example configuration for MySQL, Please update the `cloud/config.yaml` as per your requirment:

```yaml
type: "mysql"
database:
  host: "127.0.0.1"
  username: "root"
  port: 3306
  database: "employees"
  ssl: false
```

To connect your agent to the Datasherlocks cloud, use the following command. It will provide you with a token and a remote link. Make sure to keep them safe:

```bash
sherlock register --config cloud/config.yaml -n <AGENT_NAME>
```

### Download or clone the sherlock-on-premise repository. <a href="#download-or-clone-the-sherlock-on-premise-repository" id="download-or-clone-the-sherlock-on-premise-repository"></a>

```bash
git clone https://github.com/datasherlocks/sherlock.git
```

### Update environment variables <a href="#update-environment-variables" id="update-environment-variables"></a>

Configure environment variables in `cloud/.env`:

* Set `DB_PASSWORD` to your database password.
* Set `DS_API_KEY` to your datasherlock api token.
* Set `TUNNEL_TOKEN` to your agent token that you got while register.
* Set `CLIENT_SECRET` to oauth2 app secret if SSO is enable.

### Configure deployment <a href="#configure-deployment" id="configure-deployment"></a>

```bash
cd cloud && docker-compose up
```
