Explore the process of creating a repository in CodeCommit and setting up Git and the AWS CLI tool.
- [Instructor] If you know about version control, you probably have used Git before. CodeCommit is a Git compatible, secure, and scalable code repository service that provides version control to developers and organizations. We will begin our journey of deploying code to the cloud by checking in our code to CodeCommit. Sounds simple enough until you consider that a lot of tasks can be triggered by the action of safekeeping our code. In a perfect world, we would just check in our code, and this will start an automated task process covering all our code, immediately followed by the creation of binaries from our source such as libraries and docker container images.
However, we all know things are a bit more complicated than that, and that's why we're here. So let's start by configuring and using CodeCommit. Then we'll create a build job using CodeBuild, and we'll slowly keep stacking layers of knowledge on the way to our ultimate goal, a fully automated code deployment pipeline. Let's do this. Before we start setting up CodeCommit repository, let's make sure our IAM user will be able to connect to it. So let's start in a IAM console and verify access to CodeCommit.
Click on Users, click on our user, and verify that we had administrative access or CodeCommit full access. We'll then click on Security credentials, verify that we have at least one API key that we can use, and scrolling down verify that we have a user that we can use for HTTPS Get credential, which we'll use for CodeCommit. We have these properties noted down, and we'll set it up in our command line tools.
Let's now go to our console and set that up. Here we are in our command prompt, and we just want to verify that our AWS CLI tool is configured properly. We'll type aws configure, and this indeed matches the last four characters of our API key. The secret key is correct as well, and verify that the region is the one that you want, in this case us-west-1. We have our AWS CLI tool all set now.
Let's concentrate in configuring our GIT CLI. We'll type, git --version, and verify we get a valid response. We'll now set our user by typing git config --global user.name. We'll type our name and the same with our email, git config --global user.email.
Now let's go back to our AWS console to configure CodeCommit. If you haven't used CodeCommit before, you'll be greeted with a splash screen. Let's click on Create repository. Because this is a pretty straightforward service, all you really need to provide to create a repository is a name and a description. Let's do that now. Type lil-demo-1, we'll click Create. Even if you have access to the root credentials for your AWS account, because there are IAM permissions involved, it's highly recommended that you use an IAM user to access CodeCommit.
Okay, with our code repository created, and our tools properly setup, we can start using it right away.
- Checking in source code with CodeCommit
- Building code in CodeBuild
- Deploying code with CodeDeploy
- Creating a DevOps pipeline with CodePipeline
- Creating and deploying an Elastic Beanstalk application