Vespa Cloud This page's content is applicable to Vespa Cloud.

Deploy an application without Vespa CLI

This lets you deploy an application to the dev zone on Vespa Cloud (for free).

Alternative versions of this guide:


Steps:

  1. Create a tenant on Vespa Cloud:

    Go to console.vespa-cloud.com and create your tenant (unless you already have one).

  2. Clone a sample application:

    $ git clone --depth 1 https://github.com/vespa-engine/sample-apps.git && \
      cd sample-apps/album-recommendation
    

    See sample-apps for other sample apps you can clone.

  3. Add a certificate for data plane access to the application:

    On Unix or Mac, use openssl:

    $ openssl req -x509 -nodes -days 14 -newkey rsa:4096 \
      -subj "/CN=cloud.vespa.example" \
      -keyout data-plane-private-key.pem -out data-plane-public-cert.pem
    

    On Windows, the certificate has to be created with New-SelfSignedCertificate in PowerShell, and then exported to PEM format using certutil.

    Once the certificate has been created, add it to the application package.

    $ mkdir -p app/security && \
      cp data-plane-public-cert.pem app/security/clients.pem
    
  4. Create a deployable application package zip:

    $ ( cd app && zip -r ../application.zip . )
    
  5. Deploy the application:

    In the console, click Deploy Application. Use "myapp" as the application name, leave the defaults. Make sure DEV is selected, and upload the application.zip. Click Create and deploy.

    The first deployment may take a few minutes while nodes are provisioned.

    $ export VESPA_CLI_HOME=$PWD/.vespa TMPDIR=$PWD/.tmp
    $ mkdir -p $TMPDIR
    $ mkdir -p $VESPA_CLI_HOME/vespa-team.album-rec-java.default
    $ vespa config set target cloud
    $ vespa config set application vespa-team.album-rec-java
    $ export VESPA_CLI_API_KEY="$(echo "$VESPA_TEAM_API_KEY" | openssl base64 -A -a -d)"
    $ cp data-plane-public-cert.pem $VESPA_CLI_HOME/vespa-team.album-rec-java.default
    $ cp data-plane-private-key.pem $VESPA_CLI_HOME/vespa-team.album-rec-java.default
    $ vespa deploy --wait 600
    $ export ENDPOINT=https://album-rec-java.vespa-team.aws-us-east-1c.dev.z.vespa-app.cloud/
    
  6. Verify the application endpoint:

    $ ENDPOINT=https://name.myapp.tenant-name.aws-us-east-1c.dev.z.vespa-app.cloud/
    
    $ curl --cert data-plane-public-cert.pem --key data-plane-private-key.pem $ENDPOINT
    

    You can find the endpoint in the console deployment output, set it for later use and test it. You can also do this in a browser.

  7. Feed documents:

    $ curl --cert data-plane-public-cert.pem --key data-plane-private-key.pem \
      -H "Content-Type:application/json" \
      --data-binary @ext/A-Head-Full-of-Dreams.json \
      $ENDPOINT/document/v1/mynamespace/music/docid/a-head-full-of-dreams
    
    $ curl --cert data-plane-public-cert.pem --key data-plane-private-key.pem \
      -H "Content-Type:application/json" \
      --data-binary @ext/Love-Is-Here-To-Stay.json \
      $ENDPOINT/document/v1/mynamespace/music/docid/love-is-here-to-stay
    
    $ curl --cert data-plane-public-cert.pem --key data-plane-private-key.pem \
      -H "Content-Type:application/json" \
      --data-binary @ext/Hardwired...To-Self-Destruct.json \
      $ENDPOINT/document/v1/mynamespace/music/docid/hardwired-to-self-destruct
    
  8. Run queries:

    curl --cert data-plane-public-cert.pem --key data-plane-private-key.pem \
      -X POST -H "Content-Type: application/json" --data '
      {
          "yql": "select * from music where true",
          "ranking": {
              "profile": "rank_albums",
              "features": {
                  "query(user_profile)": "{{cat:pop}:0.8,{cat:rock}:0.2,{cat:jazz}:0.1}"
              }
          }
      }' \
      $ENDPOINT/search/
    
    $ curl --cert data-plane-public-cert.pem --key data-plane-private-key.pem \
    "$ENDPOINT/search/?ranking=rank_albums&yql=select%20%2A%20from%20music%20where%20true&ranking.features.query(user_profile)=%7B%7Bcat%3Apop%7D%3A0.8%2C%7Bcat%3Arock%7D%3A0.2%2C%7Bcat%3Ajazz%7D%3A0.1%7D"
    

Congratulations, you have deployed your first Vespa application! Application instances in the dev zone will by default keep running for 14 days after the last deployment. You can control this in the console.

Next steps