AWS codebuild: ECR Error Cannot perform an interactive login from a non TTY device
While working on one of the pipeline on AWS, i got following error and my build was failing.
Error:
ubuntu@ip-176-32-0-140:~$ aws ecr get-login-password --region us-   
east-1 | docker login --username AWS --password-stdin 
<account ID>.dkr.ecr.us-west-2.amazonaws.com/gatling-lots
usage: aws [options] <command> <subcommand> [<subcommand> ...]      
[parameters]
 To see help text, you can run:
aws help
aws <command> help
aws <command> <subcommand> help
aws: error: argument operation: Invalid choice, valid choices are:
 batch-check-layer-availability           | batch-delete-image                      
 batch-get-image                          | complete-layer-upload                   
create-repository                        | delete-lifecycle-policy                 
delete-repository                        | delete-repository-policy                
 describe-images                          | describe-repositories                   
 get-authorization-token                  | get-download-url-for-layer              
 get-lifecycle-policy                     | get-lifecycle-policy-preview            
 get-repository-policy                    | initiate-layer-upload                   
 list-images                              | put-image                               
 put-lifecycle-policy                     | set-repository-policy                   
 start-lifecycle-policy-preview           | upload-layer-part                       
 get-login                                | help                                    
 Error: Cannot perform an interactive login from a non TTY deviceSolution:
I figured out the issue after few iterations. We need to have a latest build Enviorment image for our Codebuild project to get it working. You can set that up using following procedure:
In Environment, for Environment image, leave Managed image selected.
For Operating system, choose Amazon Linux 2.
For Runtime(s), choose Standard.
For Image, choose aws/codebuild/amazonlinux2-x86_64-standard:5.0.
| AWS_codebuild_Env_5_0 | 
No comments