diff --git a/docs/sphinx/source/getting-started-pyvespa-cloud.ipynb b/docs/sphinx/source/getting-started-pyvespa-cloud.ipynb index ffe5658c..c1ce8e37 100644 --- a/docs/sphinx/source/getting-started-pyvespa-cloud.ipynb +++ b/docs/sphinx/source/getting-started-pyvespa-cloud.ipynb @@ -119,7 +119,7 @@ }, { "cell_type": "code", - "execution_count": 71, + "execution_count": null, "id": "64da11f2", "metadata": {}, "outputs": [], @@ -326,8 +326,17 @@ "metadata": {}, "source": [ "`app` now holds a reference to a [Vespa](https://pyvespa.readthedocs.io/en/latest/reference-api.html#vespa.application.Vespa) instance.\n", - "\n", - "Store the endpoint for later usage - paste from the deploy-output above:" + "Store the endpoint for later usage - set `endpoint` from this output:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1370dc4c", + "metadata": {}, + "outputs": [], + "source": [ + "!vespa status container" ] }, { @@ -337,7 +346,7 @@ "metadata": {}, "outputs": [], "source": [ - "endpoint = \"https://textsearch-container.textsearch.mytenant.aws-us-east-1c.dev.z.vespa-app.cloud/\"" + "endpoint = \"https://textsearch-container.textsearch.kkraunetenant1.aws-us-east-1c.dev.z.vespa-app.cloud/\"" ] }, { @@ -539,6 +548,47 @@ "doc = session.get(url).json()\n", "doc" ] + }, + { + "cell_type": "markdown", + "id": "0a42b504", + "metadata": {}, + "source": [ + "## Example: Reconnect pyvespa using cert/key pair\n", + "\n", + "Above, we stored the dataplane credentials for later use. Deployment of an application usually happens when the schema changes, whereas accessing the dataplane is for document updates and user queries.\n", + "\n", + "One only needs to know the endpoint and the cert/key pair to enable a connection to a Vespa Cloud application:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "714147ee", + "metadata": {}, + "outputs": [], + "source": [ + "# cert_path = \"/Users/me/.vespa/mytenant.textsearch.default/data-plane-public-cert.pem\"\n", + "# key_path = \"/Users/me/.vespa/mytenant.textsearch.default/data-plane-private-key.pem\"\n", + "\n", + "from vespa.application import Vespa\n", + "\n", + "the_app = Vespa(endpoint, cert=cert_path, key=key_path)\n", + "\n", + "res = the_app.query(body={\n", + " 'yql': 'select * from sources * where true',\n", + " 'hits': 1\n", + "})\n", + "res.hits[0]" + ] + }, + { + "cell_type": "markdown", + "id": "708d5dee", + "metadata": {}, + "source": [ + "A common problem is a cert mismatch - the cert/key pair used when deployed is different than the pair used when making queries. Make sure it is the same pair / re-create with `vespa auth cert -f` and redeploy as needed." + ] } ], "metadata": {