Creating an AWS CodeCommit code repository

The AWS CodeCommit service is a managed source control service that hosts secure Git-based repositories on the AWS platform. In this recipe, we will learn how to create our first repository on CodeCommit:

  1. Sign in to your AWS account and open AWS Developer Tools at https://us-west-2.console.aws.amazon.com/codesuite.
  2. From the Developer Tools menu, expand the Source menu and click on Repositories. You can see the complete menu content in the following screenshot:

  1. On the Repositories page, click on the Create repository button to start your code repository on CodeCommit.
  1. Enter a Repository name and click on the Create button. In this example, the repository name is k8sdevopscookbook:

  1. From the AWS Management Console, go to the IAM service.
  2. From the list of existing users, select an IAM user that you would like to use.
  3. On the user summary page, click on the Security credentials tab. The following screenshot shows the location of the tab:

  1. Under HTTPS Git credentials for AWS CodeCommit, click on the Generate button. This will create a username and password that we will use for authentication later:

  1. On the Git credentials generated window, click on the Download credentials button to record your CodeCommit credentials. The following screenshot shows the username and password that was created for me. This is the only chance you will get to view or copy your credentials:

  1. From the AWS Management Console, go to the CodeCommit service.
  2. Under the Clone URL column, select HTTPS. In this recipe, our example repository is located at https://git-codecommit.us-west-2.amazonaws.com/v1/repos/k8sdevopscookbook.
  1. On your Linux workstation, clone the empty repository:
$ git clone <your_new_repo>
  1. Clone the repository using your CodeCommit credentials.
  2. Download our example application and extract it:
$ wget https://github.com/k8sdevopscookbook/python-flask-docker/archive/master.zip && unzip master.zip
  1. Now, copy the example application to your clone of the repository:
$ cp -r python-flask-docker-master/. k8sdevopscookbook/.
$ cd k8sdevopscookbook
  1. Stage all your files. The following command will find all the new and updated files on the project directory and add them to the staging area before it is pushed to the target repository:
$ git add -A
  1. Commit the files with a message. The following command, when used with the -m parameter, adds the commit:
$ git commit -m "Add example application files"
  1. Push the files from your local repository folder to your CodeCommit repository:
$ git push

Now, you will be able to view files in your CodeCommit repository.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.24.180