I am running the k-means example in SageMaker:
from sagemaker import KMeans
data_location = 's3://{}/kmeans_highlevel_example/data'.format(bucket)
output_location = 's3://{}/kmeans_example/output'.format(bucket)
kmeans = KMeans(role=role, train_instance_count=2,
train_instance_type='ml.c4.8xlarge',
output_path=output_location,
k=10, data_location=data_location)
. When I run this line, it appears access denied error.
%%time
kmeans.fit(kmeans.record_set(train_set[0]))
The error returns: ClientError: An error occurred (AccessDenied) when calling the PutObject operation: Access Denied
I also read other questions, but their answers do not solve my problem. Would you please look at my case?
答案 0 :(得分:3)
为了能够在SageMaker中培训工作,您需要传入 AWS IAM角色,允许SageMaker访问您的S3存储桶。
该错误表示SageMaker无权在您指定的存储桶中写入文件。
您可以在此处找到您需要添加到角色的权限https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-roles.html#sagemaker-roles-createtrainingjob-perms
答案 1 :(得分:1)
要考虑的另一件事,如果您使用的加密存储桶需要kms解密,请确保还包括kms相关权限
我注意到有时显示的错误为PutObject operation: Access Denied
,而故障实际上与KMS有关。
答案 2 :(得分:1)