1 00:00:00,210 --> 00:00:01,470 ‫Okay, so now let's talk about 2 00:00:01,470 --> 00:00:02,790 ‫Elastic Beanstalk. 3 00:00:02,790 --> 00:00:04,080 ‫So far in this course 4 00:00:04,080 --> 00:00:06,420 ‫when we've been deploying an application 5 00:00:06,420 --> 00:00:08,430 ‫we've had the same architecture. 6 00:00:08,430 --> 00:00:09,870 ‫So we have a load balancer 7 00:00:09,870 --> 00:00:11,850 ‫that is taking all the requests from our users, 8 00:00:11,850 --> 00:00:13,710 ‫and then we have an auto scanning group 9 00:00:13,710 --> 00:00:15,870 ‫with multiple availability zones. 10 00:00:15,870 --> 00:00:18,270 ‫And in each AZ there will be some EC2 instances 11 00:00:18,270 --> 00:00:19,470 ‫being deployed there. 12 00:00:19,470 --> 00:00:22,770 ‫And then in the backend we have maybe some data subnets. 13 00:00:22,770 --> 00:00:25,740 ‫So we have an RDS database to take the reads and the writes 14 00:00:25,740 --> 00:00:27,570 ‫maybe we'll have some read applications and so on. 15 00:00:27,570 --> 00:00:29,370 ‫And then if we communication layer, 16 00:00:29,370 --> 00:00:32,100 ‫we the cache layer we need to look at Elastic Cache. 17 00:00:32,100 --> 00:00:35,400 ‫So if there are so many applications for us to deploy 18 00:00:35,400 --> 00:00:36,930 ‫and they follow the same architecture 19 00:00:36,930 --> 00:00:39,840 ‫it may be a pain to recreate it every single time. 20 00:00:39,840 --> 00:00:43,080 ‫So as a developer it's complicated to manage infrastructure, 21 00:00:43,080 --> 00:00:44,252 ‫to deploy code. 22 00:00:44,252 --> 00:00:46,260 ‫We don't want to be configuring all the databases 23 00:00:46,260 --> 00:00:47,850 ‫the load balance, et cetera, et cetera. 24 00:00:47,850 --> 00:00:50,100 ‫And of course, we want everything to be scaling. 25 00:00:50,100 --> 00:00:52,830 ‫So as we can see, most of the web applications 26 00:00:52,830 --> 00:00:54,810 ‫will have the same architecture with a load balancer 27 00:00:54,810 --> 00:00:56,190 ‫and a auto scanning group. 28 00:00:56,190 --> 00:00:57,390 ‫And as a developer 29 00:00:57,390 --> 00:00:59,640 ‫all I want to do is for my code to run, okay? 30 00:00:59,640 --> 00:01:02,100 ‫I don't want to worry about everything else. 31 00:01:02,100 --> 00:01:05,550 ‫So also, if I develop in different programming languages 32 00:01:05,550 --> 00:01:07,380 ‫and have different applications and environments 33 00:01:07,380 --> 00:01:10,860 ‫I possibly want a single way of deploying my application. 34 00:01:10,860 --> 00:01:13,440 ‫And this is where Beanstalk comes into play. 35 00:01:13,440 --> 00:01:16,140 ‫So Beanstalk gives a developer-centric view 36 00:01:16,140 --> 00:01:18,870 ‫of deploying on application on AWS. 37 00:01:18,870 --> 00:01:21,030 ‫The idea is that from one single interface 38 00:01:21,030 --> 00:01:22,710 ‫it's going to reuse all the components 39 00:01:22,710 --> 00:01:27,060 ‫we've had seen before, such as EC2, ASG, ELB, RDS. 40 00:01:27,060 --> 00:01:28,650 ‫But it's going to be a managed service 41 00:01:28,650 --> 00:01:30,330 ‫that will deploy all these things for you. 42 00:01:30,330 --> 00:01:32,430 ‫So it will handle the capacity provisioning. 43 00:01:32,430 --> 00:01:34,050 ‫It will handle the configuration, the load balancer 44 00:01:34,050 --> 00:01:36,330 ‫the scaling, the application health monitoring, 45 00:01:36,330 --> 00:01:38,190 ‫the instance configuration, and so on. 46 00:01:38,190 --> 00:01:40,800 ‫And the only responsibility for you as a developer 47 00:01:40,800 --> 00:01:43,140 ‫is going to be the code itself, okay? 48 00:01:43,140 --> 00:01:44,040 ‫You still have full control 49 00:01:44,040 --> 00:01:46,020 ‫over the configuration of each component, 50 00:01:46,020 --> 00:01:48,780 ‫but at least become bundled as one single interface 51 00:01:48,780 --> 00:01:49,980 ‫in Beanstalk. 52 00:01:49,980 --> 00:01:50,970 ‫And the idea is that Beanstalk 53 00:01:50,970 --> 00:01:53,790 ‫also has a really cool way of updating applications. 54 00:01:53,790 --> 00:01:56,040 ‫So the Beanstalk service is free on its own 55 00:01:56,040 --> 00:01:58,053 ‫but you're going to pay for the underlying instances 56 00:01:58,053 --> 00:02:01,590 ‫that are going to be leveraged by Beanstalk or your ASG 57 00:02:01,590 --> 00:02:03,300 ‫or your ELB, this kind of things. 58 00:02:03,300 --> 00:02:06,870 ‫So components of Beanstalk consist of an application 59 00:02:06,870 --> 00:02:08,550 ‫which is a collection of Beanstalk components 60 00:02:08,550 --> 00:02:11,670 ‫such as environments, versions, and configurations. 61 00:02:11,670 --> 00:02:13,500 ‫A version of the application itself 62 00:02:13,500 --> 00:02:15,420 ‫is an iteration of your application code. 63 00:02:15,420 --> 00:02:17,537 ‫So you can have version one, version two 64 00:02:17,537 --> 00:02:18,510 ‫version three, et cetera, et cetera. 65 00:02:18,510 --> 00:02:20,640 ‫Then an environment which is a collection 66 00:02:20,640 --> 00:02:24,330 ‫of your resources running the specific application version. 67 00:02:24,330 --> 00:02:26,310 ‫So you can only have one application version at a time. 68 00:02:26,310 --> 00:02:28,876 ‫In an environment where we can see, we will see, 69 00:02:28,876 --> 00:02:32,160 ‫we can actually update an application version 70 00:02:32,160 --> 00:02:34,530 ‫within an environment from version one to version two. 71 00:02:34,530 --> 00:02:35,363 ‫We have tiers. 72 00:02:35,363 --> 00:02:36,840 ‫So we can have two different tiers in Beanstalk. 73 00:02:36,840 --> 00:02:39,030 ‫We have the web server environment here 74 00:02:39,030 --> 00:02:41,170 ‫and the worker environment here. 75 00:02:41,170 --> 00:02:42,003 ‫We'll see this very quickly. 76 00:02:42,003 --> 00:02:45,540 ‫And we can also create multiple environments in Beanstalk 77 00:02:45,540 --> 00:02:48,540 ‫such as dev, test and prod. 78 00:02:48,540 --> 00:02:50,460 ‫And whatever environment you have in mind, really. 79 00:02:50,460 --> 00:02:52,560 ‫So the process is to create an application. 80 00:02:52,560 --> 00:02:54,240 ‫Then we upload a version 81 00:02:54,240 --> 00:02:56,550 ‫then we are going to launch an environment 82 00:02:56,550 --> 00:02:58,740 ‫and then we're going to manage an environment life cycle. 83 00:02:58,740 --> 00:03:00,240 ‫And if you wanted to iterate on that 84 00:03:00,240 --> 00:03:02,610 ‫we could update the version by uploading a new version 85 00:03:02,610 --> 00:03:04,320 ‫and then deploy that new version again 86 00:03:04,320 --> 00:03:07,560 ‫in our environment to update our application stack. 87 00:03:07,560 --> 00:03:09,420 ‫So Beanstalk supports many program languages 88 00:03:09,420 --> 00:03:12,037 ‫such as Go Java SE, Java with Tomcat, 89 00:03:12,037 --> 00:03:14,250 ‫.NET Core on Linux, .NET Core on Windows Server, 90 00:03:14,250 --> 00:03:17,250 ‫Node.js, PHP, Python, Ruby, Packer Builder, 91 00:03:17,250 --> 00:03:19,500 ‫Single Docker Container, Multi Docker Container, 92 00:03:19,500 --> 00:03:20,610 ‫Preconfigured Docker. 93 00:03:20,610 --> 00:03:23,160 ‫And if your program language is not here 94 00:03:23,160 --> 00:03:25,710 ‫you can create your own custom platform, which is advanced. 95 00:03:25,710 --> 00:03:27,210 ‫So the idea is that on Beanstalk 96 00:03:27,210 --> 00:03:29,730 ‫you should be able to deploy pretty much anything. 97 00:03:29,730 --> 00:03:30,563 ‫Now to finish, 98 00:03:30,563 --> 00:03:33,570 ‫what do I mean by server tier and worker tier? 99 00:03:33,570 --> 00:03:35,970 ‫While the web tier is looking like this 100 00:03:35,970 --> 00:03:37,230 ‫this is the traditional architecture 101 00:03:37,230 --> 00:03:39,480 ‫that we know where we have a load answer. 102 00:03:39,480 --> 00:03:40,950 ‫And then it's sending traffic 103 00:03:40,950 --> 00:03:43,803 ‫to an autoscaling group that has multiple EC2 instances 104 00:03:43,803 --> 00:03:45,360 ‫that are going to be your web servers. 105 00:03:45,360 --> 00:03:48,090 ‫This is the architecture number one with Beanstalk. 106 00:03:48,090 --> 00:03:49,710 ‫And the architecture number two with Beanstalk 107 00:03:49,710 --> 00:03:52,140 ‫is going to be around a worker environment. 108 00:03:52,140 --> 00:03:54,870 ‫So this time there is no clients accessing directly 109 00:03:54,870 --> 00:03:56,070 ‫your EC2 instances. 110 00:03:56,070 --> 00:03:59,430 ‫We're going to use an SQS Queue, which is a message queue 111 00:03:59,430 --> 00:04:02,220 ‫and the message will be sent into the SQS Queue. 112 00:04:02,220 --> 00:04:04,350 ‫And the EC2 instances are gonna be workers 113 00:04:04,350 --> 00:04:06,030 ‫because they're going to pull messages 114 00:04:06,030 --> 00:04:08,490 ‫from the SQS Queue to process them. 115 00:04:08,490 --> 00:04:12,300 ‫And in this case the worker environment 116 00:04:12,300 --> 00:04:15,060 ‫is going to scale based on the number of SQS messages. 117 00:04:15,060 --> 00:04:17,910 ‫So the more messages, the more EC2 instances. 118 00:04:17,910 --> 00:04:19,140 ‫And then the cool thing 119 00:04:19,140 --> 00:04:21,459 ‫is that you can put the web environment 120 00:04:21,459 --> 00:04:22,350 ‫and the work environment together 121 00:04:23,331 --> 00:04:24,510 ‫by having the web environment push some messages 122 00:04:24,510 --> 00:04:27,450 ‫into the SQS Queue of the worker environment. 123 00:04:27,450 --> 00:04:29,430 ‫Finally, there are two deployment modes 124 00:04:29,430 --> 00:04:30,510 ‫you need to know for Beanstalk. 125 00:04:30,510 --> 00:04:32,370 ‫The first one is a single instance, 126 00:04:32,370 --> 00:04:34,200 ‫which is great for development purposes. 127 00:04:34,200 --> 00:04:36,690 ‫In this case, you'll have one EC2 instance 128 00:04:36,690 --> 00:04:38,400 ‫which will have an Elastic IP, 129 00:04:38,400 --> 00:04:40,860 ‫potentially you can also launch an RDS database and so on. 130 00:04:40,860 --> 00:04:44,010 ‫But it's all based on one instance with Elastic IP. 131 00:04:44,010 --> 00:04:45,330 ‫It's great for development purposes, 132 00:04:45,330 --> 00:04:48,060 ‫but then if you wanted to scale a real 133 00:04:48,060 --> 00:04:49,500 ‫Elastic Beanstalk mode 134 00:04:49,500 --> 00:04:52,920 ‫then you will go for high availability with low balancer 135 00:04:52,920 --> 00:04:54,780 ‫which is great for production environments, 136 00:04:54,780 --> 00:04:57,120 ‫in which case you can have a load balancer 137 00:04:57,120 --> 00:05:00,180 ‫distributing the loads across multiple EC2 instances 138 00:05:00,180 --> 00:05:02,730 ‫that are managed for an autoscaling group 139 00:05:02,730 --> 00:05:04,980 ‫and multiple availability zones. 140 00:05:04,980 --> 00:05:07,290 ‫And finally you may have an RDS database 141 00:05:07,290 --> 00:05:11,280 ‫that's also multi AZ with a Master and a Standby. 142 00:05:11,280 --> 00:05:12,120 ‫Alright, that's it. 143 00:05:12,120 --> 00:05:15,070 ‫I hope you liked it and I will see you in the next lecture.