我现在拥有一个私有 ECR 存储库和一个 EC2 实例。如果我想从本地计算机中的私有 ECR 中提取映像,我必须使用 aws configure 设置我的 AWS 凭证并执行 docker 登录。
现在,我想从 EC2 实例中提取映像。当我尝试直接运行 docker 命令时,它告诉我首先进行身份验证。是否可以将 IAM 角色附加到我的 EC2 实例并跳过 docker 登录或 aws ecr 登录工作流程?
目前,我只能在 EC2 实例内运行 aws configure,并且似乎需要一个额外的 IAM 用户,我试图避免这种情况。
使用以下 yaml 时出现错误。我检查了代码,但我不认为有任何问题。我的结构计划有一个带有 2 个公有子网和 2 个私有子网的 VPC。一个Web服务器实例将放置在公共子网2中。我认为该问题可能与实例创建有关,因为该错误是在实例创建过程中出现的。
Parameters:
EnvironmentName:
Description: An environment name that is prefixed to resource names
Type: String
KeyName:
Description: Name of an existing EC2 KeyPair to enable SSH access to the instances
Type: AWS::EC2::KeyPair::KeyName
ConstraintDescription: must be the name of an existing EC2 KeyPair.
SSHLocation:
Description: The IP address range that can be used to SSH to the EC2 instances
Type: String
MinLength: '9'
MaxLength: '18'
Default: 0.0.0.0/0
AllowedPattern: "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})"
ConstraintDescription: must be a valid …Run Code Online (Sandbox Code Playgroud)