本文为您介绍JindoSDK访问OSS出现AccessDenied问题的原因和解决方法。
问题详情
Failed test connectivity, operation: getFileStatus, errMsg: [RequestId]: 635B6DDE9A1F093434AC6A7C [HostId]: oss-cn-beijing-internal.aliyuncs.com [ErrorMessage]: [E1010]HTTP/1.1 403 Forbidden: <?xml version="1.0" encoding="UTF-8"?><Error> <Code>AccessDenied</Code> <Message>The bucket you access does not belong to you.</Message> <RequestId>635B6DDE9A1F093434AC6A7C</RequestId> <HostId>xxx.oss-cn-beijing-internal.aliyuncs.com</HostId></Error> [ErrorCode]: 1010 [RequestId]: 635B6DDE9A1F093434AC6A7C
问题原因
RAM用户未被授权相关权限。
解决方法
授权RAM用户相关权限,授权方法请参见通过RAM对OSS进行权限管理。
如果您需要通过Action做精细化控制,可参考如下示例。
- JindoSDK读写OSS
# Bucket级别 oss:ListObjects oss:GetBucketInfo # Object级别 oss:PutObject oss:GetObject oss:DeleteObject oss:AbortMultipartUpload oss:ListParts oss:RestoreObject oss:PutObjectTagging oss:GetObjectTagging oss:DeleteObjectTagging #多版本 oss:ListObjectVersions oss:GetObjectVersion oss:DeleteObjectVersion oss:RestoreObjectVersion oss:PutObjectVersionTagging oss:GetObjectVersionTagging oss:DeleteObjectVersionTagging
- JindoSDK只读OSS
# Bucket级别 oss:ListObjects oss:GetBucketInfo # Object级别 oss:GetObject oss:ListParts oss:RestoreObject oss:GetObjectTagging #多版本 oss:ListObjectVersions oss:GetObjectVersion oss:RestoreObjectVersion oss:GetObjectVersionTagging