1 00:00:00,360 --> 00:00:03,150 ‫So let's talk about a service we haven't seen yet 2 00:00:03,150 --> 00:00:05,010 ‫which is called CloudFormation. 3 00:00:05,010 --> 00:00:06,900 ‫CloudFormation is going to be used to 4 00:00:06,900 --> 00:00:10,860 ‫deploy complex infrastructure using an API in AWS. 5 00:00:10,860 --> 00:00:13,350 ‫So with one CloudFormation template, for example 6 00:00:13,350 --> 00:00:15,720 ‫you can deploy an auto scanning group 7 00:00:15,720 --> 00:00:17,910 ‫a low balancer, a database, whatever you want. 8 00:00:17,910 --> 00:00:20,640 ‫And we'll see CloudFormation in depth in this course. 9 00:00:20,640 --> 00:00:23,340 ‫But I want to just introduce the concept to you right now 10 00:00:23,340 --> 00:00:26,520 ‫because it is very important within Code Pipeline. 11 00:00:26,520 --> 00:00:29,550 ‫So you can actually use CloudFormation within Code Pipeline. 12 00:00:29,550 --> 00:00:30,540 ‫And even though we don't know 13 00:00:30,540 --> 00:00:32,400 ‫exactly how CloudFormation works 14 00:00:32,400 --> 00:00:34,230 ‫I wanna show you its usage. 15 00:00:34,230 --> 00:00:35,880 ‫So let's say we have the first step 16 00:00:35,880 --> 00:00:39,810 ‫of our pipeline being to build an app using CodeBuild. 17 00:00:39,810 --> 00:00:43,560 ‫So we deploy the, we build the app, we have an artifact 18 00:00:43,560 --> 00:00:46,800 ‫and then out of it we're going to have CloudFormation. 19 00:00:46,800 --> 00:00:49,110 ‫And CloudFormation is going to be used to actually 20 00:00:49,110 --> 00:00:53,070 ‫deploy a whole new infrastructure and your application. 21 00:00:53,070 --> 00:00:55,440 ‫So for example, if we put CloudFormation 22 00:00:55,440 --> 00:00:57,900 ‫in the create or update mode 23 00:00:57,900 --> 00:01:00,210 ‫then it's going to create a CloudFormation stack. 24 00:01:00,210 --> 00:01:02,190 ‫And whatever you define as part of your stack 25 00:01:02,190 --> 00:01:03,870 ‫it could be a low balancer 26 00:01:03,870 --> 00:01:05,790 ‫it could be an auto scaling group. 27 00:01:05,790 --> 00:01:06,720 ‫Whatever we define as part 28 00:01:06,720 --> 00:01:09,420 ‫of our stack is going to be created by CloudFormation. 29 00:01:09,420 --> 00:01:12,030 ‫The point is, this is going to be our test stack 30 00:01:12,030 --> 00:01:15,780 ‫and is going to be deployed as part of your code pipeline. 31 00:01:15,780 --> 00:01:18,450 ‫When the stack is deployed, then we can go 32 00:01:18,450 --> 00:01:22,440 ‫into another CodeBuild stage to test our application 33 00:01:22,440 --> 00:01:24,060 ‫because CodeBuild can build an application 34 00:01:24,060 --> 00:01:27,780 ‫but you can also run test suites on CodeBuild, for example. 35 00:01:27,780 --> 00:01:30,570 ‫We can run a lot of HTP based calls 36 00:01:30,570 --> 00:01:33,540 ‫against our newly deployed application to make sure 37 00:01:33,540 --> 00:01:35,880 ‫that everything is working as expected 38 00:01:35,880 --> 00:01:38,190 ‫that there are no crushes and so on. 39 00:01:38,190 --> 00:01:39,690 ‫So all these tests can can happen 40 00:01:39,690 --> 00:01:43,350 ‫within CodeBuild and then if they're successful or not. 41 00:01:43,350 --> 00:01:47,340 ‫But anyway, we will have a CloudFormation step again 42 00:01:47,340 --> 00:01:49,140 ‫in our code pipeline and action. 43 00:01:49,140 --> 00:01:50,550 ‫And this time it's going to be 44 00:01:50,550 --> 00:01:54,480 ‫in delete only mode to delete the infrastructure 45 00:01:54,480 --> 00:01:56,250 ‫by deleting the CloudFormation stack. 46 00:01:56,250 --> 00:01:58,080 ‫And when you delete a CloudFormation stack 47 00:01:58,080 --> 00:02:00,330 ‫everything that was created as part 48 00:02:00,330 --> 00:02:03,510 ‫of your CloudFormation stack, is also going to be deleted. 49 00:02:03,510 --> 00:02:05,790 ‫So that means that we're going to have a clean slate. 50 00:02:05,790 --> 00:02:08,490 ‫But the benefit of this is that we were able to spin 51 00:02:08,490 --> 00:02:11,040 ‫up a test environment, test against it 52 00:02:11,040 --> 00:02:13,470 ‫and then delete the test environment. 53 00:02:13,470 --> 00:02:15,240 ‫Just say like nothing happens 54 00:02:15,240 --> 00:02:17,460 ‫and this is the power of the cloud relate. 55 00:02:17,460 --> 00:02:19,290 ‫So then if we delete the stack 56 00:02:19,290 --> 00:02:21,960 ‫we can then deploy to production. 57 00:02:21,960 --> 00:02:23,460 ‫And by deploying to production 58 00:02:23,460 --> 00:02:26,700 ‫we could again use CloudFormation in the create updates 59 00:02:26,700 --> 00:02:28,290 ‫but this time it's not going to create a stack. 60 00:02:28,290 --> 00:02:30,810 ‫Of course, it's going to update an existing stack to 61 00:02:30,810 --> 00:02:33,330 ‫deploy your new application version. 62 00:02:33,330 --> 00:02:34,470 ‫So that's it you've seen how 63 00:02:34,470 --> 00:02:37,290 ‫CloudFormation is used with Code Pipeline. 64 00:02:37,290 --> 00:02:38,400 ‫I hope you liked it 65 00:02:38,400 --> 00:02:40,383 ‫and I will see you in the next lecture.