In this lesson, I'm going to show you
how to use the cloud
and we're going to do this by using a product from Amazon
known as Lightsail.
Now Lightsail is Amazon's entry to the cloud product.
Instead of having to use EC2, which is for compute;
Route 53, which is for networking;
Aurora, which is for databases;
Fargate, which is for containers
and S3, which is for storage,
we actually get all of that combined
into one nice easy to use package
for us as beginners in the cloud.
Now the first thing you're going to want to do is
get yourself an Amazon account
by going to aws.amazon.com/Lightsail.
From here, you can click on create an AWS account
and sign up for one for free.
Once you do that, you'll be able to log into your account
and get to your Lightsail dashboard.
From here, you're going to click on Create an instance.
Once you do that, you're then going to select the region
and availability zone that's closest to you.
If you want to change that, simply click on change AWS region
and you can choose from any location around the world.
In my case, I'm closest to the east side
of the United States, so I'm going to choose either Virginia
or Ohio for US East 1 or US East 2,
and I'm going to go ahead and use US East 1 with Virginia
because it's a little bit closer to me
and it'll help reduce my load times.
Now as you scroll down, you can then pick your platform.
You have a choice between Linux and Unix
or Microsoft Windows.
Do be aware that Linux and Unix is cheaper on Lightsail
than Microsoft Windows, and this is because Linux and Unix
is an open source piece of software,
so there's no licensing cost.
For example, you can start out with the lowest plan
on Linux or Unix for only $3 and 50 cents per month,
which gives you your server and all of your configurations.
Whereas with Microsoft,
it is going to start out at $8 per month for the lowest level
because there is licensing associated
with that server software.
I'm going to recommend that you use Linux or Unix
as your blueprint, and the reason for this is
when you get into core two of A+,
you actually have to get comfortable
using some commands in Linux.
And so by creating this here in the cloud
while you're studying for the next couple of months,
you can go back, log into your Linux server in the cloud
and use that to practice with.
Next we're going to choose what we want.
Do we want an application and OS or do we want the OS only?
Essentially, what this is asking is
do I want platform as a service
or infrastructure as a service?
Now if I do OS only,
I can choose the exact version of Linux I want to use,
whether that is Amazon's own version of Linux
referred to as AMI or Amazon Linux two or Ubuntu,
Debian, FreeBSD, openSUSE or CentOS.
If I want to use an App + OS, this is going to give me
not just the underlying operating system,
but it's also going to give me some application.
For example, if you want to create your own website
using a WordPress log, you could do that
by selecting WordPress here as the app
or maybe you want to create your own internal community
and you're going to use Joomla or Drupal to do that,
or maybe you're going to start writing
your own custom application
and so you want to have Node.js installed
that way you have that as the baseline
and everything else you're going to code
is going to be written in Node.js.
By offering this App + OS,
this allows us to take the hard work
out of configuring those applications
as opposed to getting just the operating system
and then having to install those applications ourself later.
In my case, I'm going to choose CentOS down here
in the bottom right because CentOS is a Red Hat
based version of Linux and most organizations,
if they're running their own Linux servers
are using either Red Hat Enterprise Linux or CentOS
and for that reason if you decide
to move up into the CompTIA Linux+ course,
you'll be using CentOS as the base operating system
as you go throughout that course as well.
So it's a good one for us to choose here.
Then we're going to scroll down
and we are going to have some other options we can configure,
including if we want a script
that will launch every time we load up this server
or being able to create a unique SSH key pair
to remotely log into this machine.
For right now, I'm going to stick with the defaults on this
and then as we scroll to the bottom,
you can see we have to choose our plan.
Now as I said with the Linux option,
we can start out at the lowest plan,
which is $3 and 50 cents per month.
And with Amazon they're running a special right now
where if you sign up,
you're going to get your first three months free
and there is no contract so we can actually sign up,
it'll be free for the first three months
and so we're going to be able to play with this
and then if you delete it by the end of that three months,
you won't be charged anything.
Now when you're picking out your server,
you're going to figure out what equipment you want
and based on that you're going to pay more
or less money per month.
As I said, Amazon is running a special
at the time of this recording where you can get
any of the first three level plans for free for three months
and then after that you would pay the price listed here
on the screen.
So, since I'm planning on only using this
for the next two or three months, I'm going to go ahead
and select the $10 version
because this is going to gimme more memory and storage space
on my virtual server.
As you can see here, the first option we had
only had 512 megabytes of RAM, which is really low.
The second one is one gigabyte,
the third one is two gigabytes
and it keeps doubling as we move to the right
and the price also doubles in turn.
You'll notice that the first three all use one virtual CPU,
whereas the other ones are going to use
two virtual CPUs or more as we continue to the right
and see the higher price plans.
On the storage line, you'll see
the first level starts out with 20 gigabytes,
the second is 40, the third is 60, then it goes to 80,
then 160, and it keeps raising from there.
As you look over to the right,
you're going to see that the maximum plan size you can go to
is actually $160 per month.
This is actually a pretty beefy server though
because you're getting 32 gigabytes of memory,
eight virtual CPUs and 640 gigabytes of storage
using a fast solid state device.
So as you can see,
you can actually pick pretty powerful servers in the cloud
using even something as simple as Lightsail.
The other nice thing is that you can always start out low
and then increase over time.
This is what's called vertical scaling.
For example, if I decide to start out
with this $10 per month plan
and I wanted to create a new website on this virtual machine
and I have 10 people per month going to that website,
this $10 per month machine will be more than adequate
to handle that.
But if I start getting a thousand
or 10,000 people a day going to my website,
that $10 server is not going to be enough,
but I can quickly go back and move up to a higher plan
by simply going and creating a backup of my server,
creating a new instance at the larger size,
and then restoring that instance into the newer larger size.
And at that point, that becomes my new website
and I can delete the older instance that I had.
Next, we're going to give our instance a name
and I'm just going to call this Linux practice.
That way I can remember what it's going to be
and then you can also choose how many instances you want,
and in my case, I just want one instance,
but if I wanted to create five of these machines,
I could do that here by just changing this to five,
but we're only going to create one, so I'll leave it at one.
And then we have these key only tags and key value tags.
These can be used if you're working in a large organization
so you can identify what project you are working on
and that way the billing goes to the right place.
Once you've done that, go ahead and click on create instance
and now Amazon is going to work
creating this instance for us,
so they're allocating the amount of memory we wanted,
which was two gigabytes of RAM,
the one virtual CPU and the 60 gigabyte SSD.
In addition to allocating all of that hardware for us,
they're also going to be installing the operating system
and then we'll be able to log in remotely into that server
and be able to do whatever we want because we own the server
and we have root or administrative access over it.
Now another thing you'll notice is that
there is an IP address associated with this server.
Notice, it is 54.159.170.130,
and we also have an IPV six version underneath it,
listed with that long number starting with 2,600.
This is how we would address that server
and so if somebody went to 54.159.170.130 right now,
it would actually bring up
whatever this server's responding to
if a web server running on it.
In my case, if I try to go to that right now,
I get connection refused.
Why?
Because we never installed Apache or another web server
to answer up those calls,
and this is because we chose to install just the OS
and not the App + OS.
If you had chose to use something like WordPress
and I went to this IP,
you would see the welcome to WordPress page
for you to be able to configure your WordPress server
through this web-based interface.
Okay, now we see that our server has been fully brought up
and it is fully running,
and at this point we want to be able to go in
and do stuff with this server.
So we're going to click on where it says Linux practice
and we can see here how you can connect to your instance.
Now, Amazon makes this super easy for us by making it so
that we can just hit connect using SSH
and it will actually bring up an SSH instance
in our web browser,
which is a remote session to that server.
Right now I am connected to that CentOS device
and you can see that I am now logged in as CentOS.
If I wanted to see what directory I'm in,
I could use something like PWD,
which stands for present working directory.
And you can see here I am in the /home/CentOS directory,
which is this user's home directory.
If you look in here and do ls,
this will tell us what is inside of this directory,
and in this case there are no files or directories
because this is a brand new server with a brand new account.
Now, if I wanted to go to the root of this hard drive,
I can do CD space slash, which will allow me to change
into the root of this hard drive.
If you think about this in terms of Windows,
this would be going to your internal hard disk
such as your C drive
and looking at what files and folders are there.
Again, I'm going to type in ls
and this time I'm going to do -la,
which says I want the long list
and I want to see the attributes,
and this is going to show me every file and folder
that's sitting at the root of this hard drive.
And as you can see here, we have several of them.
Everything in that purple color is actually a directory.
Everything in the light blue color is a link
that's pointing to another directory.
For example, if you look at the line that says Bin
that has a symbolic link going to the usr/bin directory.
The same thing with Lib,
it's going to the usr/lib directory.
Now, I know most of this
probably doesn't make a lot of sense to you right now,
but the point I wanted to make is that
you are now connected to your Linux machine
and can do whatever it is you want inside of it.
So let me go back to my home directory
by doing CD space /home/CentOS.
Now from here, if I do ls -la,
you're going to see I have no folders here
except for that one hidden one
that starts with a dot called SSH.
In Linux, anything that starts with a dot,
is considered a hidden file.
If I just do ls, you won't see any of those
because all of those files such as bash logout,
bash profile and bash RC are considered hidden files.
Now, if I wanted to create my own file, I can do that
by using the command touch.
So I'm going to say touch and I'm going to call this file.txt.
By doing that, I just created a new file called file,
but that file is empty
because I haven't done anything with it yet.
So I'm going to go ahead and clear my screen
and I'm going to display one more time using ls -la
and now you'll see file.txt is there
and it has no dot in front of it,
meaning it's not a hidden file.
Notice though in the fifth column, we have a zero
and this is the size of that file.
That file is zero bytes in size
because there is no contents.
When I use the touch command,
I'm just creating an empty file.
Now if I wanted to enter something into that file,
I can do that by using a text editor.
And on Linux there's a text editor known as VI.
So I'm going to type in VI space file.txt and hit enter.
And by doing that I can now see
that this was a blank file.
Notice all of those little squiggly lines,
notice the tile dot,
just shows me that each of those lines is blank.
Now, if I wanted to type something here,
the first thing I need to do is type in the I key.
This moves me into what's called insert mode,
and now I can type things into here
and be able to write them.
So I'm going to say this is Jason's test file.
We are writing information into it using VI, okay?
Now that we are done, I'm going to go ahead
and type in the escape key,
which puts me back into command mode.
Then I'm going to use the colon key,
and you can see the colon now shows up at the bottom.
I'm going to do W for right and Q for quit,
which will then save this file.
And you'll notice it says one line was written,
72 characters were written.
So if I clear my screen and I do ls -la this time,
you can now see that we have 72 bytes there
instead of zero bytes inside the file.
Now in Linux, if you want to display the contents
of a file to the screen, you can do that by typing cat.
So I'm going to do cat and then my file, name of file.txt.
And when I do that, we can now see the contents
of that file, which is this is Jason's test file.
We are writing information into it using VI.
So as you can see, I have full access on this Linux system
to pretty much do whatever we want at this point
because we own this server.
I could start installing programs, I could run a web server,
I could do pretty much anything I want
because it is my own server
and nobody else has access to it.
The only real limitation here is that
we are using a command line interface
instead of a graphical user interface.
So you have to get comfortable using Linux
in the command line if you want to run
and operate this server.
Now, this is a very common thing in the cloud.
Most cloud servers are going to be text-based
because we don't want all the extra overhead
and processing requirements
that a graphical user interface provides for us.
Because of this,
when we use a text-based interface like this,
we can use less expensive and less powerful servers
and still provide support to a large audience.
For example, if this was a web server,
this little $10 per month web server can host
probably a hundred to 500 people pretty comfortably.
Now, if I started getting thousands of people,
I would've to upgrade to the 20 or $40 per month plan
and keep upgrading as my audience grew
for my particular website.
Let's go ahead and go back
to our Amazon Lightsail interface,
and here you can see that you can also connect to this
using your own SSH client
instead of using the browser based one
that I just demonstrated.
If we go to the next tab, you'll see storage,
and here you could see I have a single system disk
that was 60 gigabytes in size.
Now you may find that 60 gigabytes is not enough space
for you, and if that's the case,
you can actually add a additional attached disks
using the interface here.
To do that, we'll simply click on create new disk,
and then you'll be able to select
how big of a disk you want.
Now again, disk face here is on an SSD,
which is more expensive than using older,
slower traditional hard disks,
and because of that, you'll see the cost associated with it
is going to be based on your size that you choose.
For every gigabyte of space you want,
you're going to be paying 10 cents per month.
So if that 60 gigabyte space wasn't enough for me
and I wanted to have an additional 64 gigabytes,
I can do that,
but it's going to cost me $6 and 40 cents per month to do that.
Now the great thing
about using a cloud-based interface like this though
is that you can also choose any size you want.
So, let's say I wanted to have a one terabyte drive.
I could do that by doing 1,024 gigabytes,
and you can see that would cost me $102
and 40 cents per month to attach that to my Linux server.
Just to show you how this works, I'm going to go ahead
and create one that is 10 gigabytes in size.
This will cost me $1 per month.
I can give it a name such as storage disk,
and then I can go ahead and create that disk.
Once you do that,
you need to select the instance you want to attach it to.
In our case, I only have one
which is my Linux practice machine,
but if I had several instances
such as my Dion training website and another one,
I could choose which one I want to be attached to.
And then you'll see that the path to this disk
is going to be /dev/xvdf
on my Linux system once I attach it.
So I'll go ahead and hit Attach,
and now that is going to be put into place on my Linux system.
Next we're going to go back here to home,
and then we're going to go down to Linux practice again,
and here we're going to click on metrics.
With metrics, I can see how hard my system is working.
Now you can see here that this is my CPU overview graph,
and as you see, we launched this server
right around 3:52 PM on July 17th,
and originally when we started the server,
it was operating at about 20% CPU utilization.
That's because there was a lot going on
when we first started up that server
and it had to bring itself up.
Once that happened though,
and we got back to our normal workload,
when I was in the command line doing things,
you could see it dropped down to about 1%.
This is what we call the sustainability zone.
Now, because this is a cloud-based system
and we're using a virtual processor,
Amazon is doing a lot of hard work on the backend
to make sure we're getting good performance.
Let's say for example, I use this to host a website
and I get a lot of people that jump on my website
all at the same time.
Well, what'll happen is there'll be an increased demand
and the processor will go up.
As that processor goes up,
you'll see it go into what's called the burstable zone.
If you get between 40 and 60 or 80%,
you can actually burst, which means
that Amazon is going to give you additional capacity
to be able to handle that load so your server won't crash.
Now, they will do this
for a certain amount of time per month based on your system,
and so you only have a certain amount
of burstable capacity available.
You could see here on the bottom graph,
that's the remaining CPU burst capacity,
and we have lots of additional burst capacity available
on our system because we haven't really bursted
because we're not running a lot of stuff on this server yet.
As we move up, you can also click on here
and see other facts, things like your CPU utilization,
your burst capacity,
your burst capacity in minutes or percentage.
You can also see your incoming and outgoing network traffic
as well as status check failures,
instant status check failures, system status check failures
and things like that.
For example, if we look at the incoming network traffic,
you could see that there was traffic started
and then over time that traffic has gone down.
Now, why has that traffic gone down?
Because the only person who has access to the server is me,
and I've been talking to you for the last few minutes
and not entering commands back and forth,
which is why we saw that drop off as we got here
to 405 in the afternoon.
Next, we can click on networking,
and from here you can see our public and private IP
as well as our firewall for our device
and IPV4 and our IPV6 networking and our IPV6 firewall.
In addition to that,
we have the ability to do load balancing or distribution,
and this would allow us to have multiple servers
that are answering up for a single website.
In our case, we are not sharing traffic with anybody.
We are only using a single server that we are talking to
and that server's controlled by us
and being used only by us.
But if I was running a website
and I was going from a hundred people to a thousand people
to 10,000 people,
I can actually have multiple systems working together
in tandem to load balance across multiple instances
to answer up requests from all of those people.
Next, we can go back to the top
and you can see that we have snapshots.
Now, snapshots are the way
that you can do a backup of your system.
When you take a snapshot,
it's going to take an image of the hard drive
and store it in the cloud so that if anything happens,
you can then revert back to that snapshot.
In our case, I have the automatic snapshots disabled,
which means it's not going to do a backup
of my server every single day.
This is actually considered a bad security practice
because we want to be able to have snapshots
if something goes wrong.
So I'm going to go ahead and turn on my automatic snapshots,
and you'll see that this will automatically take a snapshot
every single day,
and it will store my seven most recent snapshots.
This way, it's a rolling backup that I can always look at.
Automatic snapshots are build the same way
as a manual snapshot,
and so if you wanted to learn about the billing,
you could look at that by clicking on that link.
I'm going to say I understand and I'm going to enable it.
In addition to that, instead of waiting for 2:00 AM
to happen for that snapshot,
I can create a snapshot anytime I want.
When I do that, I'm just going to give it a name.
This case, they already have one.
It's a server name, dash and a unique identifier
and hit create.
When you do that, it's going to take a snapshot
or backup of my entire server, and that way if it breaks
or something goes wrong, I could always restore it
from that snapshot.
Next, we have tags, and if you look at tags,
this is anything where you're going to be able to label
this particular Lightsail instance
so you can keep track of things such as its status
or the cost that's associated with it.
After that, we have the history tab,
and this will tell us what has happened with this instance.
You can see that we originally created this instance
at 3:56 PM.
We attached that 10 gigabyte hard disk at 4:10 PM.
We created a snapshot at 4:15 PM
and we enabled an add-on at 4:15 PM
for those automatic snapshots.
The last tab we have is the delete tab,
and this delete tab is going to be the one
that allows us to delete this server
if we no longer need it.
So let's say two months has gone by
and you decided you no longer want to play with this server,
and you don't want to be charged that $3 and 50 cents,
$5 or $10 per month to keep it running.
Well, you can simply go in here and click delete,
and this will delete the instance.
Now, if you delete this right now,
we have that storage disk
that's still attached to the instance.
It will unattach the storage disk,
but it won't delete the storage disk.
This is why storage disk
can be actually a pretty beneficial thing
because I can store files from this Linux machine
onto that storage disk, delete the Linux system,
and then reattach that storage disk to another system,
like another Linux system or a Window system
that I would want to use in this cloud environment.
And this is a good way to get data from one cloud instance
to another inside of Lightsail.
In addition to that, you'll also see at the top,
we have the stop and the reboot button.
If I hit stop, this will power down that instance,
and that can be useful
if you no longer want to use this instance,
but you know you're going to come back to it
in a couple of weeks, or you can reboot it
and you'll use that anytime you're having an issue
with your server or you need to reboot it
to install some piece of software
or apply some kind of a configuration setting.
So that was a quick introduction
on how you can create your own cloud-based server
using Amazon Lightsail.
I do recommend that you do this yourself, give it a try,
and that way you'll have a CentOS machine
that you can play with anytime you want
sitting in the cloud.