【发布时间】:2021-06-19 16:25:03
【问题描述】:
我是一个尝试使用 Textract 的 AWS 新手。 现在我在 S3Bucket 中有一个文件,我正在尝试通过 API 处理它。我正在使用以下代码(我在 Python 中运行它):
# Document
s3BucketName = "textract-console-us-east-1-057eddde-3f44-45c5-9208-fec27f9f6420"
documentName = "ok0001_prioridade01.pdf"
# Amazon Textract client
textract = boto3.client('textract',region_name="us-east-1",aws_access_key_id="xxxx",
aws_secret_access_key="xxxx")
# Call Amazon Textract
response = textract.analyze_document(
Document={
'S3Object': {
'Bucket': s3BucketName,
'Name': documentName
}
},
FeatureTypes=["TABLES"])
我收到此错误:
botocore.errorfactory.InvalidS3ObjectException: An error occurred (InvalidS3ObjectException) when calling the AnalyzeDocument operation: Unable to get object metadata from S3. Check object key, region and/or access permissions.
然后,当我登录控制台时,我访问了存储桶和文件,当我尝试访问上述链接中的文件时,我进入了这个 xml 错误页面。
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>xxxx</RequestId>
<HostId>xxxxxxxxxxxxxx</HostId>
</Error>
所以我想知道为什么我的访问被拒绝了。我重新登录 IAM 看看我是否搞砸了,但是权限已应用于我的用户:
我错过了什么?为什么我无法通过控制台(因此也无法通过 API)访问该文件?
【问题讨论】:
标签: amazon-web-services amazon-s3 amazon-textract