1 00:00:00,450 --> 00:00:01,470 ‫So, now let's go ahead, 2 00:00:01,470 --> 00:00:04,290 ‫and create a second Beanstalk environment. 3 00:00:04,290 --> 00:00:06,480 ‫So, let's create a new environment. 4 00:00:06,480 --> 00:00:09,150 ‫Again, it's going to be a web server environment, 5 00:00:09,150 --> 00:00:12,570 ‫and the name, this time, is going to be prod. 6 00:00:12,570 --> 00:00:13,920 ‫So, we'll have a development environment, 7 00:00:13,920 --> 00:00:16,020 ‫and a production environment. 8 00:00:16,020 --> 00:00:19,770 ‫Now, we're going to use the same managed platform of Node.js 9 00:00:19,770 --> 00:00:23,040 ‫and we'll use the same sample application for now. 10 00:00:23,040 --> 00:00:24,990 ‫And the Preset is going to be, this time, 11 00:00:24,990 --> 00:00:27,810 ‫not Single Instance, but High Availability, 12 00:00:27,810 --> 00:00:30,000 ‫because we want to have a look at more configurations 13 00:00:30,000 --> 00:00:32,160 ‫and understand what Beanstalk is doing 14 00:00:32,160 --> 00:00:34,555 ‫when we're doing high availability. 15 00:00:34,555 --> 00:00:35,583 ‫So, click on Next. 16 00:00:36,870 --> 00:00:39,210 ‫Then we want to use an existing service role, 17 00:00:39,210 --> 00:00:41,640 ‫so we'll just use these two right here, 18 00:00:41,640 --> 00:00:44,250 ‫so this is perfect, already created. 19 00:00:44,250 --> 00:00:45,453 ‫And then click on Next. 20 00:00:47,040 --> 00:00:51,120 ‫Okay. So, here we have some optional configurations, 21 00:00:51,120 --> 00:00:53,970 ‫and we will set some of them, and others we will not. 22 00:00:53,970 --> 00:00:56,400 ‫So, we can set up networking, database, and tags, 23 00:00:56,400 --> 00:00:59,070 ‫so if you had a specific VPC requirements, 24 00:00:59,070 --> 00:01:02,010 ‫you could select it here, but this is optional. 25 00:01:02,010 --> 00:01:04,440 ‫For Instance Settings, we have to choose, 26 00:01:04,440 --> 00:01:06,810 ‫we'll actually choose this VPC, sorry. 27 00:01:06,810 --> 00:01:08,010 ‫And then for Instance Settings, 28 00:01:08,010 --> 00:01:10,890 ‫we'll actually choose in which subnets we want to launch. 29 00:01:10,890 --> 00:01:12,390 ‫So, in this case, we want to launch 30 00:01:12,390 --> 00:01:14,190 ‫in all my subnets available, 31 00:01:14,190 --> 00:01:16,320 ‫so that we are highly available. 32 00:01:16,320 --> 00:01:18,810 ‫Because we will be using a load balancer, 33 00:01:18,810 --> 00:01:21,390 ‫there is no need to assign public IP addresses 34 00:01:21,390 --> 00:01:24,933 ‫to my EC2 instances, so I will not keep this activated. 35 00:01:26,190 --> 00:01:29,460 ‫Then we have the option to use a database in it. 36 00:01:29,460 --> 00:01:31,710 ‫And if we decide to use a database 37 00:01:31,710 --> 00:01:34,530 ‫in our Beanstalk environment, just so you know, 38 00:01:34,530 --> 00:01:37,080 ‫that database is linked to the lifecycle 39 00:01:37,080 --> 00:01:37,913 ‫of your environment. 40 00:01:37,913 --> 00:01:39,867 ‫That means that if you delete your environment, 41 00:01:39,867 --> 00:01:41,340 ‫the database will go away. 42 00:01:41,340 --> 00:01:42,780 ‫Now, of course, there are ways around it, 43 00:01:42,780 --> 00:01:44,940 ‫you can snapshot your database, 44 00:01:44,940 --> 00:01:46,560 ‫and then restore it at a later stage, 45 00:01:46,560 --> 00:01:48,660 ‫but it's something that you should know about. 46 00:01:48,660 --> 00:01:50,700 ‫Now, we don't need a database, so we'll not do it. 47 00:01:50,700 --> 00:01:53,733 ‫So, I'll scroll down, and click on Next. 48 00:01:56,370 --> 00:01:59,040 ‫Okay, next we configure the instances. 49 00:01:59,040 --> 00:02:02,010 ‫So, do we want to have the root volume 50 00:02:02,010 --> 00:02:03,720 ‫different than the default and so on? 51 00:02:03,720 --> 00:02:05,250 ‫What security groups we want? 52 00:02:05,250 --> 00:02:07,980 ‫I will not select this, we'll just make sure 53 00:02:07,980 --> 00:02:11,190 ‫that this is automatically configured for us. 54 00:02:11,190 --> 00:02:13,560 ‫What about the auto scaling group? 55 00:02:13,560 --> 00:02:17,220 ‫So, here we have a Load Balanced environment, 56 00:02:17,220 --> 00:02:19,680 ‫so this time we'll have a load balancer, 57 00:02:19,680 --> 00:02:21,420 ‫and so, therefore, our autoscaling group 58 00:02:21,420 --> 00:02:23,520 ‫will have a minimum and a maximum capacity. 59 00:02:23,520 --> 00:02:25,950 ‫For example, one to four. 60 00:02:25,950 --> 00:02:28,920 ‫The fleet composition, so how do we want your ASG to be, 61 00:02:28,920 --> 00:02:31,650 ‫On-Demand, or also maybe some spots, who knows? 62 00:02:31,650 --> 00:02:32,850 ‫So, we scroll down. 63 00:02:32,850 --> 00:02:34,530 ‫As you can see, lots of different options. 64 00:02:34,530 --> 00:02:37,020 ‫We want t3.micro, t3.small. 65 00:02:37,020 --> 00:02:39,980 ‫So, I'll just leave it as t3.micro, for example. 66 00:02:39,980 --> 00:02:44,760 ‫The AMI ID you wanna use, so pretty much the configurations 67 00:02:44,760 --> 00:02:46,323 ‫of your ASG can be done here. 68 00:02:47,160 --> 00:02:49,620 ‫How do you wanna scale your ASG? 69 00:02:49,620 --> 00:02:52,770 ‫So, here we wanna scale our network out, on the average, 70 00:02:52,770 --> 00:02:55,230 ‫what is the min, the max, and the thresholds, and so on. 71 00:02:55,230 --> 00:02:58,260 ‫So, these are all my ASG configuration 72 00:02:58,260 --> 00:03:00,720 ‫that I can do directly from Beanstalk. 73 00:03:00,720 --> 00:03:04,470 ‫Regarding load balancer, what is the visibility? 74 00:03:04,470 --> 00:03:05,910 ‫What subnets do I want in? 75 00:03:05,910 --> 00:03:08,040 ‫So, it's a public load balancer in three subnets, 76 00:03:08,040 --> 00:03:09,270 ‫so that's perfect. 77 00:03:09,270 --> 00:03:11,370 ‫And then the type of load balancer. 78 00:03:11,370 --> 00:03:14,970 ‫So, do I want a application load balancer? 79 00:03:14,970 --> 00:03:17,010 ‫Or a network load balancer? 80 00:03:17,010 --> 00:03:20,670 ‫And if I choose an ALB, I can either have one dedicated 81 00:03:20,670 --> 00:03:24,390 ‫for this environment, or if you have multiple environments, 82 00:03:24,390 --> 00:03:27,990 ‫then you can use a shared one to save on some cost, 83 00:03:27,990 --> 00:03:29,520 ‫which is really nice. 84 00:03:29,520 --> 00:03:31,590 ‫So, listeners for your load balancers, 85 00:03:31,590 --> 00:03:34,110 ‫so, again, more load balancer configuration, 86 00:03:34,110 --> 00:03:35,370 ‫processes, rules, 87 00:03:35,370 --> 00:03:38,190 ‫I mean, you can see that everything can be configured 88 00:03:38,190 --> 00:03:39,690 ‫directly in here. 89 00:03:39,690 --> 00:03:41,253 ‫So, I'll click on Next. 90 00:03:44,670 --> 00:03:45,870 ‫And then Health Reporting. 91 00:03:45,870 --> 00:03:47,880 ‫So, what kind of health checks do we want? 92 00:03:47,880 --> 00:03:50,520 ‫So, we can have CloudWatch custom metrics, 93 00:03:50,520 --> 00:03:52,470 ‫we can have Enhanced type of health reporting, 94 00:03:52,470 --> 00:03:53,610 ‫which we need. 95 00:03:53,610 --> 00:03:56,580 ‫So, I will not go over all the health, but as you can see, 96 00:03:56,580 --> 00:03:59,430 ‫Beanstalk itself manages its own updates, 97 00:03:59,430 --> 00:04:00,510 ‫so it's quite nice. 98 00:04:00,510 --> 00:04:02,460 ‫Do you want email notifications 99 00:04:02,460 --> 00:04:06,390 ‫based on important events for your environment? 100 00:04:06,390 --> 00:04:07,650 ‫Do you want to have rolling updates? 101 00:04:07,650 --> 00:04:10,290 ‫So, we'll have a look at this in its own lecture, 102 00:04:10,290 --> 00:04:12,240 ‫so we'll just skip this right now, 103 00:04:12,240 --> 00:04:14,430 ‫but this is a very important one for the exam. 104 00:04:14,430 --> 00:04:15,690 ‫And then Platform Software. 105 00:04:15,690 --> 00:04:17,430 ‫So, you want Amazon X-Ray, 106 00:04:17,430 --> 00:04:20,100 ‫do we want to stream logs to CloudWatch logs and so on? 107 00:04:20,100 --> 00:04:23,370 ‫So, a lot again of different options. 108 00:04:23,370 --> 00:04:25,650 ‫So, we've seen pretty much everything at a high level. 109 00:04:25,650 --> 00:04:28,050 ‫As you can see, Beanstalk can be quite a complicated, 110 00:04:28,050 --> 00:04:30,600 ‫and powerful, and complete service. 111 00:04:30,600 --> 00:04:33,450 ‫So, bottom line is we have configured everything, 112 00:04:33,450 --> 00:04:35,610 ‫but in my experience with this new console, 113 00:04:35,610 --> 00:04:36,720 ‫we may do things wrong, 114 00:04:36,720 --> 00:04:39,570 ‫so I'm going to go and just cancel this. 115 00:04:39,570 --> 00:04:42,000 ‫Okay? We're going to cancel this altogether, 116 00:04:42,000 --> 00:04:44,490 ‫and then we will recreate an environment. 117 00:04:44,490 --> 00:04:48,480 ‫And the application is going to be MyApplication. 118 00:04:48,480 --> 00:04:51,720 ‫The environment name is MyApplication-prod. 119 00:04:51,720 --> 00:04:55,170 ‫We will choose again, Node.js 12, 120 00:04:55,170 --> 00:04:58,320 ‫and then we will choose High Availability. 121 00:04:58,320 --> 00:04:59,700 ‫Click on Next. 122 00:04:59,700 --> 00:05:01,380 ‫Then we go into the service, 123 00:05:01,380 --> 00:05:03,630 ‫we just click on Skip To Review. 124 00:05:03,630 --> 00:05:05,370 ‫And from that point onwards, 125 00:05:05,370 --> 00:05:08,430 ‫I know that everything is configured the way it should be. 126 00:05:08,430 --> 00:05:09,630 ‫So, it's just a safety, 127 00:05:09,630 --> 00:05:12,300 ‫but in my own experiments with this new console, 128 00:05:12,300 --> 00:05:14,220 ‫it may be a little rough around the edges. 129 00:05:14,220 --> 00:05:16,800 ‫So, when you're done, you just review all these parameters, 130 00:05:16,800 --> 00:05:18,930 ‫and then you click on Submit. 131 00:05:18,930 --> 00:05:21,750 ‫And here we go, my application is now launching, 132 00:05:21,750 --> 00:05:23,040 ‫and that will take about 10 minutes, 133 00:05:23,040 --> 00:05:25,860 ‫so we'll pause the video until this is done. 134 00:05:25,860 --> 00:05:29,640 ‫So, now my environment is ready, and I can click on this, 135 00:05:29,640 --> 00:05:31,650 ‫and open again the new Congratulations page. 136 00:05:31,650 --> 00:05:34,110 ‫So, from an app perspective, this is the same app, 137 00:05:34,110 --> 00:05:36,090 ‫it's just run differently. 138 00:05:36,090 --> 00:05:39,570 ‫So, if I go, for example, for my load balancers, 139 00:05:39,570 --> 00:05:42,300 ‫and refresh this page, as you can see now, 140 00:05:42,300 --> 00:05:44,100 ‫a load balancer has been created, 141 00:05:44,100 --> 00:05:46,830 ‫it's in three availability zones, and so on. 142 00:05:46,830 --> 00:05:48,270 ‫And there is a target group, 143 00:05:48,270 --> 00:05:52,050 ‫so this target group has one healthy instance, 144 00:05:52,050 --> 00:05:54,660 ‫and the healthy instance is an EC2 instance 145 00:05:54,660 --> 00:05:55,770 ‫that was created. 146 00:05:55,770 --> 00:06:00,120 ‫So, this EC2 instance corresponds to MyApplication-prod, 147 00:06:00,120 --> 00:06:02,430 ‫and we can have a look at the security group. 148 00:06:02,430 --> 00:06:05,640 ‫For example, there's one security group attached to it, 149 00:06:05,640 --> 00:06:09,600 ‫which allows port 80 coming from another security group. 150 00:06:09,600 --> 00:06:11,700 ‫And this security group right here 151 00:06:11,700 --> 00:06:13,890 ‫is the load balancer security group, 152 00:06:13,890 --> 00:06:17,190 ‫which allows port 80 from anywhere, 153 00:06:17,190 --> 00:06:21,960 ‫and allows outbounds on port 80 to anywhere as well, 154 00:06:21,960 --> 00:06:24,090 ‫so to be able to talk to our application. 155 00:06:24,090 --> 00:06:27,120 ‫Finally, if we go into the Autoscaling Groups, 156 00:06:27,120 --> 00:06:28,560 ‫we'll find right here that we have two. 157 00:06:28,560 --> 00:06:31,020 ‫There's one for our first application, 158 00:06:31,020 --> 00:06:32,370 ‫and one for our prod environment. 159 00:06:32,370 --> 00:06:33,570 ‫So, this one is our prod environment, 160 00:06:33,570 --> 00:06:37,290 ‫because we have min one, and max four capacity. 161 00:06:37,290 --> 00:06:38,460 ‫And if you look at it, 162 00:06:38,460 --> 00:06:40,650 ‫we can, for example, have a look at Instance Management, 163 00:06:40,650 --> 00:06:43,110 ‫and see that one is in service. 164 00:06:43,110 --> 00:06:44,340 ‫In terms of Automatic Scaling, 165 00:06:44,340 --> 00:06:46,620 ‫we can also have dynamic scaling policies 166 00:06:46,620 --> 00:06:50,010 ‫that have been set automatically by Elastic Beanstalk. 167 00:06:50,010 --> 00:06:51,300 ‫So, the beautiful thing about it 168 00:06:51,300 --> 00:06:54,060 ‫is that Beanstalk did pretty much configure everything 169 00:06:54,060 --> 00:06:56,880 ‫for us, and all we had to do was to upload the code, 170 00:06:56,880 --> 00:07:00,270 ‫and say we wanted to run it in high availability. 171 00:07:00,270 --> 00:07:02,070 ‫So, that really shows you the power of Beanstalk. 172 00:07:02,070 --> 00:07:04,320 ‫So, we now have two environments, 173 00:07:04,320 --> 00:07:08,340 ‫we have a prod and a dev environment, which is amazing. 174 00:07:08,340 --> 00:07:09,900 ‫And that's it for this lecture. 175 00:07:09,900 --> 00:07:12,900 ‫I hope you liked it, and I will see you in the next lecture.