Cannot Find Running Instance

0

Hello. My billing shows I am being billed for a SageMaker instance (type = ml.c5.9xlarge-RStudioServerPro; Region = US East (N. Virginia)), but my EC2 Dashboard shows no instances running, either in that region or globally, and I have nothing running in my RStudio app. I need to find and stop that instance. Thank you.

asked 2 years ago916 views
3 Answers
0

Hello learn2skills: Thank you very much for your answer. I have followed the cleanup instructions earlier, and have no Notebooks or Endpoints. I will work to configure CloudWatch to see if that helps, but the billing shows the instance type and region. Will CloudWatch provide more information? Do you have additional suggestions? Thank you.

answered 2 years ago
0

HI,

ml EC2 instances do not appear in the EC2 console. You can find their metrics in Cloudwatch though, and create dashboards to monitor what you need:

They don't appear in the EC2 UI and API as they are being managed by the SageMaker control plane

Notebook instance: you have two options if you do not want to keep the notebook instance running. If you would like to save it for later, you can stop rather than deleting it.

  1. To stop a notebook instance: click the Notebook instances link in the left pane of the SageMaker console home page. Next, click the Stop link under the ‘Actions’ column to the left of your notebook instance’s name. After the notebook instance is stopped, you can start it again by clicking the Start link. Keep in mind that if you stop rather than delete it, you will be charged for the storage associated with it.

  2. To delete a notebook instance: first stop it per the instruction above. Next, click the radio button next to your notebook instance, then select **Delete **from the Actions drop down menu.

Endpoints: these are the clusters of one or more instances serving inferences from your models. If you did not delete them from within a notebook, you can delete them via the SageMaker console. To do so:

  1. Click the Endpoints link in the left panel.

  2. Then, for each endpoint, click the radio button next to it, then select Delete from the Actions drop down menu.

  3. You can follow a similar procedure to delete the related Models and Endpoint configurations.

Clean up

Refer-

  1. https://docs.aws.amazon.com/sagemaker/latest/dg/automatic-model-tuning-ex-cleanup.html
  2. https://docs.aws.amazon.com/sagemaker/latest/dg/realtime-endpoints-delete-resources.html

If the Answer is helpful, please click Accept Answer & UPVOTE, this can be beneficial to other community members.

profile picture
answered 2 years ago
0

@rePost-User-6397876

You can use the following script to find idle instances. You can modify the script to stop the instance if idle for more than 5 minutes or have a cron job to stop the instance.

import boto3

last_modified_threshold = 5 * 60
sm_client = boto3.client('sagemaker')
response = sm_client.list_notebook_instances()

for item in response['NotebookInstances']:
    last_modified_seconds = item['LastModifiedTime'].timestamp()
    last_modified_minutes = last_modified_seconds/60
    print(last_modified_minutes)
    if last_modified_minutes > last_modified_threshold:
        print('Notebook {0} has been idle for more than {1} minutes'.format(item['NotebookInstanceName'], last_modified_threshold/60))
profile picture
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions