Great code search for AWS CodeCommit
Install Sourcegraph to get great code search on AWS CodeCommit
Sourcegraph brings great code search and understanding abilities to development teams using AWS CodeCommit. Code search helps your engineering team find usage examples, debug errors, reuse existing libraries and packages, and understand unfamiliar parts of your code base more quickly. Learn more about Sourcegraph code search.
Setting up Sourcegraph code search to work with AWS CodeCommit is quick and easy.
- First, install and run an instance of Sourcegraph.
- Create a AWS IAM user with programmatic access.
- Attach the permission
AWSCodeCommitReadOnly
to this user.
- Create a SSH key pair:
- Add the public key to the IAM user (under the "Security credentials" tab). After it is uploaded, make a note of its SSH key ID.
- Modify your
config.json
(which you created as part of installing Sourcegraph) to access your AWS CodeCommit repositories. You'll need to make two changes:
a. Set the gitOriginMap
field to include a mapping of the form aws/!ssh://${YOUR_SSH_KEY_ID}@${YOUR_SSH_CLONE_URL_PREFIX}/%
. Substitute the SSH key ID associated with the SSH key you added and the SSH clone URL prefix, which you can obtain by viewing the SSH clone URL of any of your repositories. It should look something like this:
b. Copy the private SSH key to a file called id_rsa
in the directory that contains your config.json
. Then add the following entry:
- Update your Sourcegraph instance to reflect the changes you made to your
config.json
by runningsourcegraph-server-gen config.json ./helm-chart && helm upgrade sourcegraph ./helm-chart
. - Add your AWS CodeCommit repositories by navigating to
https://${YOUR_SOURCEGRAPH_URL}/aws/${REPO_NAME}
.
And that's it! Now you can search over all your AWS CodeCommit repositories at once or configure a search group that lets you and your team search over a targeted subset of repositories. You can also configure Sourcegraph to work with a variety of Enterprise SSO identity providers and additional code hosts. You can read more about customizations in the Sourcegraph administrator docs.
Install a self-hosted Sourcegraph instance with 1 command.
About the author
Beyang Liu is the CTO and co-founder of Sourcegraph. Beyang studied Computer Science at Stanford, where he published research in probabilistic graphical models and computer vision at the Stanford AI Lab. You can chat with Beyang on Twitter @beyang or our community Discord.