Getting started, including Java development

Follow these steps to deploy an application having Java components to the dev zone in the Vespa Cloud. Find more details and tips in the developer guide. Alternative versions of this guide:

  1. Install the Vespa CLI using Homebrew:

    $ brew install vespa-cli
  2. Create a tenant in the Vespa Cloud:

    Create a tenant at (unless you already have one). This requires a Google or GitHub account, and will start your free trial.

  3. Configure the Vespa client:

    $ vespa config set target cloud && \
      vespa config set application tenant-name.myapp
    $ export VESPA_CLI_HOME=$PWD/.vespa TMPDIR=$PWD/.tmp
    $ mkdir -p $TMPDIR
    $ vespa config set target cloud
    $ vespa config set application vespa-team.album-rec-java

    Use the tenant name from step 2. This guide uses myapp as application name - learn more.

  4. Authorize Vespa Cloud access:

    $ vespa auth login
    $ export VESPA_CLI_API_KEY="$(echo "$VESPA_TEAM_API_KEY" | openssl base64 -A -a -d)"

    Follow the instructions from the command to authenticate.

  5. Get a sample application:

    $ vespa clone album-recommendation-java myapp && cd myapp

    An application package is the full application configuration. See sample-apps for other sample apps you can clone instead (be sure to pick one that contains Java components).

  6. Add public certificate:

    $ vespa auth cert

    This creates a self-signed certificate for data plane access (reads and writes), and adds it to the application package. See the security model for details.

  7. Build the application:

    $ mvn -U package
  8. Deploy the application:

    $ vespa deploy --wait 600

    The first deployment will take a few minutes while nodes are provisioned. Subsequent deployments on existing nodes will be quicker.

  9. Feed documents:

    $ vespa feed src/test/resources/*.json
  10. Run queries:

    $ vespa query "select * from music where album contains 'head'"
    $ vespa query \
        "select * from music where true" \
        "ranking=rank_albums" \

    These requests use the Query API.

Next steps