Search code examples
aws-codecommit

Is is possible to generate static Git credentials for HTTPS connection to AWS CodeCommit using only the CLI and not the AWS Console?


I want to generate a git username/password for CodeCommit, I see how to do that from the AWS Web Console , but is there a way to do it via the aws cli?


Solution

  • You can use aws iam create-service-specific-credential, documented here

     aws iam create-service-specific-credential --service-name codecommit.amazonaws.com --user-name xxxxxx
    {
        "ServiceSpecificCredential": {
            "CreateDate": "2022-10-28T12:19:19+00:00",
            "ServiceName": "codecommit.amazonaws.com",
            "ServiceUserName": "xxxxxx-at-yyyyyyyyyyyy",
            "ServicePassword": "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ",
            "ServiceSpecificCredentialId": "LLLLLLLLLLLLLLLLLLLLL",
            "UserName": "xxxxxx",
            "Status": "Active"
        }
    }
    
    

    The ServiceUserName can be used as git user and ServicePassword can be used as git password.