Michael Leiss
Michael Leiss

Reputation: 5670

Add AmazonEC2ContainerRegistryReadOnly managed policy to role using AWS CLI

I want to add the managed policy AmazonEC2ContainerRegistryReadOnly to a beanstalk created role aws-elasticbeanstalk-ec2-role

According to the documentation this should be the right way

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

Attempt:

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

Problem:

I get a black terminal screen, no output and a (END) written.

Question:

What do I have to do to add that managed policy AmazonEC2ContainerRegistryReadOnly to the default aws-elasticbeanstalk-ec2-role Role

Upvotes: 1

Views: 1309

Answers (1)

Michael Leiss
Michael Leiss

Reputation: 5670

It works exactly the way shown above. I just made a mistake listing the policies via api, so I could not see it. Maybe the above instruction is helpful to anyone.

Upvotes: 1

Related Questions