AWS sagemaker documentation change
Summary
Restructured documentation with added Dockerfile examples, health check requirements, and URL configuration details for custom Code Editor images
Security assessment
Added security-related configuration requirements (port binding, authentication flags, user permissions) but no evidence of addressing a specific vulnerability
Diff
diff --git a/sagemaker/latest/dg/code-editor-custom-images.md b/sagemaker/latest/dg/code-editor-custom-images.md index 4313cc241..ffcf4c3b0 100644 --- a//sagemaker/latest/dg/code-editor-custom-images.md +++ b//sagemaker/latest/dg/code-editor-custom-images.md @@ -5 +5 @@ -# Environment customization using custom images +Health check and URL for applicationsDockerfile examples @@ -7 +7 @@ -If you need functionality that is different than what's provided by SageMaker distribution, you can bring your own image with your custom extensions and packages. You can also use it to personalize the Code Editor UI for your own branding or compliance needs. +# Custom images @@ -9 +9 @@ If you need functionality that is different than what's provided by SageMaker di -For requirements for your image, see [Dockerfile specifications](./code-editor-custom-images-specifications.html). +If you need functionality that is different than what's provided by SageMaker distribution, you can bring your own image with your custom extensions and packages. You can also use it to personalize the Code Editor UI for your own branding or compliance needs. @@ -11 +11 @@ For requirements for your image, see [Dockerfile specifications](./code-editor-c -For a tutorial that helps you create an image that your users can access to run their Code Editor environment, see [Provide users with access to custom images](./code-editor-custom-images-provide-access.html). +The following page will provide Code Editor-specific information and templates to create your own custom SageMaker AI images. This is meant to supplement the Amazon SageMaker Studio information and instructions on creating your own SageMaker AI image and bringing your own image to Studio. To learn about custom Amazon SageMaker AI images and how to bring your own image to Studio, see [Custom images](./studio-updated-byoi.html). @@ -15 +15,62 @@ For a tutorial that helps you create an image that your users can access to run - * [Dockerfile specifications](./code-editor-custom-images-specifications.html) + * Health check and URL for applications + + * Dockerfile examples + + + + +## Health check and URL for applications + + * `Base URL` – The base URL for the BYOI application must be `CodeEditor/default`. You can only have one application and it must always be named `default`. + + * Health check endpoint – You must host your Code Editor server at 0.0.0.0 port 8888 for SageMaker AI to detect it. + + * Authentication – You must pass `--without-connection-token` when opening `sagemaker-code-editor` to allow SageMaker AI to authenticate your users. + + + + +###### Note + +If you are using Amazon SageMaker Distribution as the base image, these requirements are already taken care of as part of the included `entrypoint-code-editor` script. + +## Dockerfile examples + +The following examples are `Dockerfile`s that meets the above information and [Custom SageMaker AI image specifications](./studio-updated-byoi-specs.html). + +Example micromamba Dockerfile + + +The following is an example Dockerfile to create an image from scratch using a [`micromamba`](https://mamba.readthedocs.io/en/latest/user_guide/micromamba.html) base environment: + + + FROM mambaorg/micromamba:latest + ARG NB_USER="sagemaker-user" + ARG NB_UID=1000 + ARG NB_GID=100 + + USER root + + RUN micromamba install -y --name base -c conda-forge sagemaker-code-editor + + USER $NB_UID + + CMD eval "$(micromamba shell hook --shell=bash)"; \ + micromamba activate base; \ + sagemaker-code-editor --host 0.0.0.0 --port 8888 \ + --without-connection-token \ + --base-path "/CodeEditor/default" + +Example SageMaker AI Distribution Dockerfile + + +The following is an example Dockerfile to create an image based on [Amazon SageMaker AI Distribution](https://github.com/aws/sagemaker-distribution/tree/main): + + + FROM public.ecr.aws/sagemaker/sagemaker-distribution:latest-cpu + ARG NB_USER="sagemaker-user" + ARG NB_UID=1000 + ARG NB_GID=100 + ENV MAMBA_USER=$NB_USER + + USER root @@ -17 +78,2 @@ For a tutorial that helps you create an image that your users can access to run - * [Provide users with access to custom images](./code-editor-custom-images-provide-access.html) + # install scrapy in the base environment + RUN micromamba install -y --name base -c conda-forge scrapy @@ -18,0 +81,4 @@ For a tutorial that helps you create an image that your users can access to run + # download VSCodeVim + RUN \ + wget https://github.com/VSCodeVim/Vim/releases/download/v1.27.2/vim-1.27.2.vsix \ + -P /tmp/exts/ --no-check-certificate @@ -19,0 +86,6 @@ For a tutorial that helps you create an image that your users can access to run + # Install the extension + RUN \ + extensionloc=/opt/amazon/sagemaker/sagemaker-code-editor-server-data/extensions \ + && sagemaker-code-editor \ + --install-extension "/tmp/exts/vim-1.27.2.vsix" \ + --extensions-dir "${extensionloc}" @@ -20,0 +93,2 @@ For a tutorial that helps you create an image that your users can access to run + USER $MAMBA_USER + ENTRYPOINT ["entrypoint-code-editor"] @@ -30 +104 @@ Configure extensions -Dockerfile specifications +SageMaker HyperPod