Getting Started with the Vespa Cloud

Follow these steps to deploy your first application to the dev zone in the Vespa Cloud.

There is also a version on this that requires Maven and Java if you plan to add Java components to your application.

Prerequisites: git, openssl.

  1. Create an application in the Vespa Cloud

    Log in to console.vespa.ai and click "Create application".

    This requires a Google or GitHub account, and will start your free trial if you don't already have a Vespa Cloud tenant.

  2. Make a local application source

    To start with the album-recommendation sample app:

    $ git clone https://github.com/vespa-engine/sample-apps.git
    $ cd sample-apps/vespa-cloud/album-recommendation
    
  3. Create a self-signed certificate

    This certificate and key will be used to send requests to Vespa Cloud later.

    $ 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
    $ mkdir -p src/main/application/security
    $ cp data-plane-public-cert.pem src/main/application/security/clients.pem
    

    See the security model for more details.

  4. Create the application package

    $ (cd src/main/application && zip -r ../../../application.zip .)
    

    You can also do this with maven: mvn package

  5. Deploy the application

    In the Vespa console, click Deploy on the application created in the start of this guide. In the "Deploy to dev" section, upload application.zip - click Deploy.

    You can also do this on the command line with maven.

    The first deployment may take a few minutes.

  6. Verify that you can reach the application endpoint

    You can find the endpoint in the console.

    $ ENDPOINT=https://your.endpoint.name
    $ curl --cert data-plane-public-cert.pem --key data-plane-private-key.pem $ENDPOINT
    

    You can also do this in a browser.

  7. Write some data

    Write three documents using the document api:

    $ curl --cert data-plane-public-cert.pem --key data-plane-private-key.pem \
      -H "Content-Type:application/json" --data-binary @src/test/resources/A-Head-Full-of-Dreams.json \
      $ENDPOINT/document/v1/mynamespace/music/docid/1
    $ curl --cert data-plane-public-cert.pem --key data-plane-private-key.pem \
      -H "Content-Type:application/json" --data-binary @src/test/resources/Love-Is-Here-To-Stay.json \
      $ENDPOINT/document/v1/mynamespace/music/docid/2
    $ curl --cert data-plane-public-cert.pem --key data-plane-private-key.pem \
      -H "Content-Type:application/json" --data-binary @src/test/resources/Hardwired...To-Self-Destruct.json \
      $ENDPOINT/document/v1/mynamespace/music/docid/3
    
  8. Send queries

    Send a user profile as a query to get album recommendations:

    $ curl --cert data-plane-public-cert.pem --key data-plane-private-key.pem \
    "$ENDPOINT/search/?ranking=rank_albums&yql=select%20%2A%20from%20sources%20%2A%20where%20sddocname%20contains%20%22music%22%3B&ranking.features.query(user_profile)=%7B%7Bcat%3Apop%7D%3A0.8%2C%7Bcat%3Arock%7D%3A0.2%2C%7Bcat%3Ajazz%7D%3A0.1%7D"
    

Next steps