Welcome back to Backspace academy. In this lecture we'll have a look at the 2
compute and networking services of AWS. We'll then have a look at some examples 3
and finally we'll finish up with a hands-on lab where we're going 4
to deploy a wordpress web server using the Amazon 5
EC2 service. Amazon elastic compute cloud or EC2 for 6
short, provides virtual servers in the AWS 7
cloud. You can launch one or thousands of 8
instances simultaneously and only pay for what you use. There's a broad 9
range of instant types with varying compute and memory capabilities 10
and those will be optimized for different use cases. 11
Amazon EC2 auto scaling allows you to dynamically 12
scale your Amazon EC2 capacity up or down automatically according to 13
conditions that you define. It can scale up or down by launching or 14
terminating instances based on demand. It can also perform 15
health checks on those instances and replace them when 16
they become unhealthy. Amazon Lightsail, it's the easiest way 17
to launch virtual servers running applications in 18
the AWS cloud. AWS will provision everything you need 19
including DNS management and storage to get you up and running as 20
quickly as possible. Amazon elastic container service or ECS for short is a 21
highly scalable high performance container management 22
service for Docker containers. The containers, 23
they will run on a managed cluster of EC2 instances. AWS 24
lambda is a serverless service and lets you run 25
code in the AWS cloud without having to worry about provisioning or 26
managing that server. You just upload your code and AWS 27
takes care of everything for you. So let's have a look at how we could use 28
these services to deploy a web server in the AWS cloud. 29
Here we have the AWS cloud and our virtual private cloud or VPC 30
located inside that and remember a VPC is 31
our own private space within the AWS cloud 32
and no one can enter that unless we allow them to enter it. 33
We can launch an EC2 instance and that can be running our web 34
application for example wordpress. So what happens if this single EC2 35
instance becomes overwhelmed by demand? For 36
example we might have released a new product and our wordpress 37
application cannot deliver the web pages quickly enough to satisfy 38
that. What we could do is that we could tear 39
down that instance and put in a bigger instance that could 40
handle that demand and that is called vertical scaling and 41
that used to be all the rage 10 or 20 years ago but the problem is 42
that it takes time to do that and while we're doing that 43
our application is not running and also, what happens when the demand goes back 44
down again? Do we have to tear that down and then put in a smaller instance and 45
what happens if that happens every day? What happens if that happens 46
every hour? It's just not going to be economical for 47
us to do that. What we can do is that we can 48
horizontally scale and we do that by adding more instances 49
and as demand goes up we add more instances 50
and as demand goes down we terminate those instances 51
and that way we still have continuity of our application. Our 52
application will always be running because there's always going to be at 53
least one EC2 instance to look after the demand. 54
One problem with this architecture is that it has 55
multiple endpoints for our web server and that's not practical because 56
customers are not going to go to one endpoint until that stops working and 57
then go to another one and then another one. 58
It's just not going to work like that and obviously their bookmarks in their 59
browser are not going to be valid so we need a 60
way of having one single endpoint for that web application 61
that our customer can go to and then having a way 62
of distributing those requests to an EC2 instance that is available. 63
That is where elastic load balancing comes in. 64
So it can receive traffic from our end users and it will distribute that 65
traffic to an EC2 instance that is available. 66
So a request will come in. It will distribute it 67
to an available EC2 instance. Another request will come in and it will 68
distribute it to a different EC2 instance that is available and it 69
will balance the load across those EC2 instances 70
and if one of those EC2 instances becomes unhealthy, it will fail a health check 71
with the elastic load balancer and then the elastic load balancer 72
will no longer send traffic to that unhealthy EC2 instance. 73
But what happens if that demand is only for a short period of time for 74
example half an hour? What do we do then? It's not going to be 75
practical for us to terminate instances when demand goes 76
down and then launch instances manually when 77
that occurs. We can't do that every hour it's not going to be practical 78
and that's where the auto scaling service 79
comes in. It can launch EC2 instances automatically when the demand on those 80
instances increases and it can terminate 81
automatically EC2 instances when the demand on those 82
instances goes down. It can also perform 83
health checks on those instances and if one of those 84
instances becomes unhealthy for whatever reason, 85
it can replace that instance with a healthy instance 86
and it will do that automatically without you having to do 87
anything at all. 88
So now we'll have a look at the networking and content 89
delivery services. Amazon CloudFront is a global content delivery network or cdn 90
for short that securely delivers your frequently 91
requested content to over 100 edge locations across the 92
globe and by doing this it achieves low 93
latency and high transfer speeds for your end 94
users. It also provides protection against 95
DDOS attacks. Amazon virtual private cloud or VPC for short 96
lets you provision a logically isolated section 97
of the AWS cloud and you can launch AWS resources in that virtual network 98
that you yourself define and this is your own personal private space 99
within the AWS cloud and no one can enter it 100
unless you allow them to enter it. AWS direct connect is a high-speed 101
dedicated network connection to AWS. Enterprises can use it to establish a 102
private connection to the AWS cloud in situations where a 103
standard internet connection won't be adequate. AWS elastic 104
load balancing or ELB for short automatically distributes 105
incoming traffic for your application across 106
multiple EC2 instances and also in multiple availability zones. So if one 107
availability zone goes down, the traffic will still go to the 108
other availability zone and your application 109
will continue to deliver responses to requests. 110
It also allows you to achieve high availability and fault tolerance 111
by distributing traffic evenly amongst those instances 112
and it can also bypass unhealthy instances. 113
Amazon Route 53 is a highly available and scalable domain name system or DNS 114
for short and it can handle direct traffic for 115
your domain name and direct that traffic to your back-end 116
web server. Amazon API gateway is a fully managed service that makes it 117
easy for developers to create and deploy secure 118
application programming interfaces or API 119
at any scale. It handles all of the tasks involved in accepting and processing up 120
to hundreds of thousands of concurrent API 121
calls. It's a serverless service and as such 122
you don't need to worry about the underlying 123
infrastructure AWS looks after everything for you. 124
So let's have a look at an example of how we can use these networking services 125
of AWS. So here we've got the architecture that 126
we looked at before in the compute section 127
but one thing we didn't mention was availability zones. 128
So let's just say that we've launched that architecture in a single 129
availability zone. What happens if that availability zone 130
goes down? What happens to our traffic? Our traffic 131
has nowhere to go and our application stops delivering 132
responses to requests. That is why it's always desirable to 133
have our architecture distributed across multiple availability 134
zones. That way if one availability zone goes 135
down the other one will continue to operate and the infrastructure 136
within that other availability zone will continue 137
to respond to requests. We can launch EC2 instances in multiple 138
availability zones and our elastic low balancing service 139
can distribute that traffic across multiple 140
availability zones as well. So if one availability zone goes down the elastic 141
load balancer will continue to distribute traffic to 142
the availability zone that is still healthy 143
and to those instances in that availability zone 144
that are still healthy as well. So let's just say our application 145
running on these EC2 instances is a wordpress web server and that 146
contains lots of images and lots of video that is 147
static content, it's not really changing that much and it's not 148
efficient for us to continue to keep delivering that 149
from our EC2 instances. We would like somewhere to put that 150
where it can be delivered with high speed and low latency 151
and to take the load off our EC2 instances. 152
That is where the CloudFront content delivery 153
network or CDN comes in. So we can get these large images and large videos 154
that are not really changing that often and we can put that 155
in a CloudFront distribution and CloudFront 156
will cache that and distribute that across 157
hundreds of edge locations across the globe. 158
So when your end user requests that video or those images, 159
it will be delivered to them with really high speed 160
and low latency and at the same time it's going to take the load off your EC2 161
instances and is going to significantly reduce 162
your costs at the same time. Dynamic content that is changing 163
regularly, CloudFront can forward those requests 164
over to the elastic load balancer which will then forward them 165
to an EC2 instance. So that way you have the best of both worlds. You 166
have dynamic content delivered as a dynamic 167
content and at the same time you have these 168
large videos and images that aren't really 169
changing that often delivered very rapidly. 170
Now that CloudFront service or that CloudFront distribution 171
will have its own DNS name that we can put into a browser 172
and we can directly access that. The problem with that 173
is that that DNS name for that CloudFront distribution 174
will be something very complicated and just won't mean anything to our end user 175
at all. So we would prefer to have our end user type in 176
a domain name and have the request for that domain name 177
forwarded to that CloudFront service. As you can see here we've got 178
example.com and that is where route 53 domain name service 179
can come in. So route 53 will grab those requests for your domain 180
example.com and it will forward those requests 181
over to the CloudFront service and the CloudFront service 182
will handle it from then on. So let's just say we work for 183
a large enterprise that has its own corporate data center 184
and the reason it's got its own corporate data center is because that is 185
located where the employees work and we don't 186
want our employees to be slowed down by a 187
network. We want them to be able to work efficiently but at the same time 188
we have resources on the AWS cloud that those employees also need to access. 189
So we need some way of having a high speed connection 190
between our corporate data center and the AWS cloud 191
and that is where the AWS direct connect service comes in 192
and that can provide a very high speed fibre optic network between our 193
corporate data center and the AWS cloud and that is completely 194
private. Okay, so that's a very complicated architecture and don't 195
be too concerned if that's very overwhelming because if you're going on 196
to become a cloud practitioner you're not going to need to really be 197
able to produce this yourself. As an associate level certification that 198
is a different story you'd be expected to create this yourself 199
but cloud practitioner you'll need to know what these services do. 200
You'll need to know that route 53 will forward request 201
for your domain name to a backend endpoint. 202
CloudFront will distribute your content to hundreds of edge locations across the 203
globe. Elastic load balancer will receive 204
requests and distribute those requests to 205
multiple instances across multiple availability zones. 206
A virtual private cloud is your private space within the AWS 207
cloud. The AWS Direct Connect is a high 208
high-speed fibre-optic network connection between 209
an on-premises corporate data center and the AWS cloud. 210
If you understand that then you're well on your way 211
to passing the cloud practitioner exam. 212
Okay, so coming up next we're going to have a lab. So make sure that you 213
download the introduction to AWS lab notes that come 214
with this course. So what we're going to do is we're going 215
to launch an EC2 instance and we're going to select an Amazon 216
machine image (AMI) of a wordpress web server and that will 217
allow us to deploy a wordpress server on the AWS cloud 218
and then we're going to be able to go to our browser 219
and view our website that was created by that EC2 instance and we're going to do 220
that all through the AWS management console 221
on our desktop computer. Okay before we start the lab need to 222
make sure you get your hands on these lab notes. 223
The section we're going through here is the creating a web server with 224
EC2. If you run into trouble when you're following the lab notes there is a 225
troubleshooting section here, troubleshooting viewing your wordpress 226
application and also there is a troubleshooting 227
logging into your wordpress application. So make sure that 228
you follow these lab notes and if you get into 229
trouble follow the troubleshooting steps. So starting off in the management 230
console we're going to go to services and then 231
EC2 so i've got this in the a to z and just scroll down to EC2 232
and what we're going to do is go into instances here on 233
the left and we're going to be creating an instance or launching an 234
instance. Now you won't have any instances here. I've got an old one here 235
but yours will most probably be empty. We'll click on launch instances 236
and what we're going to do is, go into the AWS marketplace here on the left 237
and we're going to search for wordpress, 238
and we're going to get the wordpress certified by Bitnami and Automatic. 239
So we'll select that one 240
and it's going to show the hourly fees. So for software there's nothing 241
this is open source software so there's no cost there 242
but if we select a t2 micro the costs there are 12 243
or 1.2 cents per hour, but because we're going to be operating 244
under the free tier with a new account which is less than 12 months old, 245
then you will not be paying for that, but my account here is 246
many years old so I have to pay for it but you will be operating under the 247
free tier if you have a new account. We'll just click on continue 248
and we'll select that t2 micro which is again 249
free tier eligible. So there we can see micro instances are eligible 250
for the AWS free tier for the first 12 months 251
following your AWS sign up date. 252
So next we go to configure instance details. 253
Now the main thing that we're looking at here is to make sure that we have a 254
public ip enabled. So we click on enable here 255
and that assigns a public ip. So that means that we can actually 256
find this this web server over the internet 257
using our browser, and we're going to launch that into our default VPC. 258
We'll click on next add storage. We'll leave the storage as it is. 259
Now we can add a tag. So we're going to add a name tag. So we can see here, 260
choose your add tag button or you can click to add a name tag. So i'm just 261
going to click to add a name tag and so you can see here it's put the key 262
in already which is name and name always has to have a capital N 263
for that tag and i'm just going to call this backspace lab. 264
Okay and we'll click on configure security group. 265
Now this is already going to create a security group for us now. 266
A security group is is like a firewall so 267
same as we would have a windows firewall or a linux firewall, 268
we have a security group which we can associate 269
with this server and that will block access to that server and we need to 270
allow access by using rules. So here we can see we've 271
got http access is allowed and it's allowed from 272
anywhere here. So we click on this and we'll have 273
anywhere there and so that's fine. So that will allow us to connect into or 274
to access this this server on using http in our browser. 275
Next we'll click on review and launch 276
that looks all fine there and we'll just click on launch. 277
Now we don't need to choose a key pair. So we just proceed without a key pair 278
What a key pair allows us to do is to connect 279
in remotely to the linux operating system of this server. 280
We don't need to do that. All that we need to do is to be 281
able to access the wordpress application that's running on this server and we'll 282
do that using a username and password. So we don't need to worry about that key 283
pair and we'll click on launch instances. 284
Okay so that launch process has started. If we scroll down here there'll be a 285
button on the right hand side for viewing the instances, 286
and there we go so there we can see our backspace wordpress lab we gave it that 287
name tag and that name tag has come up there and 288
so that's how we can find that, and that is currently pending and now 289
it's gone to running and it will be doing some status checks 290
now. So we need to make sure that those status checks have been finished 291
and from that point onwards we will be able to 292
actually access this server. So if we just click on this button up here, this 293
refresh button, we'll be able to see what's going on 294
there and so there we can see the status is 295
initializing so it's still got a little bit of a way to go. So we'll give that a 296
bit of time. 297
Okay so after about five minutes or so our status checks have changed to two 298
out of check two checks have passed and again just click on the 299
refresh button there and you'll be able to see 300
it if it's not there. So what we can do now is click on this 301
instance id to open it up and have a look at it. 302
So there we have our instance id it's running it's a t2 micro instance 303
and it has this public ip address. It also has a public 304
DNS there's a public address name there that we're not going to use as 305
such but we could also put that into our browser and open that as well, 306
and it has a VPC id. So we launched this into the default VPC which has been 307
automatically created by AWS when we create our AWS account, 308
but we can also if we wanted to create multiple 309
VPC and put and use those to launch our instances into but for this 310
one i'm just using the default VPC that has been created for us 311
by AWS. We also have a private ip address and so that is for 312
internal traffic within our VPC there and we have a subnet id which is a 313
subnet within our VPC where this is located. We scroll down 314
here. We can see we've got security 315
and we can see here that we've got our our our rule 316
that allows traffic from anywhere on port 80 which is our http 317
access and that is the rules within our security group and again remember 318
this security group is a firewall that we associate with 319
an instance and that will prevent access to that instance 320
unless we have rules which we have defined here 321
that allow that access to come through. 322
Okay so what we'll do now is it will try and access our web server. So we can use 323
one of these. We can use this one here if we wanted to but i'm 324
just going to use this one here and i'm just going to open that in a new 325
tab, 326
and there we go so there is our out of the box 327
Wordpress website all up and running. So what would what we'd like to do now 328
is that we'd like to log into our our website as an administrator of our 329
of our website and be able to change it, to be able to 330
put pictures in it and do whatever we want to it. So what we would do is we 331
will go to forward slash and then admin 332
and that will take us to our login. So what is this login? We need to have a 333
login to log into our into our website. So we go back to our 334
instance details. We'll click on instances here. 335
We'll select that backspace wordpress lab again, and we're going to go to 336
actions, and we're going to go to instant 337
settings, and then we're going to get the system 338
log. 339
Now what this system log is basically what is consoled out. 340
What would be outputted from a console screen that is recorded 341
in a log by the instance. So if we scroll up here, there will be 342
a console output that will say what our username and password that 343
has been generated for this site is. So we scroll up a little bit more and there 344
we can see setting bitnami application password to 345
that and the default application username is 346
user. So if i copy that that password and if i log in with user, 347
i'll paste in that password and log in, 348
and there we can see we've logged in as an administrator 349
to our wordpress site. 350
Now one thing i've experienced with this lab with a lot of students is that 351
instead of going through this process of clicking on admin or doing forward 352
slash admin and then putting the username and 353
password, they're going to the instance and 354
they're actually selecting actions and then connect because they're not reading 355
the lab notes. You won't be able to connect. That is to 356
connect in to the linux operating system using SSH with a remote computer and we 357
won't be allowed to do that because when we launched this server we 358
were asked whether we wanted to associate 359
an encryption key pair to this server and we said no because 360
we're not going to be connecting into the linux operating system 361
all we're doing is we're going to be accessing our 362
wordpress application and that's all that we need to do. 363
So if you find that it's a problem that is what's 364
most probably if you cannot get this connected in. 365
The other thing there is that there is also a troubleshooting of 366
launching as well. So troubleshooting viewing your wordpress application 367
most probably is that something has gone wrong with the firewall setting 368
that it doesn't have that port 80 access in there as well 369
but if you follow the lab notes you won't go 370
into or you won't get into trouble. So what we'll do now is we'll clean all 371
this up because we don't want to get we won't want to get billed for it, 372
although you won't get billed for it if you're on the free tier, 373
if you leave it here and then you launch another instance and you've got two of 374
them, you will be billed for one of those. So let's make sure that we clean this up. 375
So we go to actions and we go to instance state 376
and we go to terminate instance and will terminate 377
successfully terminated. So that process will be chugging away and again we can 378
click on this refresh button and see when it has actually changed from 379
shutting down to terminated. So that brings us to the end 380
of a very quick lab so you've now launched a web server and you've 381
accessed that and i hope you got a lot out of it and i 382
look forward to seeing you in the next one.