我正在尝试使用以下 python 代码对存储在 S3 中的批处理数据运行 AWS Translate 作业
role_arn='arn:aws:iam::<account-id>:role/service-role/AmazonTranslateServiceRoleS3FullAccess-ExploreML'
inp_data_path='s3://exploring-ml/aws-translate/assets/input/'
opt_data_path='s3://exploring-ml/aws-translate/assets/output/'
response = translate_client.start_text_translation_job(
JobName='string',
InputDataConfig={
'S3Uri': inp_data_path,
'ContentType': 'text/plain'
},
OutputDataConfig={
'S3Uri': opt_data_path
},
DataAccessRoleArn=role_arn,
SourceLanguageCode='zh',
TargetLanguageCodes=[
'en'
]
)
我可以确认该角色具有完整的 S3 访问权限,但是,在执行上述代码时,出现以下错误
---------------------------------------------------------------------------
InvalidRequestException Traceback (most recent call last)
<ipython-input-11-2bf8de09e0fe> in <module>
11 SourceLanguageCode='zh',
12 TargetLanguageCodes=[
---> 13 'en'
14 ]
15 )
~/.local/share/virtualenvs/exploring-ml-tools-zug9J9gH/lib/python3.6/site-packages/botocore/client.py in _api_call(self, *args, **kwargs)
314 "%s() only accepts keyword arguments." % py_operation_name)
315 # The "self" in this scope is referring to the BaseClient.
--> 316 return self._make_api_call(operation_name, kwargs)
317
318 _api_call.__name__ = str(py_operation_name)
~/.local/share/virtualenvs/exploring-ml-tools-zug9J9gH/lib/python3.6/site-packages/botocore/client.py in _make_api_call(self, operation_name, api_params)
633 error_code = parsed_response.get("Error", {}).get("Code")
634 error_class = self.exceptions.from_code(error_code)
--> 635 raise error_class(parsed_response, operation_name)
636 else:
637 return parsed_response
InvalidRequestException: An error occurred (InvalidRequestException) when calling the StartTextTranslationJob operation: NO_READ_ACCESS_TO_S3: The provided data access role does not have proper access to the input/output S3 URI.
如果我遗漏任何东西,任何指针。同样为澄清起见,这是在提供该服务的爱尔兰运行的。