Welcome back to BackSpace Academy. Elastic Beanstalk it's one of AWS 2
deployment services and it allows you to deploy your applications to complex 3
architectures on AWS and it does this without you having to worry about the 4
underlying architecture that is behind that. Elastic Beanstalk it looks after 5
everything for you and you just need to worry about writing your code. We'll also 6
talk about how Elastic Beanstalk can create highly available and fault 7
tolerant architectures and what that actually means, and then finally we'll 8
look at the different deployment options that are available on Elastic Beanstalk. 9
Elastic Beanstalk it's been around for quite some time. It was first launched in 2011 10
it allows you to quickly deploy and manage applications on environments and 11
those environments are launched for you without you having to worry about how it 12
all works, it'll automatically handle capacity provisioning, it'll launch a 13
load balancer for you if you need that, it'll Auto scale for you and it can also 14
implement health monitoring so that if one of these instances that are launched 15
becomes unhealthy it can replace those automatically for you. If you need to change 16
your code after you have deployed it it's quite easy to upload new versions 17
of that code and that can be done through the console or the 18
command-line interface and also complete environments can also be 19
redeployed if need be. Your application that you're deploying could be a Docker 20
container it could be raw code it could be nodejs 21
java, .net. PHP, Ruby, Python, or GO you just supply your code and Elastic Beanstalk 22
will deploy that for you and it will provision that nodejs or whatever 23
environment for you automatically or it could be a service such as apache, nginx 24
passenger or IIS the elastic Beanstalk process it starts with us going through 25
an application creation process where we will first off upload a version of 26
our software or our code or whatever it is and then elastic Beanstalk will 27
launch an environment and that will consist of a EC2 instances 28
or it could be a single EC2 instance it could be a multi AZ 29
environment but we define that for Elastic Beanstalk and it will do that 30
automatically for us, from there we will have our environment launched and our 31
code will be running on that environment, now if we find that we need to deploy a 32
new version of that code we can deploy that to that existing environment or we 33
can create a whole new environment it doesn't really matter, so if we deployed 34
it to our existing environment then when that environment has gone through that 35
update process and the new version is deployed and running then the 36
environment will feed back to the application to notify that that new 37
version of your application is actually running 38
one of the big advantages of elastic beanstalk is it can create a highly 39
available and fault tolerant architecture without us having to worry 40
about how to actually do that, so what is a highly available and fault tolerant 41
architecture so here we've got the AWS cloud and as we know it's divided up 42
into regions and those regions are divided up into availability zones so 43
we've if we have our architecture distributed across multiple availability 44
zones if one of those availability zones goes down our infrastructure will still 45
continue to operate and serve requests now our virtual private cloud that will 46
span the entire region so it will span multiple availability zones and so what 47
we can do is that we can launch instances into both of those 48
availability zones and that's going to give us high availability if one of 49
those availability zones goes down, now in order for our architecture to respond 50
to spikes in demand or increases in demand because an availability zone goes 51
down what we can do is we can launch our instances using an auto scaling group 52
so if demand on one of those or a group of instances increases the auto scaling 53
group will add instances to accommodate that and vice versa 54
if the demand goes down we will reduce our number of ec2 instances and that 55
allows for elasticity in our design and finally to receive requests from the 56
outside world and to distribute those requests to those multiple instances 57
we're going to need an elastic load balancer to do that and that will also 58
have the advantage of conducting health checks on our instances so that if 59
communication breaks down between the elastic load balancer and our ec2 60
instance then our auto scaling group will automatically add additional 61
instances and that creates fault tolerance in our architecture 62
just the same as you've got a number of options available for architecture that you're 63
deploying to such as a single ec2 instance or a highly 64
available and fault-tolerant architecture across multiple 65
availability zones you've also got a number of different deployment options 66
that you can use so for example if you've got 20 ec2 instances and all at 67
once deployment will deploy that across all of those 20 ec2 instances all at 68
once the downside of that is going to be that while that is occurring your 69
architecture won't be able to respond to requests so that's obviously not a good thing 70
so another option there is to do a rolling deployment and that will deploy 71
your application to a single batch at a time, so what that means is if you've got 72
20 ec2 instances it can deploy that to say two at a time so you're not going to 73
be down by much you're just going to be down from 20 instances down to 18 74
instances but your architecture will still be responding to requests 75
you can also do a rolling with an additional batch so what that will do is if you've 76
got again 20 ez 2 instances it will temporarily increase to 22 while you're 77
doing those two deployments across those two ec2 instances and that way you're 78
still going to have your capacity at 20 is which is what you have designed for 79
the other option there is an immutable deployment and that is a bit of a 80
variation of the all at once so it's still doing an all at once deployment 81
across your 20 ec2 instances but while that's going on it's going to deploy 82
another 20 ec2 instances so temporarily you're going to have 40 ec2 instances so 83
it's going to double up a lot on your capacity but through that period where 84
your environment is being deployed or your new version or whatever has being 85
deployed to that environment you're not going to be suffering any downtime and 86
finally we've got blue green deployments and they will have two environments a 87
tree running your application under the one elastic Beanstalk application and so 88
what that is is you will have a blue environment and in green environment one 89
of those could be a development environment and the other one 90
your production environment so when you get to the stage where your development 91
environment is ready to go to be deployed to deploy that all you simply 92
need to do is to switch over from one environment to the other environment and 93
then your old environment will then become your new development environment 94
and so that is very straightforward with elastic Beanstalk because what it does 95
it will simply allow you to switch the domain names for those two environments 96
automatically for you and so that makes sure that your changeover doesn't read 97
or doesn't involve any downtime for returning of requests later on in the 98
course we're going to learn a lot more about Bluegreen deployments and how to 99
deploy those across elastic Beanstalk so but coming up next we're going to use 100
elastic Beanstalk to deploy a highly available and fault tolerant 101
architecture so make sure that you download the lab notes for this one and 102
I'll see you in the lab