栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

AWS不同主体账号互通ECR镜像仓库

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

AWS不同主体账号互通ECR镜像仓库

ECR是AWS是镜像仓库产品。

不同主体账号的ECR是不能相登录的,当需要部署同一个镜像的时候就很麻烦,可以配置密钥登录。

创建akck

IAM---》创建用户--》点进用户--》安全证书--》创建访问密钥

aws configure

测试的服务器是A主体账号下的,先配置A账号的akck:

[root@ip-xxx ~]# aws configure     # 不指定用户会设置成默认用户,会被覆盖
AWS Access Key ID [None]: AKIAYCxxxxx
AWS Secret Access Key [None]: W6VQ4g9xxxxx
Default region name [None]: cn-northwest-1      # 所用的aws区域
Default output format [json]: json       # 用的默认json

再配置B账号的akck:

[root@ip-xxxx ~]# aws configure --profile Btest  # 用 --profile 指定用户
AWS Access Key ID [None]: AKIASMxxxxx
AWS Secret Access Key [None]: ExDBEW1kZUwsxxxxx
Default region name [None]: cn-northwest-1
Default output format [None]: json

查看aws configure,会是默认用户akck信息,如果再次aws configuer,这里会被覆盖

[root@ip-xxxx ~]# aws configure list
      Name                    Value             Type    Location
      ----                    -----             ----    --------
   profile                             None    None
access_key     ****************NF3I shared-credentials-file    
secret_key     ****************3gi1 shared-credentials-file    
    region           cn-northwest-1      config-file    ~/.aws/config

用--profile指定用户

[root@ip-xxxx ~]# aws configure list --profile Btest
      Name                    Value             Type    Location
      ----                    -----             ----    --------
   profile                szeastroc           manual    --profile
access_key     ****************ZCHK shared-credentials-file    
secret_key     ****************S771 shared-credentials-file    
    region           cn-northwest-1      config-file    ~/.aws/config
登录ECR

登录本账号主体不需要--profile

aws ecr get-login-password --region cn-northwest-1 | docker login --username AWS --password-stdin 55xxxxxx.dkr.ecr.cn-northwest-1.amazonaws.com.cn

A账号主体服务器指定使用B账号的akck登录B账号的ECR,需要使用--profile切换用户

aws ecr get-login-password --profile Btest --region cn-northwest-1 | docker login --username AWS --password-stdin 1x3xxxxx.dkr.ecr.cn-northwest-1.amazonaws.com.cn

拉取镜像
docker pull 163xxx.dkr.ecr.cn-northwest-1.amazonaws.com.cn/xxx:1

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/828650.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号