Настройка ClientError в aws

#python #amazon-web-services

Вопрос:

Не могу работать из-за клиентеррора, не уверен, что это из-за того, что я неправильно его настроил
, надеюсь, кто-нибудь сможет указать, какой из моих шагов, кроме. Все это от sagemaker в aws.

 import sagemaker from sagemaker import get_execution_role from sagemaker.session import Session from sagemaker import KMeans sagemaker.Session(boto3.session.Session()) import boto3 import os import mxnet as mx from random import randint   sagemaker_session = sagemaker.Session() role = 'final' bucket_name = 'mlmovieinfofiles' data_location = 'C:\Users\XIONGFENG\Desktop'.format(bucket_name) output_location = 'C:\Users\XIONGFENG\Desktop'.format(bucket_name)  print('training data will be uploaded to: {}'.format(data_location)) print('training artifacts will be uploaded to: {}'.format(output_location))  #defining the hyperparameters of Kmeans model and specifying 10 clusters to be identified num_clusters = 10 kmeans = KMeans(role=role,  instance_count=1,  instance_type='ml.m5.xlarge',  output_path=output_location,   k=num_clusters,  data_path=data_location)  

Ошибка показана ниже

 ClientError Traceback (most recent call last)  lt;ipython-input-109-2011f77ec8cfgt; in lt;modulegt;  21 #defining the hyperparameters of Kmeans model and specifying 10 clusters to be identified  22 num_clusters = 10  ---gt; 23 kmeans = KMeans(role=role,  24 instance_count=1,  25 instance_type='ml.m5.xlarge',    ~anaconda3libsite-packagessagemakeramazonkmeans.py in __init__(self, role, instance_count, instance_type, k, init_method, max_iterations, tol, num_trials, local_init_method, half_life_time_size, epochs, center_factor, eval_metrics, **kwargs)  149 :class:`~sagemaker.estimator.EstimatorBase`.  150 """  --gt; 151 super(KMeans, self).__init__(role, instance_count, instance_type, **kwargs)  152 self.k = k  153 self.init_method = init_method    ~anaconda3libsite-packagessagemakeramazonamazon_estimator.py in __init__(self, role, instance_count, instance_type, data_location, enable_network_isolation, **kwargs)  89 )  90 data_location = data_location or "s3://{}/sagemaker-record-sets/".format(  ---gt; 91 self.sagemaker_session.default_bucket()  92 )  93 self._data_location = data_location    ~anaconda3libsite-packagessagemakersession.py in default_bucket(self)  377 default_bucket = "sagemaker-{}-{}".format(region, account)  378   --gt; 379 self._create_s3_bucket_if_it_does_not_exist(bucket_name=default_bucket, region=region)  380   381 self._default_bucket = default_bucket    ~anaconda3libsite-packagessagemakersession.py in _create_s3_bucket_if_it_does_not_exist(self, bucket_name, region)  410 # 'us-east-1' cannot be specified because it is the default region:  411 # https://github.com/boto/boto3/issues/125  --gt; 412 s3.create_bucket(Bucket=bucket_name)  413 else:  414 s3.create_bucket(    ~anaconda3libsite-packagesboto3resourcesfactory.py in do_action(self, *args, **kwargs)  518 # instance via ``self``.  519 def do_action(self, *args, **kwargs):  --gt; 520 response = action(self, *args, **kwargs)  521   522 if hasattr(self, 'load'):    ~anaconda3libsite-packagesboto3resourcesaction.py in __call__(self, parent, *args, **kwargs)  81 operation_name, params)  82   ---gt; 83 response = getattr(parent.meta.client, operation_name)(*args, **params)  84   85 logger.debug('Response: %r', response)    ~anaconda3libsite-packagesbotocoreclient.py in _api_call(self, *args, **kwargs)  389 "%s() only accepts keyword arguments." % py_operation_name)  390 # The "self" in this scope is referring to the BaseClient.  --gt; 391 return self._make_api_call(operation_name, kwargs)  392   393 _api_call.__name__ = str(py_operation_name)    ~anaconda3libsite-packagesbotocoreclient.py in _make_api_call(self, operation_name, api_params)  717 error_code = parsed_response.get("Error", {}).get("Code")  718 error_class = self.exceptions.from_code(error_code)  --gt; 719 raise error_class(parsed_response, operation_name)  720 else:  721 return parsed_response    ClientError: An error occurred (AccessDenied) when calling the CreateBucket operation: Access Denied  

Комментарии:

1. Ошибка гласит «Доступ запрещен»? Как именно вы предоставили своему экземпляру разрешения s3?