Menu
AWS CodeCommit
User Guide (API Version 2015-04-13)

Getting Started with AWS CodeCommit Tutorial

If you're new to AWS CodeCommit, this tutorial helps you learn how to use its features. In this tutorial, you create a repository in AWS CodeCommit. After you create a local copy of that repository (a local repo) and push some changes to the AWS CodeCommit repository, you will browse the files you pushed and view the changes. You can also create a trigger for your repository. This trigger responds to events in your repository by sending a notification from an Amazon Simple Notification Service (Amazon SNS) topic.

If you are not familiar with Git, you might want to complete the Git with AWS CodeCommit Tutorial in addition to this tutorial. After you finish this tutorial, you should have enough practice to start using AWS CodeCommit for your own projects and in team environments.

Important

Before you begin this tutorial, you must complete the prerequisites and setup, including:

  • Assigning permissions to the IAM user.

  • Setting up credential management for HTTPS or SSH connections on the local machine you use for this tutorial.

  • Configuring the AWS CLI if you want to use the command line or terminal for all operations, including creating the repository.

Step 1: Create an AWS CodeCommit Repository

In this step, you use the AWS CodeCommit console to create the AWS CodeCommit repository. If you already have a repository you want to use for this tutorial, you can skip this step.

Note

Depending on your usage, you might be charged for creating or accessing a repository. For more information, see Pricing on the AWS CodeCommit product information page.

To create the AWS CodeCommit repository (console)

  1. Open the AWS CodeCommit console at https://console.aws.amazon.com/codecommit.

  2. In the region selector, choose the region where you will create the repository. For more information, see Regions and Git Connection Endpoints.

  3. On the Welcome page, choose Get Started Now. (If a Dashboard page appears instead, choose Create repository.)

  4. On the Create repository page, in the Repository name box, type MyDemoRepo.

  5. In the Description box, type My demonstration repository.

  6. Choose Create repository to create an empty AWS CodeCommit repository named MyDemoRepo.


              Creating a repository from the console

Note

If you use a name other than MyDemoRepo for your repository, be sure to use it in the remaining steps of this tutorial.

Now that you have an AWS CodeCommit repository, from your local computer, create a local repo by cloning the empty AWS CodeCommit repository. Add some files to the local repo and push them to the AWS CodeCommit repository. If you are not sure how to do this, follow the steps in Step 2: Create a Local Repo or Connect to a Repository.

After you have added some files to the AWS CodeCommit repository, you can view them from the console.

Step 2: Browse the Contents of Your Repository

In this step, you browse the contents of your repository. You can use the AWS CodeCommit console to review the files in a repository or to quickly read the contents of a file. This can help you determine which branch to check out or whether to create a local copy of a repository.

  1. From the AWS CodeCommit console, choose MyDemoRepo from the list of repositories.

  2. The contents of the repository are displayed in the default branch for your repository. To change the view to another branch, choose the view selector button (here the view is set to Branch: master), and then choose the branch you want to view from the list.

    
                  Browse the contents of a repository
  3. To view the contents of a file in your repository, choose the file from the list.

    
                  View the contents of a file

For more information, see Browse the Contents of a Repository.

You can also browse the commit history of a repository. This can help you identify changes made in a repository, including when and by whom those changes were made.

  1. In the navigation pane for a repository, choose Commits. In the commit history view, a history of commits for the repository in the default branch is displayed, in reverse chronological order.

    
                      The commit history view in the console
  2. Review the commit history by branch or by tag, and get details about commits by author, date, and more.

  3. To view the differences between a commit and its parent, choose the abbreviated commit ID. Changes are displayed. You can choose how the changes are displayed, including showing or hiding whitespace changes, and whether to view changes inline (Unified view) or side by side (Split view).

    Note

    If you are signed in as an IAM user, you can configure and save your preferences for viewing code and other console settings. For more information, see Working with User Preferences.

    
                        Changes shown in Split view, with white space
                            changes visible
  4. To view the differences between any two commits specifiers, including tags, branches, and commit IDs, in the navigation pane, choose Compare.

    
                        Comparing a commit to the tip of the master branch in Unified
                            view

    For more information, see Browse the Commit History of a Repository and Compare Commits.

  5. In the navigation pane, choose Commit Visualizer.

    
                      A graphical view of a repository in the console

    The commit graph is displayed, with the subject line for each commit shown next to its point in the graph. The subject line display is limited to 80 characters.

  6. To see more details about a commit point, choose the point in the graph.

    
                      A detail view of a commit point

    You can review the information in the detail pane, copy commit and parent commit IDs, render a new graph, and more. For more information, see View a Graph of the Commit History of a Repository .

Now that you have reviewed the content of your repository, consider whether you want to create a trigger. A trigger is an action that is taken in response to events in that repository, such as a push to a specific branch.

Step 3: Create a Trigger for Your Repository

In this step, you review the basics of configuring your repository so that code pushes or other events trigger another action (for example, sending a notification from Amazon SNS or invoking a function in AWS Lambda). For steps and code samples, see Create a Trigger for an Amazon SNS Topic and Create a Trigger for a Lambda Function.

Important

Before you can configure a trigger, you must first create the Amazon SNS topic or AWS Lambda function.

  1. In the navigation pane for your repository MyDemoRepo, choose Settings. In Settings, choose Triggers.

  2. Choose Create trigger.

    
                        Creating a trigger for a repository that doesn't have any
                            triggers
  3. Complete the configuration of the trigger according to your business needs. For more information, see Create a Trigger for an Amazon SNS Topic and Create a Trigger for a Lambda Function.

    
                    Configure the trigger with a name, the events that will trigger the action, the service to use, and
                    the action to take

For more information about creating and managing triggers for a repository, see Manage Triggers for a Repository.

Step 4: Next Steps

Now that you have familiarized yourself with AWS CodeCommit and some of its features, consider doing the following:

Step 5: Clean Up

In this step, you delete the AWS CodeCommit repository you used in this tutorial, so you won't continue to be charged for the storage space.

Important

After you delete this repository, you will no longer be able to clone it to any local repo or shared repo. You will also no longer be able to pull data from it, push data to it, or perform any Git operations, from any local repo or shared repo. This action cannot be undone.

If you configured triggers for your repository, deleting the repository does not delete the Amazon SNS topics or Lambda functions you configured as the targets of those triggers. Be sure to delete those resources if you don't need them.

To delete the AWS CodeCommit repository

  1. Open the AWS CodeCommit console at https://console.aws.amazon.com/codecommit.

  2. On the Dashboard page, in the list of repositories, choose MyDemoRepo.

  3. In the navigation pane, choose Settings.

  4. On the Settings page, in General, in Delete repository, choose Delete repository.

  5. In the box next to Type the name of the repository to confirm deletion, type MyDemoRepo, and then choose Delete.