# How to Create Deployments Using the Paperspace CLI Paperspace Deployments are containers-as-a-service that allow you to run container images and serve machine learning models using a high-performance, low-latency service with a RESTful API. Gradient Deployments can be created in the [web console](https://docs.digitalocean.com/products/paperspace/deployments/getting-started/deploy-model-to-endpoint/index.html.md) or the CLI. When created in the web console, the backend submits a spec file that outlines [specifications](https://docs.digitalocean.com/products/paperspace/deployments/reference/deployment-spec/index.html.md) for a deployment. ## Create a Deployment using the CLI You can create deployments using the [Gradient CLI](https://docs.digitalocean.com/reference/paperspace/gradient/index.html.md) and linking an API key. Learn how to [create an API key](https://docs.digitalocean.com/reference/paperspace/api-keys/index.html.md). You also need an existing Project to run your deployment. 1. Create a YAML spec as shown below to manage your deployment in any editor. ```yaml enabled: true image: lucone83/streamlit-nginx port: 8080 env: - name: ENV value: VAR resources: replicas: 1 instanceType: C4 ``` 2. Create the deployment. ```bash gradient deployments create --name [deployment-name] --projectId [project-id] --spec deployment.yaml --apiKey [api-key] ``` 3. Check the status of your deployment. ```yaml gradient deployments get --id [deployment-id] --apiKey [api-key] ``` 4. View your running deployment in the [web console](https://console.paperspace.com/). Click the **Deployments** tab and select your deployment. ### Create an Example Gradient Deployment Use the CLI to create this example deployment. A credit card on the workspace is necessary and this charges the account until the deployment is turned off. 1. In your favorite editor create a new file called `learn-gradient-deployment.yaml` and add the following code. ```yaml enabled: true image: lucone83/streamlit-nginx port: 8080 env: - name: ENV value: VAR resources: replicas: 1 instanceType: C4 ``` 2. Copy the command below into your terminal. This returns the `deployment id`. [Click here](https://docs.digitalocean.com/reference/paperspace/gradient/index.html.md) to set up the Gradient CLI. ```bash gradient deployments create --name learn-gradient-deployment --projectId [projectID] --spec learn-gradient-deployment.yaml --apiKey [api-key] ``` 3. Check the deployment status from [the console](https://console.paperspace.com/) or using the CLI with the `deployment id` from the previous step. ```bash gradient deployments get --id [deployment-id] --apiKey [api-key] ``` 4. Stop the deployment by updating `enabled` value to `false` in the spec. ```yaml enabled: false image: lucone83/streamlit-nginx port: 8080 env: - name: ENV value: VAR resources: replicas: 1 instanceType: C4 ``` 5. Update the deployment. ```yaml gradient deployments update --id deployment-id --spec learn-gradient-deployment.yaml --apiKey [api-key] ```