{ "cells": [ { "cell_type": "code", "execution_count": null, "id": "3711c999-fb77-48da-a372-684e9a721758", "metadata": { "tags": [] }, "outputs": [], "source": [ "from IPython.display import IFrame\n" ] }, { "cell_type": "code", "execution_count": null, "id": "6b95f3fa-1444-45a0-8e9d-ccfad7c3df8d", "metadata": { "tags": [] }, "outputs": [], "source": [ "import sagemaker\n", "import jinja2\n", "from sagemaker import image_uris\n", "import boto3\n", "import os\n", "import time\n", "import json\n", "from pathlib import Path\n" ] }, { "cell_type": "code", "execution_count": null, "id": "54511796-5e5d-401b-beb3-e37abb31eda3", "metadata": { "tags": [] }, "outputs": [], "source": [ "import boto3\n", "\n", "region = boto3.Session().region_name\n", "client = boto3.Session().client(\"sagemaker\")\n", "domainId=client.list_domains()[\"Domains\"][0].get(\"DomainId\")\n", "sess= sagemaker.session.Session()\n", "region = sess._region_name\n", "account_id = sess.account_id()\n", "\n", "vpc_id = client.describe_domain(\n", " DomainId=client.list_domains()[\"Domains\"][0].get(\"DomainId\")\n", ").get(\"VpcId\")\n", "\n", "url = f\"https://{domainId}.studio.{region}.sagemaker.aws/jupyter/default/proxy/8501/\"\n", "print(url )" ] }, { "cell_type": "code", "execution_count": null, "id": "2e4ea496-d568-4f82-a90f-0818e4c65d98", "metadata": { "tags": [] }, "outputs": [], "source": [ "IFrame(url, width='90%', height='1100')" ] }, { "cell_type": "code", "execution_count": null, "id": "7e177fe3-f391-4ee2-90a1-c98f05e571d9", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "2bf3905a-7344-463b-98eb-569677c97034", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "instance_type": "ml.t3.medium", "kernelspec": { "display_name": "Python 3 (Data Science)", "language": "python", "name": "python3__SAGEMAKER_INTERNAL__arn:aws:sagemaker:us-east-1:081325390199:image/datascience-1.0" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.10" } }, "nbformat": 4, "nbformat_minor": 5 }