Amazon web services 使用AWS CLI将AmazonEC2ContainerRegistryReadOnly托管策略添加到角色

Amazon web services 使用AWS CLI将AmazonEC2ContainerRegistryReadOnly托管策略添加到角色,amazon-web-services,amazon-elastic-beanstalk,amazon-iam,aws-cli,Amazon Web Services,Amazon Elastic Beanstalk,Amazon Iam,Aws Cli,我想将托管策略AmazonEC2ContainerRegistryReadOnly添加到beanstalk创建的角色aws-elasticbeanstalk-ec2-role 根据文件,这应该是正确的方法 EXAMPLES To attach a managed policy to an IAM role The following attach-role-policy command attaches the AWS managed pol- ic

我想将托管策略AmazonEC2ContainerRegistryReadOnly添加到beanstalk创建的角色aws-elasticbeanstalk-ec2-role

根据文件,这应该是正确的方法

EXAMPLES
       To attach a managed policy to an IAM role

       The  following attach-role-policy command attaches the AWS managed pol-
       icy named ReadOnlyAccess to the IAM role named ReadOnlyRole:

          aws iam attach-role-policy --policy-arn arn:aws:iam::aws:policy/ReadOnlyAccess --role-name ReadOnlyRole
尝试:

aws iam attach-role-policy --policy-arn arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly --role-name aws-elasticbeanstalk-ec2-role
问题:

aws iam attach-role-policy --policy-arn arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly --role-name aws-elasticbeanstalk-ec2-role
我得到一个黑色的终端屏幕,没有输出和一个(结束)写

问题:

aws iam attach-role-policy --policy-arn arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly --role-name aws-elasticbeanstalk-ec2-role

要将托管策略AmazonEC2ContainerRegistryReadOnly添加到默认的aws-elasticbeanstalk-ec2-role角色中,我必须做些什么?它的工作方式与上面所示的完全相同。我只是在通过api列出策略时犯了一个错误,所以我看不到它。也许上述说明对任何人都有帮助