更新时间:2025-11-04 GMT+08:00
分享

VPC终端节点策略

SWR基础版可以通过VPC终端节点上传下载镜像,VPC终端节点支持配置策略,可以配置策略管控镜像的上传或者下载。创建VPC终端节点步骤请参见通过VPCEP方式访问SWR。配置VPC终端节点策略步骤请参见管理终端节点的策略

配置示例1:配置VPC终端节点策略,只允许上传下载指定的镜像。

下面策略的含义:VPC1内的服务器只能上传下载SWR中组织为test-namespace、镜像仓库为test-repo下的镜像。

{
  "Version": "5.0",
  "Statement": [
    {
      "Action": [
        "swr:repo:upload",
        "swr:repo:download"
      ],
      "Resource": [
        "swr:*:*:repo:test-namespace/test-repo"
      ],
      "Effect": "Allow",
      "Principal": "*"
    }
  ]
}

配置示例2:配置VPC终端节点策略,只允许下载指定的私有镜像,可以下载所有的公开镜像。

下面策略的含义:VPC1内的服务器只能下载SWR中组织为test-namespace、镜像仓库为test-repo,公开镜像不受限制。

{
  "Version": "5.0",
  "Statement": [
    {
      "Action": [
        "swr:repo:download"
      ],
      "Resource": [
        "swr:*:*:repo:test-namespace/test-repo"
      ],
      "Effect": "Allow",
      "Principal": "*"
    },
    {
      "Action": [
        "swr:repo:download"
      ],
      "Resource": [
        "*"
      ],
      "Effect": "Allow",
      "Principal": "*",
      "Condition": {
        "Bool": {
          "swr:RepositoryIsPublic": [
            "true"
          ]
        }
      }
    }
  ]
}

相关文档