Launch Jupyter Notebook in AWS SageMaker
In this post, we are going through AWS SageMaker and launching a Jupyter Notebook.
What Is Amazon SageMaker?
Amazon SageMaker is a fully managed machine learning service. With SageMaker, data scientists and developers can quickly and easily build and train machine learning models, and then directly deploy them into a production-ready hosted environment. It provides an integrated Jupyter authoring notebook instance for easy access to your data sources for exploration and analysis, so you don’t have to manage servers. It also provides common machine learning algorithms that are optimized to run efficiently against extremely large data in a distributed environment. Training and hosting are billed by minutes of usage, with no minimum fees and no upfront commitments.
Amazon SageMaker notebook
An Amazon SageMaker notebook instance is an ML compute instance running the Jupyter Notebook App. SageMaker manages to create the instance and related resources. Use Jupyter notebooks in your notebook instance to prepare and process data, write code to train models, deploy models to SageMaker hosting, and test or validate your models.
CREATING A NOTEBOOK INSTANCE
Step 1: Creating an S3 bucket
SageMaker typically uses S3 as storage for data and model artifacts. We’ll start by creating an Amazon S3 bucket. In this step, you’ll create an S3 bucket for this purpose. To begin, sign in to the AWS Management Console, https://console.aws.amazon.com/.
1.1: In the AWS Management Console, choose Services then select S3 under Storage.
1.2: Choose Create Bucket
1.3: Provide a globally unique name for your bucket such as ‘sagemaker-test-date’.(Keep in mind this should be unique along all regions and accounts)
1.4: Select the Region you’ve chosen to use for this workshop from the dropdown.
1.5: Choose Create in the lower left of the dialog without selecting a bucket to copy settings from.
Step 2: Create SageMaker Notebook
Open the SageMaker console at https://console.aws.amazon.com/sagemaker/.
2.1: Choose Notebook instances in the left panel, then choose to Create notebook instance.
2.1.1: For the Notebook instance name, type a name for your notebook instance.
2.1.2: For Notebook instance type, choose an instance size suitable for your use case. For a list of supported instance types and quotas, see Amazon SageMaker Service Quotas.
2.1.3: For Platform Identifier, choose a platform type to create the notebook instance on. This platform type dictates the Operating System that your notebook instance is created with. We have Amazon Linux 1 and Amazon Linux 2
2.1.4: (Optional) Additional configuration lets advanced users create a shell script that can run when you create or start the instance. This script called a lifecycle configuration script can be used to set the environment for the notebook or to perform other functions.
(Optional) The additional configuration also lets you specify the size, in GB, of the ML storage volume that is attached to the notebook instance. You can choose a size between 5 GB and 16,384 GB, in 1 GB increments. You can use the volume to clean up the training dataset or to temporarily store validation or other data.
2.1.5: For the IAM role, choose either an existing IAM role in your account that has the necessary permissions to access SageMaker resources or choose Create a new role. If you choose to Create a new role, SageMaker creates an IAM role named AmazonSageMaker-ExecutionRole-YYYYMMDDTHHmmSS. The AWS-managed policy AmazonSageMakerFullAccess is attached to the role. The role provides permissions that allow the notebook instance to call SageMaker and Amazon S3. Here you can provide the S3 name we created in Step 1 and it provides the necessary permission for S3
2.1.6: For Root access, to enable root access for all notebook instance users, choose Enable. To disable root access for users, choose Disable. If you enable root access, all notebook instance users have administrator privileges and can access and edit all files on it. Keep it default.
We do have some Network, Git, and Tags parts let's keep that as default for now as it's optional.
2.2: Now Click Create Notebook instance. You will be taken back to the Create Notebook instance page.
Step 3: Access the Notebook Instance
When the status of the notebook instance is InService, in the console, the notebook instance is ready to use. Choose Open Jupyter next to the notebook name to open the classic Jupyter dashboard.
You can choose Open JupyterLab to open the JupyterLab dashboard. The dashboard provides access to your notebook instance and sample SageMaker notebooks that contain complete code walkthroughs. These walkthroughs show how to use SageMaker to perform common machine learning tasks.
So that’s it folks, I hope you have found this post useful. Thank you for reading, do follow for more.