Description of image

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 or the CLI. When created in the web console, the backend submits a spec file that outlines specifications for a deployment.

Create a Deployment using the CLI

You can create deployments using the Gradient CLI and linking an API key. Learn how to create an API key. 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.
enabled: true
image: lucone83/streamlit-nginx
port: 8080
env:
  - name: ENV
    value: VAR
resources:
  replicas: 1
  instanceType: C4
  1. Create the deployment.
gradient deployments create --name [deployment-name] --projectId [project-id] --spec deployment.yaml --apiKey [api-key]
  1. Check the status of your deployment.
gradient deployments get --id [deployment-id] --apiKey [api-key]
  1. View your running deployment in the web console. Click on the Deployments tab and select your deployment.
Running 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.
enabled: true
image: lucone83/streamlit-nginx
port: 8080
env:
  - name: ENV
    value: VAR
resources:
  replicas: 1
  instanceType: C4
  1. Copy the command below into your terminal. This returns the deployment id. Click here to set up the Gradient CLI.
gradient deployments create --name learn-gradient-deployment --projectId [projectID] --spec learn-gradient-deployment.yaml --apiKey [api-key]
  1. Check the deployment status from the console or using the CLI with the deployment id from the previous step.
gradient deployments get --id [deployment-id] --apiKey [api-key]
  1. Stop the deployment by updating enabled value to false in the spec.
enabled: false
image: lucone83/streamlit-nginx
port: 8080
env:
  - name: ENV
    value: VAR
resources:
  replicas: 1
  instanceType: C4
  1. Update the deployment.
gradient deployments update --id deployment-id --spec learn-gradient-deployment.yaml --apiKey [api-key]