1 00:00:06,920 --> 00:00:09,860 - In an AWS CI CD pipeline, 2 00:00:09,860 --> 00:00:12,710 there are a number of services that you can use, 3 00:00:12,710 --> 00:00:17,710 either individually or all in a single end to end process. 4 00:00:20,380 --> 00:00:23,720 We have code commit to store your source code, 5 00:00:23,720 --> 00:00:25,610 there's code build, 6 00:00:25,610 --> 00:00:29,420 which builds deployment artifacts and performs testing, 7 00:00:29,420 --> 00:00:31,950 we have code pipeline, 8 00:00:31,950 --> 00:00:35,400 which can orchestrate the end to end process, 9 00:00:35,400 --> 00:00:38,445 and then we have this service CodeDeploy, 10 00:00:38,445 --> 00:00:41,830 which is designed for the last piece 11 00:00:41,830 --> 00:00:44,950 which is actually deploying the code with a degree 12 00:00:44,950 --> 00:00:48,683 of quality and following good DevOps principles. 13 00:00:49,576 --> 00:00:53,400 CodeDeploy, like the other services is region scoped. 14 00:00:53,400 --> 00:00:56,420 And it's name is exactly what it does, 15 00:00:56,420 --> 00:01:00,493 it is a managed artifact deployment service. 16 00:01:02,100 --> 00:01:06,840 It is designed around the automation of software deployment 17 00:01:06,840 --> 00:01:10,610 to increase the uptime of the application 18 00:01:10,610 --> 00:01:15,333 and reduce the impact on the end users or clients. 19 00:01:17,710 --> 00:01:20,580 CodeDeploy has native integration 20 00:01:20,580 --> 00:01:22,940 with the EC2 auto scaling. 21 00:01:22,940 --> 00:01:25,520 And so even if you have an auto scaling group, 22 00:01:25,520 --> 00:01:27,660 with a number of running EC2 instances 23 00:01:27,660 --> 00:01:29,100 and you need to update the version 24 00:01:29,100 --> 00:01:30,520 of the application on them, 25 00:01:30,520 --> 00:01:32,670 you can do that using CodeDeploy. 26 00:01:34,220 --> 00:01:36,120 It has on-prem capability, 27 00:01:36,120 --> 00:01:39,980 so you can perform these deployments against resources 28 00:01:39,980 --> 00:01:42,130 that are sitting in an on-prem data center. 29 00:01:43,780 --> 00:01:46,910 It allows for different types of deployments, 30 00:01:46,910 --> 00:01:51,613 including a rolling deployment and blue/green deployments. 31 00:01:53,370 --> 00:01:57,780 It also allows for configuration of deployment groups 32 00:01:57,780 --> 00:01:59,880 as well as handling the history 33 00:01:59,880 --> 00:02:03,683 of deployments as well as success and failure rates. 34 00:02:05,850 --> 00:02:09,330 And finally it integrates with the other services 35 00:02:09,330 --> 00:02:12,347 that can be part of a CI CD pipeline in AWS. 36 00:02:15,390 --> 00:02:17,560 Let's take a look at an example 37 00:02:17,560 --> 00:02:21,560 of using CodeDeploy all by itself 38 00:02:21,560 --> 00:02:26,560 for managing the application version of a Lambda function. 39 00:02:27,890 --> 00:02:29,310 So, first thing we need to do 40 00:02:29,310 --> 00:02:33,100 is we create the function itself, the application, 41 00:02:33,100 --> 00:02:36,050 and we are going to associate that 42 00:02:36,050 --> 00:02:41,050 with a deployment group, configuration and versions. 43 00:02:42,100 --> 00:02:45,040 And this will help us to maintain 44 00:02:45,040 --> 00:02:49,740 state within CodeDeploy. 45 00:02:49,740 --> 00:02:52,470 Next, we specify the deployment group 46 00:02:52,470 --> 00:02:54,190 that we want to deploy to 47 00:02:54,190 --> 00:02:57,020 in this particular iteration. 48 00:02:57,020 --> 00:02:59,110 And this is where we can configure things like 49 00:02:59,110 --> 00:03:02,910 traffic routing between multiple deployment groups, 50 00:03:02,910 --> 00:03:06,140 so that we can perform gradual cut overs 51 00:03:06,140 --> 00:03:09,710 from one version of an application to another, 52 00:03:09,710 --> 00:03:12,273 and it allows us to support rollback. 53 00:03:14,730 --> 00:03:17,320 Next, we have the deployment configuration, 54 00:03:17,320 --> 00:03:20,150 this is where we choose the actual algorithm 55 00:03:20,150 --> 00:03:21,020 for the deployment. 56 00:03:21,020 --> 00:03:22,860 Do we do it all at once? 57 00:03:22,860 --> 00:03:25,010 Do we do a Canary deployment? 58 00:03:25,010 --> 00:03:27,403 Or do we do a blue/green deployment instead? 59 00:03:30,120 --> 00:03:34,450 The AppSpec file is where we actually describe 60 00:03:34,450 --> 00:03:36,940 the function versions, the current version 61 00:03:36,940 --> 00:03:40,310 and the version that we want to deploy to 62 00:03:40,310 --> 00:03:43,423 along with other validation operations. 63 00:03:45,980 --> 00:03:48,770 Now we reach the actual deploy step 64 00:03:48,770 --> 00:03:53,700 and this allows us to push that new application revision 65 00:03:53,700 --> 00:03:56,070 to the deployment group using 66 00:03:56,070 --> 00:03:57,510 the method that we've defined 67 00:03:57,510 --> 00:03:59,120 in the deployment configuration, 68 00:03:59,120 --> 00:04:01,490 which could be just a Canary deployment, 69 00:04:01,490 --> 00:04:04,940 meaning we have a very small percentage 70 00:04:04,940 --> 00:04:09,940 of our actual application that is using that new version 71 00:04:10,010 --> 00:04:12,403 of the function until we're sure that it works. 72 00:04:14,586 --> 00:04:16,460 We then check our results 73 00:04:16,460 --> 00:04:18,340 and this is going to use CloudWatch 74 00:04:18,340 --> 00:04:20,853 and other built in AWS monitoring. 75 00:04:21,740 --> 00:04:24,260 And finally, we make the decision, 76 00:04:24,260 --> 00:04:25,730 this is our tollgate, 77 00:04:25,730 --> 00:04:30,090 where we decide was the deployment truly successful 78 00:04:30,090 --> 00:04:33,440 or did we need to trigger a rollback so 79 00:04:33,440 --> 00:04:35,730 that we can go back to the previous version 80 00:04:35,730 --> 00:04:40,163 without any further impact on our end users or clients.