1 00:00:00,220 --> 00:00:02,110 ‫Okay, so now I want show you how we can 2 00:00:02,110 --> 00:00:06,130 ‫push our code directly into Code Commit without using 3 00:00:06,130 --> 00:00:08,250 ‫the add file or upload file UI. 4 00:00:08,250 --> 00:00:10,490 ‫Because, this is obviously not much practice. 5 00:00:10,490 --> 00:00:13,530 ‫So for this, we have to go back to IAM and there's 6 00:00:13,530 --> 00:00:14,930 ‫something we haven't seen yet. 7 00:00:14,930 --> 00:00:17,500 ‫So, lets go to IAM and on the left hand side 8 00:00:17,500 --> 00:00:20,560 ‫find our users, find myself, and 9 00:00:20,560 --> 00:00:22,810 ‫I'm going to go to security credentials. 10 00:00:22,810 --> 00:00:24,550 ‫So here we've seen that we've created access keys 11 00:00:24,550 --> 00:00:27,130 ‫from before and we know this, but if you scroll down 12 00:00:27,130 --> 00:00:28,830 ‫there are two little options we missed. 13 00:00:28,830 --> 00:00:31,950 ‫The first one is SSH keys for AWS Code Commit 14 00:00:31,950 --> 00:00:34,570 ‫and the second one is HTTPS Git credentials 15 00:00:34,570 --> 00:00:36,020 ‫for AWS Code Commit. 16 00:00:36,020 --> 00:00:37,770 ‫So, if you're a Git expert and you already 17 00:00:37,770 --> 00:00:40,900 ‫know how Git works and you use SSH keys already, 18 00:00:40,900 --> 00:00:43,190 ‫you can just go ahead and upload your SSH public 19 00:00:43,190 --> 00:00:45,920 ‫key here, and your Git integration will be working. 20 00:00:45,920 --> 00:00:49,800 ‫You will go to clone URL and you would say clone SSH, 21 00:00:49,800 --> 00:00:52,310 ‫and you would copy this, uh, URL right here, 22 00:00:52,310 --> 00:00:55,740 ‫this SSH URL into your Git clone and you'll be done. 23 00:00:55,740 --> 00:00:58,630 ‫But for the newbies, if you've never done such thing before, 24 00:00:58,630 --> 00:01:01,670 ‫well we can do is get a little bit further and 25 00:01:01,670 --> 00:01:05,290 ‫use HTTPS Git credentials for Code Commit. 26 00:01:05,290 --> 00:01:06,270 ‫So how do we do this? 27 00:01:06,270 --> 00:01:09,490 ‫Well we can generate two, up to two username and passwords 28 00:01:09,490 --> 00:01:13,070 ‫directly to use HTTPS to connect to directly into 29 00:01:13,070 --> 00:01:13,920 ‫Code Commit. 30 00:01:13,920 --> 00:01:15,770 ‫So going into them you need to remember, 31 00:01:15,770 --> 00:01:18,610 ‫the, the fact that there's both SSH keys are supported 32 00:01:18,610 --> 00:01:21,400 ‫and HTTPS as well for Code Commit. 33 00:01:21,400 --> 00:01:22,790 ‫Lets go ahead and click on generate. 34 00:01:22,790 --> 00:01:25,760 ‫Here, my GIT credentials have been generated 35 00:01:25,760 --> 00:01:28,730 ‫and I'm going to download the credentials right here, 36 00:01:28,730 --> 00:01:29,780 ‫close. 37 00:01:29,780 --> 00:01:30,830 ‫Okay, excellent. 38 00:01:30,830 --> 00:01:33,310 ‫Now I can see that my GIT credential is active. 39 00:01:33,310 --> 00:01:35,000 ‫I can reset the password, make it inactive 40 00:01:35,000 --> 00:01:36,310 ‫and so on. 41 00:01:36,310 --> 00:01:38,010 ‫So, now, how do we go from here? 42 00:01:38,010 --> 00:01:41,170 ‫Well here, we can go back and use the clone URL 43 00:01:41,170 --> 00:01:42,980 ‫and we can do clone HTTPS. 44 00:01:42,980 --> 00:01:45,380 ‫In this case, it copies a HTTPS 45 00:01:45,380 --> 00:01:46,840 ‫type of URL. 46 00:01:46,840 --> 00:01:49,250 ‫So you don't need to know GIT going into the exam, 47 00:01:49,250 --> 00:01:50,730 ‫but just for the sake of this of this hands on, 48 00:01:50,730 --> 00:01:52,320 ‫if you wanna follow for the whole section 49 00:01:52,320 --> 00:01:53,153 ‫you need to install it. 50 00:01:53,153 --> 00:01:55,300 ‫Now, you don't need to be an expert, just follow along 51 00:01:55,300 --> 00:01:57,120 ‫with me and you'll be fine. 52 00:01:57,120 --> 00:01:59,360 ‫So to install GIT just add install Git, 53 00:01:59,360 --> 00:02:00,920 ‫and then your machine. 54 00:02:00,920 --> 00:02:03,990 ‫So if you have a Ubuntu, Windows and Mac then basically 55 00:02:03,990 --> 00:02:05,100 ‫you'll have to install something. 56 00:02:05,100 --> 00:02:07,710 ‫For me it's install GIT on Mac, and I'll just 57 00:02:07,710 --> 00:02:08,790 ‫follow the instructions. 58 00:02:08,790 --> 00:02:10,980 ‫So I just, I encourage you to do this and then 59 00:02:10,980 --> 00:02:12,560 ‫follow me when you install GIT. 60 00:02:12,560 --> 00:02:14,900 ‫So now that GIT is installed for me, you can make sure 61 00:02:14,900 --> 00:02:17,007 ‫of it by just typing the GIT command and you 62 00:02:17,007 --> 00:02:19,340 ‫should get minus minus version. 63 00:02:19,340 --> 00:02:22,060 ‫For example, it gives you the GIT version, I have 2.9.2. 64 00:02:22,060 --> 00:02:24,880 ‫And so, by just doing GIT, if your GIT version 65 00:02:24,880 --> 00:02:26,380 ‫you're good to go with this tutorial. 66 00:02:26,380 --> 00:02:29,330 ‫If not, you should just see how to basically install 67 00:02:29,330 --> 00:02:31,010 ‫GIT, such as you get the GIT command 68 00:02:31,010 --> 00:02:31,980 ‫on your platform. 69 00:02:31,980 --> 00:02:34,610 ‫So now we need the HTPS, code commit URL. 70 00:02:34,610 --> 00:02:37,570 ‫So clone URL, clone HTTPS and it right here. 71 00:02:37,570 --> 00:02:39,640 ‫I can also copy it from here if I wanted to, 72 00:02:39,640 --> 00:02:40,810 ‫just in case. 73 00:02:40,810 --> 00:02:43,350 ‫And then I will type, GIT clone 74 00:02:43,350 --> 00:02:44,960 ‫and then the whole URL right here. 75 00:02:44,960 --> 00:02:46,010 ‫Press enter. 76 00:02:46,010 --> 00:02:48,300 ‫And then you get asked for your username and 77 00:02:48,300 --> 00:02:49,450 ‫you will get asked for your password. 78 00:02:49,450 --> 00:02:51,720 ‫So let me just go ahead and enter this. 79 00:02:51,720 --> 00:02:52,743 ‫Here's my username, 80 00:02:53,790 --> 00:02:54,670 ‫and my password. 81 00:02:54,670 --> 00:02:59,030 ‫Press enter, and then when you're ready it's gonna 82 00:02:59,030 --> 00:03:00,580 ‫start to count objects remotely, 83 00:03:00,580 --> 00:03:03,260 ‫and checking the connectivity, and it's done. 84 00:03:03,260 --> 00:03:08,260 ‫So now we have a new folder called the nodejs app folder. 85 00:03:08,410 --> 00:03:12,180 ‫So I'll go in it, and then because I have a terminal 86 00:03:12,180 --> 00:03:14,040 ‫that's integrated with GIT, it tells me that 87 00:03:14,040 --> 00:03:15,200 ‫I am a master. 88 00:03:15,200 --> 00:03:18,920 ‫If I do "LS" I can see the index html file, 89 00:03:18,920 --> 00:03:20,430 ‫that we've had from before. 90 00:03:20,430 --> 00:03:22,990 ‫So this is quite awesome, because now we have the 91 00:03:22,990 --> 00:03:25,930 ‫index dot html file and we can start adding files 92 00:03:25,930 --> 00:03:28,240 ‫as we go along, later down in this course, 93 00:03:28,240 --> 00:03:29,520 ‫using the GIT command. 94 00:03:29,520 --> 00:03:32,190 ‫But this is proof that we just established a 95 00:03:32,190 --> 00:03:36,035 ‫GIT connectivity between our computer and the 96 00:03:36,035 --> 00:03:37,460 ‫(unintelligible) 97 00:03:37,460 --> 00:03:40,250 ‫using the HTPS credentials we setup IAM. 98 00:03:40,250 --> 00:03:42,310 ‫So now just to show you how things work with GIT, 99 00:03:42,310 --> 00:03:45,820 ‫I'm just going to copy a few files in this directory, 100 00:03:45,820 --> 00:03:47,900 ‫and then we're going to commit these files 101 00:03:47,900 --> 00:03:49,670 ‫straight into our (unintelligible) 102 00:03:49,670 --> 00:03:53,130 ‫So I'll just copy file from my nodejs-blue app 103 00:03:53,130 --> 00:03:55,990 ‫and I'll copy all of them into here. 104 00:03:55,990 --> 00:03:58,960 ‫So this is just a command, so just now if you do, uh 105 00:03:58,960 --> 00:04:01,150 ‫look what's in our directory we can that there is 106 00:04:01,150 --> 00:04:04,420 ‫the app.js, cron.yaml, index.html 107 00:04:04,420 --> 00:04:05,510 ‫and package.json file. 108 00:04:05,510 --> 00:04:08,840 ‫So, all these files have been copied from my 109 00:04:08,840 --> 00:04:11,750 ‫previous directory, into this current directory. 110 00:04:11,750 --> 00:04:14,000 ‫And so now you git status, 111 00:04:14,000 --> 00:04:17,840 ‫you get, uh, a message from GIT saying, "Hey, looks like 112 00:04:17,840 --> 00:04:21,110 ‫you have a few files that have been added right here, 113 00:04:21,110 --> 00:04:24,260 ‫in your (unintelligible) and they're un-tracked." 114 00:04:24,260 --> 00:04:26,890 ‫So for adding them we do GIT add and then we will 115 00:04:26,890 --> 00:04:30,750 ‫just, do dot to add the (unintelligible) 116 00:04:30,750 --> 00:04:32,620 ‫So now if you do GIT status again, 117 00:04:32,620 --> 00:04:35,570 ‫we can see that these files have been added and they're 118 00:04:35,570 --> 00:04:36,570 ‫new files. 119 00:04:36,570 --> 00:04:38,527 ‫So now we do a commit message saying, 120 00:04:38,527 --> 00:04:41,050 ‫"added missing files 121 00:04:41,050 --> 00:04:42,000 ‫to repository" 122 00:04:42,000 --> 00:04:44,380 ‫And you can commit whatever you want really. 123 00:04:44,380 --> 00:04:47,330 ‫So now, all these files have been added, into it. 124 00:04:47,330 --> 00:04:49,150 ‫And now we see my master is green, 125 00:04:49,150 --> 00:04:52,160 ‫and then finally what I have to do is GIT push, 126 00:04:52,160 --> 00:04:54,940 ‫to push my changes into Code Commit. 127 00:04:54,940 --> 00:04:56,850 ‫So now, as you can see, the commit has been pushed 128 00:04:56,850 --> 00:04:59,450 ‫to Code Commit and we should be all right. 129 00:04:59,450 --> 00:05:01,330 ‫Now, lets go and check Code Commit, 130 00:05:01,330 --> 00:05:03,123 ‫and lets refresh this page. 131 00:05:04,980 --> 00:05:08,000 ‫And yes indeed, my new files have been pushed directly 132 00:05:08,000 --> 00:05:10,210 ‫into my Code Commit repository. 133 00:05:10,210 --> 00:05:12,870 ‫So we have the four of them now, we can have like this 134 00:05:12,870 --> 00:05:16,150 ‫app.js file and we could edit it in here if we wanted to 135 00:05:16,150 --> 00:05:17,430 ‫but it's just really not best practice. 136 00:05:17,430 --> 00:05:19,880 ‫Usually you edit your code with a code editor. 137 00:05:19,880 --> 00:05:21,240 ‫And so, yes, it's good. 138 00:05:21,240 --> 00:05:23,810 ‫All, uh, our files have been uploaded into 139 00:05:23,810 --> 00:05:26,020 ‫this repository, so this is excellent. 140 00:05:26,020 --> 00:05:28,360 ‫We could also look at the commit history and see that, 141 00:05:28,360 --> 00:05:31,050 ‫yes indeed, um, there is a first version that was 142 00:05:31,050 --> 00:05:32,690 ‫uploaded like a while back, twenty minutes ago. 143 00:05:32,690 --> 00:05:35,320 ‫And now we just add the missing files to the repository, 144 00:05:35,320 --> 00:05:37,590 ‫so we can see the whole commit history and start 145 00:05:37,590 --> 00:05:40,630 ‫getting the hang of, like, how, code commit works. 146 00:05:40,630 --> 00:05:43,180 ‫So that's it, just remember, here for security 147 00:05:43,180 --> 00:05:47,400 ‫how things work so we can, connect using SSH or HTTPS. 148 00:05:47,400 --> 00:05:49,560 ‫And if you need some help, again with the connection steps 149 00:05:49,560 --> 00:05:51,160 ‫just click here and it will take you straight 150 00:05:51,160 --> 00:05:52,320 ‫to the documentation. 151 00:05:52,320 --> 00:05:53,420 ‫All right, that's it for this lecture, 152 00:05:53,420 --> 00:05:55,170 ‫I will see you in the next lecture.