A data scientist needs to restrict access to a specific Amazon SageMaker notebook instance so that only a designated IAM role can invoke the CreatePresignedNotebookInstanceUrl API. Which IAM policy element should be used to achieve this?
Trap 1: Modify the trust policy of the IAM role
Trust policies are used for cross-account access, not for restricting API calls to a specific role within the same account.
Trap 2: Place the notebook instance in a private VPC subnet
Placing the notebook in a private VPC subnet controls network access but does not restrict which IAM role can invoke the API.
Trap 3: Use a resource-based policy on the notebook instance
Incorrect. Amazon SageMaker notebook instances do not support resource-based policies.
- A
Modify the trust policy of the IAM role
Why wrong: Trust policies are used for cross-account access, not for restricting API calls to a specific role within the same account.
- B
Place the notebook instance in a private VPC subnet
Why wrong: Placing the notebook in a private VPC subnet controls network access but does not restrict which IAM role can invoke the API.
- C
Add a Condition block in the IAM policy attached to the user's role
Correct. An identity-based policy with a Condition block on the resource ARN restricts the API to a specific notebook instance.
- D
Use a resource-based policy on the notebook instance
Why wrong: Incorrect. Amazon SageMaker notebook instances do not support resource-based policies.