{"id":20036305,"url":"https://github.com/athewsey/remote-sagemaker","last_synced_at":"2025-03-02T06:18:26.020Z","repository":{"id":163893284,"uuid":"358653984","full_name":"athewsey/remote-sagemaker","owner":"athewsey","description":"Automating code execution tasks on Amazon SageMaker via APIs","archived":false,"fork":false,"pushed_at":"2021-04-19T06:32:06.000Z","size":18,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-12T18:51:08.845Z","etag":null,"topics":["amazon-sagemaker","automation","jupyter","sagemaker"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/athewsey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-16T16:10:40.000Z","updated_at":"2024-12-30T09:42:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"5099b730-bf3c-4157-96be-94ad13460fac","html_url":"https://github.com/athewsey/remote-sagemaker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athewsey%2Fremote-sagemaker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athewsey%2Fremote-sagemaker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athewsey%2Fremote-sagemaker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athewsey%2Fremote-sagemaker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/athewsey","download_url":"https://codeload.github.com/athewsey/remote-sagemaker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241465329,"owners_count":19967285,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amazon-sagemaker","automation","jupyter","sagemaker"],"created_at":"2024-11-13T10:11:49.199Z","updated_at":"2025-03-02T06:18:25.991Z","avatar_url":"https://github.com/athewsey.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Automating Code Execution on Amazon SageMaker\n\nAs well as many other features, [Amazon SageMaker](https://aws.amazon.com/sagemaker/) provides [Jupyter](https://jupyter.org/)-based data science notebook environments on the cloud in two flavours:\n\n- [Classic SageMaker Notebook Instances](https://docs.aws.amazon.com/sagemaker/latest/dg/nbi.html), for a straightforward managed Jupyter/JupyterLab+conda experience\n- [Amazon SageMaker Studio](https://aws.amazon.com/sagemaker/studio/), a fully integrated development environment (IDE) for machine learning: Extending JupyterLab with additional features and integrations\n\nIn either case, users may wish to automatically trigger the execution of code in SageMaker notebook environments - to customise the out-of-the-box setup or run any other required jobs or processes.\n\nThis repository demonstrates some basic code examples using the same [Jupyter Server REST API](https://github.com/jupyter/jupyter/wiki/Jupyter-Notebook-Server-API) and [Jupyter Client WebSocket API](https://jupyter-client.readthedocs.io/en/stable/messaging.html#) (plus some SageMaker Studio extensions). \n\n- **[SMStudio Remote Notebook.ipynb](SMStudio%20Remote%20Notebook.ipynb)**: Demo code to run all code cells of an (existing) notebook as a SageMaker Studio user\n- **[SMStudio Remote Terminal.ipynb](SMStudio%20Remote%20Terminal.ipynb)**: Demo code to open a *System Terminal* and run commands as a SageMaker Studio user\n- **[SMStudio-Run-On-Start](SMStudio-Run-On-Start])**: A [NBI lifecycle-configuration-like](https://docs.aws.amazon.com/sagemaker/latest/dg/notebook-lifecycle-config.html) example for SageMaker Studio - running a setup script whenever a user re/starts their JupyterServer app.\n\n\n## Related Tools\n\nMany of the concepts in these examples are extensible and transferable (e.g. to classic NBIs), but in some settings alternative patterns may be more appropriate:\n\n- To execute code on creation or start-up of a classic notebook instance, use [Lifecycle configuration scripts](https://docs.aws.amazon.com/sagemaker/latest/dg/notebook-lifecycle-config.html)\n- For scheduling notebooks to \"run\" as parameterized SageMaker processing jobs, see [this AWS blog post with Papermill](https://aws.amazon.com/blogs/machine-learning/scheduling-jupyter-notebooks-on-sagemaker-ephemeral-instances/)\n\n\n## A Note on Security\n\nAs these examples highlight, providing the IAM `sagemaker:CreatePresignedDomainUrl` (for Studio) and `sagemaker:CreatePresignedNotebookInstanceUrl` (for NBI) permissions is sufficient to grant login to the target SageMaker environment and also code execution on that environment.\n\nFor more information on conditions you can apply to scope down these permissions, refer to the [IAM reference for Amazon SageMaker](https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonsagemaker.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fathewsey%2Fremote-sagemaker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fathewsey%2Fremote-sagemaker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fathewsey%2Fremote-sagemaker/lists"}