The course is part of this learning path
This course is intended for anyone interested in getting started with the tools that AWS provides for developers. We will explore all the services in the Developer Tools category, including CodeCommit, CodeDeploy, and CodePipeline, covering the basics for each service. By the end of this course, you should be able to describe all of these services and work with them.
In order to follow up with the examples showed in this course, you should have some general AWS knowledge, that includes being familiar with all the core services of AWS, especially EC2 and IAM, and also understanding how to use and configure the AWS CLI. If you don't have this knowledge, we recommend that you step back and take at least the AWS Compute Fundamentals and the AWS Security Fundamentals course prior to this one.
You can find a detailed guide to follow up the examples in this course along with the source code for the applications that we will deploy in this Github repository.
If you have thoughts or suggestions for this course, please contact Cloud Academy at email@example.com.
Hi. In this lecture, we will explore CodeCommit. CodeCommit is a fully manager source control service that AWS provides. AWS ensures security by encrypting all the repositories that you create. Actually, there is no option to create a non-encrypted repository. It's high available. It was built on top of S3 and DynamoDB, which are high-available services by design. You can store anything in the CodeCommit repository. Meaning that you can store any type of files that you want and also, there is no size limit for the repositories. And last, but not least, it makes use of Git, a well-known source control system that you probably are familiar with.
By using CodeCommit, you will be billed in a monthly basis. It will cost $1 per active user per month. You will have 10 gigabytes of storage per month and 2,000 Git requests. In case you exceed these limits, you'll pay an additional fee for it. So now let's go to the AWS console and have a hands-on overview on how it works.
Here at the AWS CodeCommit console, let's click on "get started." And since we don't have any repository created yet, we have to create one in order to use the service.
And our repository is created. If we click on the repository name, we can see that we have no files obviously. And we can see some settings in here. And we have two ways to connect to our repository. We can either connect to it via SSH or HTTPS. In this video, I will connect to this repository via SSH. So we would use this URL. But we can't just simply copy this URL and clone the repository because all repositories on CodeCommit are private. So we need to first configure our credentials on our machine in order to connect to this repository. So let's do this.
In order to connect to our repository, I've created an IEM user. This user is called CodeCommit and it has only an access Git active in his account. The permissions for this user are AWS CodeCommit full access, which is self-explanatory. You need to grant access to your IEM user in order to access and manage a repository. This specific policy will grant full access to this user to the CodeCommit servers. And I also have added a permission that will help me upload an SSH Git to my IEM profile. Because we need to upload the SSH to our IEM user prior trying to connect to our repository via SSH.
So let's do it. Let's now generate an SHH key to our user. I'm in my SSH folder inside my user profile. And now I will create a new pair of SSH keys. I'll name it "codecommit." No password. And it's done. Now we have a couple of new files in here. We need to upload the contents of this file, called "codecommit.pub" to the IEM console. So let me see the contents of this file. In here we could simply copy and paste. Now it's done and notice that we have an SSH key ID. We will need this information.
Now back in the terminal, we should create another file in here. It will be called "config." And we need to insert some information. In here, notice that we need to specify user by his SSH public key ID. So we can simply copy and paste again the SHH key ID. And we will be almost ready to go. We need, also, to change the permissions for this file. And done.
Now that I've copied the SSH URL, let me try to clone this repository. Git clone, nothing new in here. And just wait for the step to complete. And now we have our test folder. We could create a new file in here so let's create a read-me file.
Our file was created and now let's add our changes. Commit, and send our results. Okay. It has also created a new branch. The master branch. And if we refresh this page, we should be able to see the file that we just uploaded. And here it is. "Hello World."
You might remember that I've created the CodeCommit user with full permissions to the CodeCommit service and also a few permissions to the IEM service. Especially to upload the SSH keys. I did it because I believe it's more convenient to deal with this service through the command line. So let's try it out.
First, I will create a new repository. Our repository was created. You can see here that we could clone, right away, the SSH URL or the HTTPS URL. But let's also upload our SHH keys to the IEM service through the command line interface. To do it, we need to have permissions in the IEM service and we need, also, to create another SHH key because if we try to upload, again, the same key, AWS will throw us an arrow. So let's get back to the SSH folder. Okay, and create another key. Sorry, my bad. Okay, I will call it simply, "key." No pass-phrase again. Our file is here and let's upload it.
Here, to avoid the copy and paste, we can simply do this. And our SSH key was uploaded successfully. And we can see here that AWS has returned to us, the SSH key ID. So let me copy this ID. Open, again, our config file. And replace this information. Also, we have to replace the key.
Now, I believe that we are ready to go. Let me copy the SSH address from the repository that we just created and try to clone it. Okay, it was created. Let me create another file. "Hello." Oh, my typing is terrible. Just "Hello." And if we did everything right, we are supposed to see a new repository in here, as well our file. So click on "dashboard." The repository is here. Great. And also, we have our file.
Eric Magalhães has a strong background as a Systems Engineer for both Windows and Linux systems and, currently, work as a DevOps Consultant for Embratel. Lazy by nature, he is passionate about automation and anything that can make his job painless, thus his interest in topics like coding, configuration management, containers, CI/CD and cloud computing went from a hobby to an obsession. Currently, he holds multiple AWS certifications and, as a DevOps Consultant, helps clients to understand and implement the DevOps culture in their environments, besides that, he play a key role in the company developing pieces of automation using tools such as Ansible, Chef, Packer, Jenkins and Docker.