Skip to main content

More Info:

SageMaker Notebook Instance is missing active execution roles

Risk Level

High

Address

Security

Compliance Standards

  • APRA CPS 234 (Australia)
  • BSI C5 (Germany)
  • Brazil LGPD
  • CCPA / CPRA (California)
  • CIS Critical Security Controls v8
  • CMMC 2.0
  • CSA Cloud Controls Matrix v4
  • DPDPA
  • Digital Operational Resilience Act (EU)
  • ISO/IEC 27018
  • ISO/IEC 27701
  • MAS Technology Risk Management (Singapore)
  • MITRE ATT&CK (Cloud)
  • NIST SP 800-171
  • NYDFS 23 NYCRR 500
  • SOC2
  • SWIFT Customer Security Controls Framework
  • Sarbanes-Oxley IT General Controls
  • UK NCSC Cyber Assessment Framework

Triage and Remediation

Remediation

Using Console

To remediate “SageMaker Notebook Instance Missing Active Execution Roles” using the AWS Management Console, you either attach an existing IAM role or create/attach a new one.

1. Identify the affected Notebook Instance

  1. Sign in to the AWS Management Console.
  2. Go to Amazon SageMaker.
  3. In the left pane, select Notebook instances.
  4. Find the notebook instance that has the missing execution role issue.

2. Check if a role is currently associated

  1. Click the name of the notebook instance.
  2. In the Details section, look for IAM role:
    • If it says “None” or the role is not valid, you must assign a new/existing role.
Note: If the notebook is InService, you must stop it before changing the role.

3. Stop the notebook instance (if running)

  1. On the notebook instance details page, choose Stop.
  2. Wait until the Status changes to Stopped.

4A. Option 1 – Attach an existing IAM role

Use this if you already have a valid SageMaker execution role.
  1. In the notebook instance details page, choose Edit (or Edit notebook instance).
  2. Under Permissions and encryption (or IAM role section):
    • For IAM role, select Use an existing role.
    • From the dropdown, choose a valid SageMaker execution role (for example, AmazonSageMaker-ExecutionRole-...).
  3. Choose Save changes (or Update notebook instance).
  4. After the update is complete, choose Start to restart the notebook instance.

4B. Option 2 – Create a new IAM execution role and attach it

Use this if no suitable role exists.
  1. In the same Edit notebook instance screen:
    • For IAM role, select Create a new role.
  2. A dialog appears:
    • For S3 buckets you specify:
      • Choose Any S3 bucket (broad access) or
      • Specific S3 buckets (more secure), and list the bucket(s) you need.
    • Click Create role.
  3. SageMaker will create an IAM role (e.g., AmazonSageMaker-ExecutionRole-YYYYMMDDTHHMMSS).
  4. Ensure that role is selected in the IAM role dropdown.
  5. Choose Save changes (or Update notebook instance).
  6. After the update, choose Start to restart the notebook instance.

5. (Optional) Refine the IAM role permissions

If you need to further restrict permissions:
  1. In the AWS console, go to IAM > Roles.
  2. Search for and select the role attached to the notebook instance.
  3. Under Permissions, adjust the attached policies:
    • Ensure at minimum a SageMaker execution policy (e.g., AmazonSageMakerFullAccess or a custom, least-privilege policy for your use case).
    • Ensure required S3, CloudWatch Logs, and other service permissions as needed.

After these steps, the notebook instance will have an active execution role, resolving the “Missing Active Execution Roles” misconfiguration.
To remediate “SageMaker Notebook Instance Missing Active Execution Roles” using AWS CLI, you need to (1) ensure a valid IAM role exists, (2) attach appropriate policies, and (3) associate the role with the notebook instance.Below is a concise step‑by‑step:

1. Identify the Notebook Instance and Its Role

Pick the NotebookInstanceName you care about, then:
Check the RoleArn field:
  • If it’s missing or empty → you must create and attach a role.
  • If present but the role is deleted/disabled/misconfigured → fix that role or create a new one, then reattach.

2. Create an IAM Role for SageMaker (if you don’t have one)

2.1 Create the trust policy JSON (trust-sagemaker.json)
Save as trust-sagemaker.json, then run:
Note the returned Arn, e.g. arn:aws:iam::<ACCOUNT_ID>:role/SageMakerExecutionRole.

3. Attach Required Policies to the Role

Minimum: access to SageMaker and any data sources (S3, etc.). As a quick fix, you can attach AWS-managed policies (adjust to your security requirements later):
Common additions (optional; tighten as needed):
(Prefer custom least‑privilege policies in production.)

4. Stop the Notebook Instance (required before updating role)

Wait until it’s Stopped:
Repeat until it returns "Stopped".

5. Attach/Update the Execution Role on the Notebook

Use the role ARN from step 2:

6. Restart the Notebook Instance

Optionally verify:
You should see ["InService", "arn:aws:iam::<ACCOUNT_ID>:role/SageMakerExecutionRole"].
This clears the “missing active execution role” issue: the notebook is now in service and bound to a valid, policy‑backed IAM execution role.
Here’s how to remediate a SageMaker Notebook Instance with a missing or inactive execution role using Python (boto3).

1. Prerequisites

  • boto3 installed and configured (aws configure)
  • Permissions to manage IAM roles and SageMaker:
    • iam:CreateRole, iam:AttachRolePolicy
    • sagemaker:UpdateNotebookInstance, sagemaker:StartNotebookInstance, sagemaker:DescribeNotebookInstance

2. Create (or Recreate) an Execution Role

Use an IAM role trusted by SageMaker with appropriate policies.
If you already have a role you want to reuse, skip creation and just set role_arn to that role’s ARN.

3. Update the Notebook Instance to Use the Role

You can change the execution role of an existing notebook instance via UpdateNotebookInstance.

4. Start the Notebook Instance Again


5. Optional: Detect Notebooks with Missing/Invalid Roles

To scan for notebooks whose role is missing (IAM role deleted) or blank:
You can then loop over that list and apply the update steps from sections 2–4 to remediate each notebook.