- 00:00:01 hi everyone my name is max welcome to
- 00:00:04 this video great to have you on board
- 00:00:05 I already traded a couple of videos
- 00:00:08 where I showed what AWS is and how we
- 00:00:10 can use elastic Beanstalk to host an
- 00:00:13 application a lateral application to be
- 00:00:15 precise this one year now in this video
- 00:00:19 I want to take a closer look at what
- 00:00:20 elastic Beanstalk actually depth behind
- 00:00:22 the scenes and what we can configure
- 00:00:25 about our environment what environments
- 00:00:27 actually are and what we generally can
- 00:00:30 do in this elastic Beanstalk console so
- 00:00:33 let's get started
- 00:00:37 so mainly counsel of my project of this
- 00:00:40 lateral project I deployed in this video
- 00:00:43 here that's the right side I hope so
- 00:00:45 so this video and as you see is running
- 00:00:48 application it is connected to a
- 00:00:50 database and we already deployed two
- 00:00:53 different versions of the application in
- 00:00:55 that mentioned video now if we start
- 00:00:57 here on that dashboard of this
- 00:01:00 environment we're already one level
- 00:01:03 queue deep into dad application then I
- 00:01:06 want to be so let's instead switch to
- 00:01:09 all applications where we see not just
- 00:01:12 the environment but actually all our
- 00:01:14 applications and there is a difference
- 00:01:16 an application in elastic Beanstalk may
- 00:01:20 contain multiple environments as you can
- 00:01:22 see on this application
- 00:01:24 lateral simple block is the application
- 00:01:27 and we could create more applications
- 00:01:29 and prod here is the one environment in
- 00:01:33 this application and we could also
- 00:01:34 create more environments environments
- 00:01:36 would be something like a testing
- 00:01:38 environment a production environment may
- 00:01:40 be a new version of your app in a new
- 00:01:41 environment these would be environment
- 00:01:43 and they run separated from each other
- 00:01:45 each on their own servers you can simply
- 00:01:49 create a new environment and then again
- 00:01:51 you have to go through that wizard where
- 00:01:52 you set it up and assign a server and so
- 00:01:55 on you can also use the elastic
- 00:01:57 Beanstalk CLI at which I won't have a
- 00:01:59 closer look in this video to do all this
- 00:02:01 to create new applications and new
- 00:02:03 environments with that out of the way
- 00:02:06 let's go back to this environment here
- 00:02:08 we see the dashboard where you see the
- 00:02:10 current status of our application the
- 00:02:12 recent events that are successfully
- 00:02:14 updated the environment because the
- 00:02:16 shipped new code which operating system
- 00:02:18 were actually running and so on we can
- 00:02:21 deploy new version 2 of the upload and
- 00:02:23 deploy button we could always use to CLI
- 00:02:25 to automate this and then we have all
- 00:02:28 these options on the left now before we
- 00:02:31 go to configuration let's have a look at
- 00:02:32 logs here we can actually retrieve our
- 00:02:35 logs and for that we have to request
- 00:02:38 them so we can request the last hundred
- 00:02:41 lines here and logging is set up
- 00:02:43 automatically for us this however now
- 00:02:46 fetches the latest logs and now we could
- 00:02:49 download them and have a look at
- 00:02:51 so if you click this button we see the
- 00:02:52 latest log files and you will see what
- 00:02:55 happened on our server that we had a 400
- 00:02:57 feet free error there and well whatever
- 00:03:00 happened on the server these are logs
- 00:03:03 and certainly something which might be
- 00:03:05 interesting to you in a real application
- 00:03:06 where you want to well detect any
- 00:03:09 anomalies detect any errors stuff like
- 00:03:12 that we also get the Health section this
- 00:03:16 shows us the overall health of our
- 00:03:18 application we can see the kind of
- 00:03:20 requests we gather the responses we send
- 00:03:23 and since this applications pretty new
- 00:03:25 most of that is not populated yet but
- 00:03:28 here we can monitor what's going on and
- 00:03:30 we can drill down on that and see how
- 00:03:32 many instances we have running one and
- 00:03:35 how that is well feeling right now it's
- 00:03:38 okay as a side note and I did show this
- 00:03:40 before in another video you can always
- 00:03:43 switch to ec2 console I'm doing the same
- 00:03:46 you tab and here under running instances
- 00:03:49 this instance is the one connected to
- 00:03:51 our elastic Beanstalk setup or it's the
- 00:03:54 one managed through elastic Beanstalk so
- 00:03:57 this is the one instance we're referring
- 00:03:59 to here and we can see that here this is
- 00:04:01 the instance ID and as you will see it's
- 00:04:03 obviously the same ID as here so that is
- 00:04:06 the ID and here while we could for
- 00:04:08 example do something with it like reboot
- 00:04:11 or terminate it if we wanted so this
- 00:04:14 page allows to track the health of our
- 00:04:17 instances and therefore the health of
- 00:04:18 our application under monitoring we can
- 00:04:22 see how our our F behaves in some charts
- 00:04:25 so the CPU utilization and so on
- 00:04:28 so this is a lot it gives you a nice and
- 00:04:30 quick overview over what's going on in
- 00:04:32 your application without looking at the
- 00:04:34 logs and so on under alarms you see any
- 00:04:38 alarms you might have gotten you can
- 00:04:39 configure them under monitoring here
- 00:04:42 here for example you could set an alarm
- 00:04:45 on environment health and you could
- 00:04:47 configure when you want to get an alert
- 00:04:49 for example at the environment health is
- 00:04:51 below a certain status for 1 minute or
- 00:04:54 something like that and you could set up
- 00:04:55 that you get an email when this happens
- 00:04:58 also very nice for production
- 00:05:00 applications managed updates is pretty
- 00:05:04 you can set it up under configuration so
- 00:05:06 I will come back to this here on this
- 00:05:09 page you'll then get an overview and
- 00:05:10 managed updates will allow you to opt
- 00:05:12 into managed updates through AWS so that
- 00:05:16 they update critical software on your
- 00:05:19 instance automatically for you
- 00:05:21 which of course is important from a
- 00:05:22 security perspective now under events
- 00:05:25 you can see which events we had for
- 00:05:28 example that we updated the environment
- 00:05:30 and how that went and under text we can
- 00:05:32 assign some tags or CD assign tags to be
- 00:05:35 precise which will show up in our
- 00:05:38 billing for example so that we can track
- 00:05:40 where our costs are coming from these
- 00:05:43 are all these options now let's have a
- 00:05:45 look at configuration that's probably
- 00:05:46 the most interesting one well here for
- 00:05:49 example to go from start to end we have
- 00:05:51 scaling if we open this we see that
- 00:05:54 right now we have a single instance
- 00:05:56 scaling and that is because we only have
- 00:05:59 one instance now of course as your
- 00:06:01 application grows you might want to have
- 00:06:02 more instances here which distribute the
- 00:06:04 load
- 00:06:05 you could then switch to load balancing
- 00:06:07 is auto scaling and there you could then
- 00:06:10 USB built-in tools load balancer and
- 00:06:13 auto scaling these are services provided
- 00:06:16 by AWS which will distribute incoming
- 00:06:18 traffic evenly amongst all your
- 00:06:21 instances and which even allow you to
- 00:06:23 spin up new instances to handle certain
- 00:06:25 traffic spikes and remove them once
- 00:06:28 they're not needed anymore so that's
- 00:06:29 really powerful I'll go back to a single
- 00:06:32 instance but this is something you
- 00:06:34 definitely want to look into once your
- 00:06:35 application grows and you need more
- 00:06:37 servers back to single instance you can
- 00:06:40 all choose in whichever lab dalek you
- 00:06:42 zone you want to launch new instances
- 00:06:44 however I will leave this at the minimum
- 00:06:47 and for now we only have that one
- 00:06:49 instance that leads us to the instances
- 00:06:52 here you can see which type of instance
- 00:06:54 were using and we could change this to
- 00:06:56 upgrade our application to a weld pool
- 00:06:58 more powerful instance for example we
- 00:07:01 can also see which security group this
- 00:07:04 instance belongs to security groups are
- 00:07:06 basically firewalls you could say which
- 00:07:08 allow or which control which traffic may
- 00:07:11 reach our instances and which traffic
- 00:07:13 may leave our instances
- 00:07:15 here we can set up easy to keep air
- 00:07:18 which you'll need if we manually want to
- 00:07:20 connect to the instance through SSH then
- 00:07:22 we will need this key pair to identify
- 00:07:24 ourselves and set up our encrypted
- 00:07:26 access to the key or to the ec2 instance
- 00:07:29 the instance profile here that is one
- 00:07:33 will we can't change anything here this
- 00:07:35 is required by elastic Beanstalk we have
- 00:07:38 to write permissions to manage the
- 00:07:40 instance for you it was created
- 00:07:42 automatically and it basically allows
- 00:07:44 elastic Beanstalk to spin up incentives
- 00:07:46 terminate em and so on so what it needs
- 00:07:48 to do behind the scenes for us how often
- 00:07:51 should monitor the health of the
- 00:07:52 instances which ami it uses to which
- 00:07:55 image this defines the operating system
- 00:07:57 and software installed on that instance
- 00:08:00 and then here we can also setup which
- 00:08:03 kind of volume you want to have like
- 00:08:05 your the default we could attach an SSD
- 00:08:07 and define how much space you want to
- 00:08:09 have so here we can control the server
- 00:08:11 we're running on and again we can't
- 00:08:13 after it here vertically choose a
- 00:08:16 stronger instance or we go back to
- 00:08:19 scaling and switch from single instance
- 00:08:22 to load balancing all scaling to launch
- 00:08:24 multiple instances so when we do that
- 00:08:27 and click apply and this will now update
- 00:08:30 our application and as it informs us
- 00:08:33 replace all our current instances so
- 00:08:36 let's click Save be aware that switching
- 00:08:38 from one to multiple instances may occur
- 00:08:41 cost especially if you leave it run for
- 00:08:43 a whole month because you only have one
- 00:08:45 month where 750 hours which is one month
- 00:08:48 in hours per month of the t2 micro
- 00:08:51 instance is available so if you spend up
- 00:08:53 two of them you're going to pay for one
- 00:08:54 of them if you spend up more powerful
- 00:08:56 ones you're going to pay more so be
- 00:08:58 aware of that still I'm going to show
- 00:09:00 this to you now this may take a couple
- 00:09:02 of minutes here actually since it's
- 00:09:04 switching your complete environment and
- 00:09:06 in the ec2 management console you should
- 00:09:08 see that from some point on it will
- 00:09:10 terminate this instance and spin up a
- 00:09:12 new one
- 00:09:15 now I did finish and if we go get back
- 00:09:18 to configuration we see that now under
- 00:09:20 scaling we can configure more we can
- 00:09:23 configure all the scaling and here we
- 00:09:25 can set up how many instances servers we
- 00:09:27 want to have at a minimum and at a
- 00:09:29 maximum and also in which availability
- 00:09:32 zones we want to launch them this now
- 00:09:35 allows AWS to automatically scale our
- 00:09:38 instances of add new servers on which
- 00:09:40 our application will run whenever we hit
- 00:09:43 a traffic spike for example the scaling
- 00:09:47 trigger is set up here and there it
- 00:09:49 configures upon which condition it will
- 00:09:52 add new servers and how long that
- 00:09:54 condition has to be true that is a
- 00:09:57 powerful tool since it allows you to
- 00:09:59 really react to traffic spikes it's also
- 00:10:03 a kind of advanced tool not in terms of
- 00:10:07 setting it up that's what there was easy
- 00:10:08 but in terms of getting it right for big
- 00:10:11 applications and I just want to give you
- 00:10:13 a sneak preview here for your ordinary
- 00:10:15 normal application the default setup
- 00:10:18 will should be absolutely fine for
- 00:10:19 bigger applications though if that is
- 00:10:21 how our traffic works over a day over 24
- 00:10:24 hours for example then we could have a
- 00:10:27 default setup of this we have a constant
- 00:10:29 amount of service we have no auto
- 00:10:30 scaling and we have only one server up
- 00:10:33 but this server is constantly a very
- 00:10:36 relatively strong server now the problem
- 00:10:39 with this approach is that we will face
- 00:10:40 server issues during these spikes
- 00:10:42 because the server capacity doesn't
- 00:10:44 suffice so an alternative might be to
- 00:10:47 set up auto scaling with twice the
- 00:10:50 amount so now if we have Q's servers up
- 00:10:52 in each hour here and that is an app
- 00:10:55 capacity for all the spikes of course
- 00:10:58 all's a lot of wasted or overhead
- 00:11:00 capacity so we're paying too much a
- 00:11:03 better solution would be to use auto
- 00:11:05 scaling and there we bring up additional
- 00:11:08 servers when we need to handle these
- 00:11:10 spikes much better already
- 00:11:12 but still as you can see there is a lot
- 00:11:14 of overhead or at least a bit of
- 00:11:16 overhead so we can do better so the
- 00:11:19 perfect approach would be to calibrate
- 00:11:21 all the scaling to launch smaller
- 00:11:23 instances not such powerful ones
- 00:11:26 but more of these however in the long
- 00:11:29 term are overall it will still be
- 00:11:30 cheaper because the powerful ones are
- 00:11:32 more expensive and we don't require them
- 00:11:35 for most of the time so this might be a
- 00:11:37 perfect auto-scaling setup where we
- 00:11:40 scale up to four of the not so powerful
- 00:11:43 instances and we really calibrate our
- 00:11:46 application to handle these traffic
- 00:11:48 spikes now that is quite advanced but
- 00:11:50 that is how all the scaling works
- 00:11:51 it adds new servers to handle incoming
- 00:11:55 traffic spikes and it is a lot about
- 00:11:57 really testing that and seeing what is
- 00:12:00 best from a cost and server perspective
- 00:12:02 that was a little advanced topic let's
- 00:12:06 go back to elastic beanstalk auto
- 00:12:09 scaling is set up that is what we can
- 00:12:11 take away from that and not just all the
- 00:12:13 scaling also load balancing because load
- 00:12:17 balancing is the other interesting thing
- 00:12:18 in that equation we might have more than
- 00:12:21 one instance we are free now all these
- 00:12:24 instances are doing something so one
- 00:12:28 instance might not be so much under
- 00:12:30 stress another one might be very
- 00:12:32 stressed and might be close to well
- 00:12:34 being overloaded with an incoming
- 00:12:37 request and this request might do to our
- 00:12:40 setup whatever hit instance free which
- 00:12:43 can handle it by which is not the best
- 00:12:45 instance instead we should handle it
- 00:12:47 here and that is exactly what load
- 00:12:49 balancing will take care of with load
- 00:12:51 balancing we have two instances and we
- 00:12:53 have a service called elastic load
- 00:12:55 balancer also added to our elastic
- 00:12:57 Beanstalk setup here so both elastic but
- 00:13:00 two different services and this service
- 00:13:03 elastic load balancer will route
- 00:13:05 incoming requests cue different
- 00:13:08 instances depending on their health
- 00:13:10 their response time to see how occupied
- 00:13:12 they are so it may route one request to
- 00:13:15 instance one and a second one to
- 00:13:16 instance two we can even combine this
- 00:13:19 with auto-scaling queue add new servers
- 00:13:22 where needed auto scaling will for this
- 00:13:24 all the reuse you set up off the
- 00:13:26 existing servers to copy our set up in
- 00:13:28 our application and load balancer will
- 00:13:31 pick these new servers up and all those
- 00:13:33 forward requests to them so that is how
- 00:13:35 both works together and you don't have
- 00:13:37 to manage anything about that it's all
- 00:13:39 set up here
- 00:13:40 by elastic beanstalk you can calibrate
- 00:13:42 it a bit here you can set up your
- 00:13:44 scaling triggers and to find how many
- 00:13:46 instances you want to launch and so on
- 00:13:48 you can still choose which type of
- 00:13:50 instances that would be here under
- 00:13:52 instances so these instances will be
- 00:13:54 launched by the auto scaling and that is
- 00:13:56 how these two work together and really
- 00:13:58 make sure that your application works as
- 00:14:00 it should as you can see if I waited it
- 00:14:03 it still works as before but under the
- 00:14:05 hood it now has a more complex setup
- 00:14:07 that was a lot of talking about all the
- 00:14:09 scaling and the instances but it is
- 00:14:11 important to understand what's happening
- 00:14:12 here and what elastic Beanstalk can do
- 00:14:15 for you in bigger applications auto
- 00:14:17 scaling and distribute incoming traffic
- 00:14:19 amongst all instances you might have
- 00:14:21 running what about notifications here
- 00:14:25 you can get notifications you can set up
- 00:14:27 an email address where you will be
- 00:14:29 informed about elastic beanstalk events
- 00:14:31 like if the health transitions to
- 00:14:33 degrade it or something like that under
- 00:14:36 software configuration we already saw
- 00:14:38 that in another video you can define
- 00:14:41 things about your server basically from
- 00:14:43 where your web app is served which how
- 00:14:46 much memory should be allocated how you
- 00:14:48 want your outputs errors and then some
- 00:14:50 stuff about logging also very useful of
- 00:14:53 course updates and deployments is
- 00:14:56 interesting because here you can
- 00:14:57 configure how updates so new code should
- 00:15:00 be shipped to your servers if you have
- 00:15:03 more than one instance you can actually
- 00:15:05 choose rolling if you have only ones
- 00:15:08 that will not be available because what
- 00:15:10 will Rowling do if you have more than
- 00:15:12 one instance it will ship new code to
- 00:15:14 one instance first and then ship it to
- 00:15:18 the next one so that you all the time
- 00:15:20 until all instances have been updated
- 00:15:22 have instances with old code and new
- 00:15:24 code and hence your application is
- 00:15:26 always online because it's the old code
- 00:15:29 or it already was updated if you only
- 00:15:31 have one instance there's of course a
- 00:15:33 short window a short time window where
- 00:15:35 it will be offline because the code is
- 00:15:37 getting replaced right now rolling can
- 00:15:40 prevent this if you have multiple
- 00:15:41 instances there are some Advanced
- 00:15:44 Options here and you can always learn
- 00:15:46 more as you can see but that is
- 00:15:48 basically what you can configure here
- 00:15:49 now besides the application deployments
- 00:15:52 you can also change configuration
- 00:15:53 updates so whenever you change the
- 00:15:55 configuration of your server and there
- 00:15:57 you can also set this to rolling for
- 00:15:59 example and configure how these changes
- 00:16:01 should be rolled out because just like
- 00:16:03 your application code if it changes if
- 00:16:05 you change the configuration even worse
- 00:16:08 than your application code there may be
- 00:16:10 a server restart required so that is
- 00:16:13 something you also want to handle this
- 00:16:15 is what you can configure here your game
- 00:16:18 can also configure all the scaling here
- 00:16:20 but that could be done under scaling so
- 00:16:22 that's updates and deployment health
- 00:16:25 here you can determine or you can setup
- 00:16:28 how elastic load balancer will find out
- 00:16:31 if your application if your instances
- 00:16:34 are healthy you can pass your own URL
- 00:16:36 where it should send a ping and
- 00:16:38 depending on the ping he'll pass this
- 00:16:41 ping response and if it responds at all
- 00:16:42 it will determine if your application is
- 00:16:44 healthy the default should be fine here
- 00:16:47 but you can configure elastic load
- 00:16:49 balancer here a bit more if you are
- 00:16:51 interested in that finally managed
- 00:16:56 updates that's also interesting here you
- 00:16:59 can configure if AWS elastic beanstalk
- 00:17:01 should update your server your your
- 00:17:05 software on the server it will not
- 00:17:07 install breaking changes or breaking
- 00:17:10 software changes but it can install mine
- 00:17:13 or attach updates or just patch if you
- 00:17:15 read just want to get these security
- 00:17:16 patches so that's a useful feature to
- 00:17:18 make sure that your application is
- 00:17:20 always up to date and that you get the
- 00:17:24 latest security fixes now this will
- 00:17:26 update the application we can still move
- 00:17:29 on to the last thing or to the almost
- 00:17:31 last config item here the data here the
- 00:17:35 database we did set this up in a
- 00:17:37 different video
- 00:17:38 here you can basically change some of
- 00:17:40 the configurations for example which
- 00:17:42 kind of database you use you could
- 00:17:43 upgrade here our things can't be changed
- 00:17:46 here you can always use RDS to change
- 00:17:48 things though then you will also well
- 00:17:51 remove it from from here so it's
- 00:17:53 preferable that you change it here in
- 00:17:54 the elastic Beanstalk console to stay in
- 00:17:56 that elastic Beanstalk world where
- 00:17:58 elastic Beanstalk manages everything for
- 00:18:00 you and finally at the bottom on the
- 00:18:02 network here you can set up how your
- 00:18:05 application is
- 00:18:06 served and how it is reachable it is
- 00:18:08 important for the load balancer here
- 00:18:10 here you can configure this elastic load
- 00:18:12 balancer is a bit more can set up how it
- 00:18:15 determines the instance help and so on
- 00:18:17 and that is really something where you
- 00:18:18 can dive in deeper if you know how it
- 00:18:20 works as always all the default settings
- 00:18:23 should be fine these are always things
- 00:18:26 you can change but for a starting
- 00:18:28 application you don't need you and as
- 00:18:31 you work more and more with a tell us
- 00:18:32 you will get deeper into it and know
- 00:18:35 what you may change and why so this was
- 00:18:38 an overview over elastic Beanstalk what
- 00:18:42 you can view here how it works how you
- 00:18:44 can upgrade from your simple single
- 00:18:46 instance application to a multi instance
- 00:18:48 auto scales
- 00:18:50 load balanced application I hope this
- 00:18:52 was helpful and you didn't choice and
- 00:18:54 that with that and the other videos
- 00:18:56 using AWS and using Beanstalk is a bit
- 00:19:00 clearer it might look intimidating if
- 00:19:03 you see all these options but always
- 00:19:04 keep in mind you can start it simple and
- 00:19:07 then add more and more features as you
- 00:19:10 need them