Score:0

AWS ECR Login error

bd flag

AWS ECR Login error: command: aws ecr get-login-password --region ap-south-1 | docker login --username AWS --password-stdin {id}.dkr.ecr.{region}.amazonaws.com

An error occurred (AccessDeniedException) when calling the GetAuthorizationToken operation: User: arn:aws:iam::{id}:{user/username}not authorized to perform: ecr:GetAuthorizationToken on resource: * because no identity-based policy allows the ecr:GetAuthorizationToken action Error: Cannot perform an interactive login from a non TTY device.

If I add * in Resource I am able to Login:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "AllowPullImageTag",
            "Effect": "Allow",
            "Action": [
                "ecr:GetAuthorizationToken",
                "ecr:GetDownloadUrlForLayer",
                "ecr:BatchGetImage",
                "iam:GetAccountAuthorizationDetails"
            ],
            "Resource": [
                "arn:aws:ecr:{region}:{id}:{repository}/{repository}"
            ],
            "Condition": {
                "StringEquals": {
                    "aws:RequestTag/environment": "{taganame}"
                }
            }
        }
    ]
}

I made this policy only for pulling an image for specific user and for specific tag of repository.

Arrow Root avatar
sm flag
Does this work if you declare the resource without the "[ ]"? Like `"Resource": "arn:aws:ecr:{region}:{id}:{repository}/{repository}",`
Arya Aniket avatar
bd flag
I have multiple repositories, and its working. I want to add multiple tag based access control
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.