Instructor: 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 that'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 could 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 2 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 2,
or Ubuntu, Debian, Free BSD, openSUSE, or CentOS.
If I want to use an app plus 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 plus 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 base
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 could 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 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 LinuxPractice.
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 were working on.
And that way the billing goes to the right place.
For example, in my company,
we actually have two different websites.
We have DionTraining.com, which is our main website,
and I also have a podcast called "Your Cyber Path."
And "Your Cyber Path" has its own website
at YourCyberPath.com.
"Your Cyber Path" is actually hosted in Amazon Lightsail.
And so we actually have a tag on that that's called YCP.
And anything that we use
that has to do with "Your Cyber Path"
gets tagged as YCP
so that at the end of the month
we can see how much it costs us
to be able to run those services.
This is because we're using not just one Lightsail instance,
but multiple Lightsail instances.
And so we want to be able to capture
how much it costs us overall every month.
And that way we can keep track
of what it's costing us every month
to run the hosting for that website
and the associated podcast.
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 IPv6 version underneath it
listed with that long number starting with 2600.
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 there's 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 plus 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 LinuxPractice,
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 /,
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 bashrc 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 known as vi.
So 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 those little squiggly lines
notice the tilde 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 write 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 have 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 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 space 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.40 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.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 StorageDisk,
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 LinuxPractice machine,
but if I had several instances,
such as my Dion Training website
and another one for "Your Cyber Path" website
and things like that,
I could choose which one I want it 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 LinuxPractice 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 up 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 drop 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 can 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,
instance 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 this 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 4:05 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 in 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 100 people, to 1,000 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 is associated with it.
After that we have the History tab,
and this will tell us what has happened with this instance.
You could 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.50,
$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 Windows 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 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 CentOS machine
that you can play with anytime you want
sitting in the cloud.