Use git-remote-codecommit to Clone AWS CodeCommit Repositories without Creating IAM Users
Use git-remote-codecommit to Clone AWS CodeCommit Repositories without Creating IAM Users
Up until March 2020, the only way to connect to AWS CodeCommit repositories was to create an IAM user, generate Git credentials for this user in the IAM console & provide them to Git on your machine. But what if you’re in an environment where no IAM users are involved, such as federated access or single sign-on in AWS Control Tower. This article describes how to use the newly introduced git-remote-codecommit to clone CodeCommit repositories in an AWS Control Tower single sign-on environment.
Prerequisites
You’ll need the following installed on your system to follow this guide:
Python 3+
PIP, the Python package manager
Git
Step 1 — Install git-remote-codecommit
At your terminal, run:
pip install git-remote-codecommit
The installation is complete when you see this:
Successfully built git-remote-codecommit
Step 2 — Configure AWS Profile
Run the following at your terminal to create a user profile:
aws configure
Provide these values when prompted:
AWS Access Key ID [None]:
AWS Secret Access Key [None]:
Default region name [None]:
Default output format [None]:
You’ll find them in the Control Tower single sign-on page as shown below:
Step 3 — Clone Repo
Finally, to clone your CodeCommit repository, run this at your terminal:
git clone codecommit://repo-name local-dir
That uses the default profile. If you named your profile in step 2, run:
Harish KM is a Cloud Evangelist & a Full Stack Engineer at QloudX.
He is very passionate about cloud-native solutions & using the best tools for his projects. With 10+ Cloud & IT certifications, he is an expert in a multitude of application languages & is up to date with all new offerings & services from cloud providers, especially AWS.
Yes, the last argument to the “git clone” command above is the local directory where you want the Git repo cloned. You can change this to any path on your machine where the repository will be stored.
Qloudx takes your privacy and security seriously. We use cookies on this site to provide you with the best experience. By closing this banner, scrolling this page, clicking a link or continuing to browse, you agree to the use of cookies. To know more, please feel free to view our Global Privacy Policy. ACCEPT
Privacy & Cookies Policy
Privacy Overview
This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are as essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
hi, is there any way to specify the location of the stored repo locally?
Yes, the last argument to the “git clone” command above is the local directory where you want the Git repo cloned. You can change this to any path on your machine where the repository will be stored.