> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superblocks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Virtual machine

> Estimated deployment time: 10 minutes

export const Alert = ({type, title, children}) => {
  const variant = ["info", "success", "warning", "danger", "note"].includes(type) ? type : "note";
  return <div className={`alert alert--${variant}`}>
      <div className="alert-icon" />
      <div className="alert-content">
        {title && <div className="alert-title">{title}</div>}
        <div className="alert-body">{children}</div>
      </div>
    </div>;
};

The Superblocks data plane can be deployed on a virtual machine with Docker Compose. Note, this method is not as scalable as using container management services like [AWS ECS Fargate](./aws_ecs_fargate) or [Google Cloud Run](./google_cloud_run). If you use this method in production, we recommend deploying on a minimum of 3 instances.

## Deploy

Follow the steps below to deploy the data plane on a virtual machine.

### Launch VM

Launch a virtual machine using Amazon Linux, Ubuntu, CentOS, or Debian. The instance should have at least 4 GiB of memory and 20 GiB of storage. Make sure the instance's security group allows inbound traffic on HTTP port 80 and HTTPS port 443. Example below for an AWS EC2 instance.

<img src="https://mintcdn.com/superblocks/0x599EHVvFHaqYo0/images/on-premise-agent/opa_quickstart_inbound_rules.png?fit=max&auto=format&n=0x599EHVvFHaqYo0&q=85&s=72c8406b526ee21d2c82788fef17d5a9" alt="data plane security group inbound rules" width="1756" height="560" data-path="images/on-premise-agent/opa_quickstart_inbound_rules.png" />

### Create CNAME or A record

Next, create a CNAME or A record of a custom domain pointed to the IP address of the VM. This custom domain will be used in the agent configuration.

### Install agent

**1. Download script on VM**

```bash theme={null}
sudo curl -SL https://charts.superblocks.com/agent/quickstart.sh -o /usr/bin/superblocks
sudo chmod +x /usr/bin/superblocks
```

**2. Configure agent variables**

<Alert type="info">
  To generate a <code>SUPERBLOCKS\_AGENT\_KEY</code>, go to the Superblocks <a href="https://app.superblocks.com/opas">Setup Wizard</a>.
</Alert>

```bash theme={null}
sudo superblocks conf SUPERBLOCKS_AGENT_KEY [YOUR_AGENT_KEY]
sudo superblocks conf SUPERBLOCKS_LETSENCRYPT_EMAIL [YOUR_EMAIL_ADDRESS]
sudo superblocks conf SUPERBLOCKS_AGENT_HOST_URL https://YOUR.VALID.DOMAIN.COM
sudo superblocks conf SUPERBLOCKS_PROXY_REPLICA_COUNT 1
sudo superblocks conf SUPERBLOCKS_DOCKER_AGENT_TAG latest
```

Note, `SUPERBLOCKS_AGENT_HOST_URL` is the custom domain configured under prerequisites.

<Alert type="info">
  If you use the EU Superblocks instance, set <code>SUPERBLOCKS\_AGENT\_DATA\_DOMAIN</code> to <code>eu.superblocks.com</code>.
</Alert>

**3. Start the service**

When starting for the first time, this will install docker and pull docker images.

```bash theme={null}
sudo superblocks start
```

**4. Verify**

After the installation completes, check that the service is successfully deployed and can be connected to locally.

```bash theme={null}
curl localhost:8080/health
```

To validate that the service is up and available over https, visit `https://YOUR.VALID.DOMAIN.COM/health`.

<div>
  <img src="https://mintcdn.com/superblocks/0x599EHVvFHaqYo0/images/on-premise-agent/opa_quickstart_verify.png?fit=max&auto=format&n=0x599EHVvFHaqYo0&q=85&s=4c7b7c1e607bd4d3dcc72b2a2b6d8e39" alt="Verify data plane custom domain via HTTPS" title="data status with custom domain" className="no-box-shadow" width="2262" height="270" data-path="images/on-premise-agent/opa_quickstart_verify.png" />
</div>

## Billable services

When running the data plane on a virtual machine, it is important to be aware of your cloud provider's instance pricing (i.e. [EC2](https://aws.amazon.com/ec2/pricing/), [GCE](https://cloud.google.com/compute/all-pricing), [Azure VM](https://azure.microsoft.com/en-us/pricing/details/virtual-machines/series/)) and the cost of any associated infrastructure like networking, load balancers, and DNS.
