MLS-C01 · Question #174
A data scientist is using an Amazon SageMaker notebook instance and needs to securely access data stored in a specific Amazon S3 bucket. How should the data scientist accomplish this?
The correct answer is C. Attach the policy to the IAM role associated with the notebook that allows GetObject, PutObject. To securely access data in an Amazon S3 bucket from an Amazon SageMaker notebook instance, the most secure and recommended method is to attach an IAM policy with the necessary S3 permissions (GetObject, PutObject, ListBucket) directly to the IAM role associated with the…
Question
A data scientist is using an Amazon SageMaker notebook instance and needs to securely access data stored in a specific Amazon S3 bucket. How should the data scientist accomplish this?
Options
- AAdd an S3 bucket policy allowing GetObject, PutObject, and ListBucket permissions to the
- BEncrypt the objects in the S3 bucket with a custom AWS Key Management Service (AWS KMS)
- CAttach the policy to the IAM role associated with the notebook that allows GetObject, PutObject,
- DUse a script in a lifecycle configuration to configure the AWS CLI on the instance with an access
How the community answered
(19 responses)- B5% (1)
- C95% (18)
Why each option
To securely access data in an Amazon S3 bucket from an Amazon SageMaker notebook instance, the most secure and recommended method is to attach an IAM policy with the necessary S3 permissions (GetObject, PutObject, ListBucket) directly to the IAM role associated with the SageMaker notebook instance. This leverages AWS Identity and Access Management (IAM) for granular, role-based access control.
While an S3 bucket policy can grant access, it's generally best practice for AWS services to access S3 using their associated IAM roles, making the IAM role policy the more appropriate and manageable place to define permissions for a SageMaker notebook instance.
Encrypting objects in an S3 bucket with a custom AWS KMS key protects data at rest but does not, by itself, grant the SageMaker notebook instance permission to access (read, write) those objects; access control is handled by IAM policies.
Attaching an IAM policy with the required S3 permissions (GetObject, PutObject, ListBucket) to the IAM role associated with the Amazon SageMaker notebook instance is the standard, secure, and recommended method for granting the instance access to S3 data. This approach leverages AWS IAM for fine-grained authorization without exposing explicit credentials.
Using a lifecycle configuration script to configure the AWS CLI with explicit access keys or even temporary tokens is less secure and less manageable than relying on the inherent IAM role attached to the notebook instance, which automatically provides temporary credentials.
Concept tested: Secure S3 access from SageMaker via IAM roles
Source: https://docs.aws.amazon.com/sagemaker/latest/dg/security-iam-roles.html
Topics
Community Discussion
No community discussion yet for this question.