当用户需要使用自定义 OSS bucket 时,需要为账号添加 RAM 角色,并为该 RAM 角色授予对 OSS bucket 操作的权限,然后容器镜像服务才能正常访问该 OSS bucket。
容器镜像服务访问自定义 OSS bucket 时,需要为阿里云账号创建的角色名为 AliyunContainerRegistryCustomizedOSSBucketRole。
说明 若选择其他云账号,需要填写其他云账号的ID。
配置该 RAM 角色的策略,使其拥有对指定的 OSS bucket 资源读取容器镜像仓库信息的权限,RAM 角色的权限策略名为 AliyunContainerRegistryCustomizedOSSBucketRolePolicy。当需要获取多个自定义 OSS bucket 信息时,可向 Resource 中添加多个 OSS bucket 值。
{
"Version": "1",
"Statement": [
{
"Action": [
"oss:GetObject",
"oss:PutObject",
"oss:DeleteObject",
"oss:ListParts",
"oss:AbortMultipartUpload",
"oss:InitiateMultipartUpload",
"oss:CompleteMultipartUpload",
"oss:DeleteMultipleObjects",
"oss:ListMultipartUploads",
"oss:ListObjects"
],
"Resource": [
"acs:oss:*:*:",
"acs:oss:*:*:/*"
],
"Effect": "Allow",
"Condition": {
}
},
{
"Action": [
"oss:PutBucket",
"oss:GetBucket",
"oss:GetBucketLocation",
"oss:PutBucketEncryption",
"oss:GetBucketEncryption",
"oss:PutBucketAcl",
"oss:GetBucketAcl",
"oss:PutBucketLogging",
"oss:GetBucketReferer",
"oss:PutBucketReferer",
"oss:GetBucketLogging"
],
"Resource": [
"acs:oss:*:*:",
"acs:oss:*:*:/*"
],
"Effect": "Allow",
"Condition": {
}
},
{
"Effect": "Allow",
"Action": "oss:ListBuckets",
"Resource": [
"acs:oss:*:*:*",
"acs:oss:*:*:*/*"
],
"Condition": {
}
},
{
"Action": [
"vpc:DescribeVpcs"
],
"Resource": "acs:vpc:*:*:vpc/*",
"Effect": "Allow",
"Condition": {
}
},
{
"Action": [
"cms:QueryMetricLast",
"cms:QueryMetricList"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
为该 RAM 角色的信任策略中添加容器镜像服务,使容器镜像服务可以访问用户自定义的 OSS bucket。
{
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": [
"cr.aliyuncs.com"
]
}
}
],
"Version": "1"
}