Pages

Saturday, September 1, 2018

Aws Component - CodeCommit

AWS CodeCommit is a source code storage and version-control service for Amazon Web Services' public cloud customers. CodeCommit was designed to help IT teams collaborate on software development, including continuous integration and application delivery.

In this article , we will see how we can use codeCommit and see how our source code and other artifacts can be securely stored in the repository. This can be otherwise taught as Private git repository.

Login to the Aws Console
Search for CodeCommit
Next click on the “Get Started” which will take you to the Repo Creation page like below,
Once we have created the repo and have given all the details, it shows us how to connect to the git.

Copy the link that is used to connect to the git from local machine. My link is

The page gives you instructions on how to connect to this private repository using both Https and Ssh.

IAM Users - Users have to be created for the team members so that they can be part of pushing and pulling the code. We can also provide access for IDE level so that developer can push code directly from the IDE. This defines the security for the repository.

Look for the IAM service. Go to Users and create a User as below,

In this we are creating “demo-repo-user” with programmatic access.

In the next page for permissions, choose “attach existing policies directly” and on the filter policies section look for “AWSCodeCommitFullAccess” and choose that.

Once we review the things, create user. In the next section it will give you the Credentials details. We need to make sure to save these coz we will be using these for multiple services.

Once the user is created, click the user and go to “security credentials” tab. At the bottom you will see “HTTPS Git credentials for AWS CodeCommit”. Click Generate credentials under this.

Once we click the generate, it will create credentials and shows them.Save them for future use.

Now from your local machine ,we can do the below
aws-sample$ git clone https://git-codecommit.us-west-2.amazonaws.com/v1/repos/demo-testing-repo
Cloning into 'demo-testing-repo'...
Username for 'https://git-codecommit.us-west-2.amazonaws.com': demo-repo-user-at-416227743233
Password for 'https://demo-repo-user-at-416227743233@git-codecommit.us-west-2.amazonaws.com':
warning: You appear to have cloned an empty repository.

Enter the user name and password that are generated from the security tab for the IAM user that we created.

demo-testing-repo$ ls -alrt
total 0
drwxr-xr-x   3 jagadish admin   96 Aug 4 19:16 ..
drwxr-xr-x   3 jagadish admin   96 Aug 4 19:16 .
drwxr-xr-x  10 jagadish admin  320 Aug 4 19:17 .git
demo-testing-repo$ touch helloworld
demo-testing-repo$ git add .
demo-testing-repo$ git commit -m "first demo commit"

*** Please tell me who you are.

Run

 git config --global user.email "you@example.com"
 git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'jagadish@jagadishs-Air.(none)')
demo-testing-repo$ git config --global user.name "demo-user"
demo-testing-repo$ git config --global user.email "demo@gmail.com"
demo-testing-repo$ git commit -m "first demo commit"
[master (root-commit) 520c8cb] first demo commit
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 helloworld
demo-testing-repo$ git push origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 209 bytes | 209.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://git-codecommit.us-west-2.amazonaws.com/v1/repos/demo-testing-repo
* [new branch]      master -> master

Now go the CodeCommit and to you repo and see if the new files are available

This is how we can use the Aws codeCommit to push code from our local to the private git repo hosted by Aws. More to Come, Happy Learning :-)

4 comments :

  1. Very ցood blog post. I certainly love this site.
    Thanks!
    my blog : Best Six Tips For Encryption Software & Six Ways
    To How To Encrypt A Ⲣassword For Free In Six Days

    ReplyDelete
  2. Good site you have got here.. It's hard to find high-quality writing like yours
    these days. I seriously appreciate individuals like you!
    Take care!!

    ReplyDelete
  3. Good day! I could have sworn I've been to this web site before
    but after browsing through some of the posts I realized it's new to me.

    Nonetheless, I'm definitely pleased I came across it and I'll be bookmarking
    it and checking back frequently!

    ReplyDelete
  4. Excellent post. Keep writing such kind of information on your page.
    Im really impressed by it.
    Hello there, You've performed a great job. I will
    definitely digg it and in my opinion suggest to my
    friends. I'm confident they will be benefited from this site.

    ReplyDelete