Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IAM blocks access to AWS CodeCommit repo

I set up SSH access to CodeCommit and tested the connection:

You have successfully authenticated over SSH. You can use Git to interact with AWS CodeCommit. Interactive shells are not supported.Connection to git-codecommit.us-east-1.amazonaws.com closed by remote host.

When I attempt to clone or push, I see this error:

Access denied: User: arn:aws:iam::##########:user/[email protected] is not authorized to perform: codecommit:GitPull on resource: arn:aws:codecommit:us-east-1:##########:my-repo

Even after adding a policy to my user to access all operations on this repo, I cannot clone or push.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "codecommit:*"
            ],
            "Resource": [
                "arn:aws:codecommit:us-east-1:##########:my-repo"
            ]
        }
    ]
}

What gives? Is anyone else having trouble with this?

like image 626
Dan Kowalczyk Avatar asked Nov 01 '25 11:11

Dan Kowalczyk


2 Answers

In my case I had a policy that attempted to require MFA login for most things other than setting up MFA in AWS. I ended up adding codecommit as an exemption to the MFA required policy so I didn't have to do anything extra in our developer's environments to handle MFA login for git access to codecommit.

like image 91
Rob Avatar answered Nov 04 '25 00:11

Rob


A few things could cause this:

  1. If there are any group permissions denying access to CodeCommit

  2. If you are using multi factor authentication, that will not work with SSH (http://docs.aws.amazon.com/codecommit/latest/userguide/temporary-access.html)

  3. An IAM policy denying access to KMS

If you post this on the AWS forums, we can use your account ID to help you troubleshoot your issue.

like image 36
Zachary Howard Avatar answered Nov 04 '25 00:11

Zachary Howard



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!