Instructor: Okay, so let's go ahead
and create a database with RDS.
So RDS is going to be allowing us
to get a manager database in the AWS cloud,
and they get us a lot of goodness out of it
because we don't have to manage the underlying servers,
and we get a lot of features such as back-ups,
replicas, multi-AZ and so on out of the box.
So let's create a database.
And as we can see in here,
we have different options for creating a database.
So we have the standard create to see all the options
and the easy create to go fast over it.
But because we're learning AWS,
let's go over the standard create options.
So we have different engine types.
We have Aurora,
MySQL, MariaDB, PostgreSQL, Oracle,
and Microsoft SQL Server.
So Aurora, we'll see later on,
and from these five engines,
you need to remember them all.
So MySQL, MariaDB,
PostgreSQL, Oracle, and Microsoft SQL Server.
But for this demo, we're going to use MySQL.
And then in terms of version,
just choose whatever is recommended here.
Okay, so next one, MySQL we have different options.
So there are templates we can specify to meet our use case,
which is going to be pre-filling some configuration
parameters in here.
So we have Production, Dev/Test or Free tier.
And because we want to see all the options,
I'm going to choose production
and we're going to choose in the options one by one,
but we'll make sure to choose an instance that is compliant
with using the Free tier of AWS RDS.
Okay, so for production,
we need to specify a database identifier.
So database-1 is great.
Then we need to specify a master username,
so admin is perfect.
Then a master password,
and I will enter password just to make it very simple.
Okay, we're good to go.
Then I will scroll down database class.
Here we can choose the type of instance we want.
So we have standard classes,
optimized and burstable classes.
And then you can choose the instance type,
which is giving you a certain number of vCPU and RAM as well
as a network speed.
But we wanna keep things in the Free tier
So therefore let's go into burstable classes
and you need to choose dbt2.micro.
So we need to include a previous generations
and choose dbt2.micro.
This is to make sure that you remain within
the free tier of this hands-on.
Next for storage,
we need to choose GP2, but we have different options.
We have GP2 I1 and magnetic,
but to remain within the free tier yet again,
we need to choose a general purpose SSD type.
So GP2 is great with 20 gigabytes of storage.
Okay, next, we have a very cool feature
called storage autoscaling.
So when we enable it,
this provides dynamic scaling support
for your database storage.
So the more we use our storage,
if we get close to 20 gigabytes automatically,
the search will be increased by AWS
without us doing anything.
So this is again, UPS less type of scaling,
and we can specify a maximum storage threshold.
For example, 1000 gigabytes to one terabytes.
This is very handy because we don't need to monitor
the sort of size.
We just know that it will automatically
scale as the workload increases.
Next, very, very important cool,
availability and durability.
So we chose production templates.
So it was enabled by default,
but we can disable multi-AZ for this instance.
So multi-AZ here is that if we did enable multi-AZ,
we would get a standby instance for our RDS database,
which is recommended for production usage.
And this standby instance is going to be here
for data redundancy.
In case you have IO freezes for backups
and to minimize latency spikes during backups as well.
So this is done by instance,
it's not something that gets used by your applications.
It's something that is yours here in case your main instance
has an issue or a reboot or something like this.
So for now we'll disable multi-AZ,
but this is where the setting would be.
Next for network settings,
we launch it into RVPC.
We have it when the specific certain group,
and then we want public access.
Yes, because we want to be able to connect to it publicly
to test our database in this hands-on.
And VPC security group, we can create a new security group.
I'll call this one demo-database-mysql.
Okay, do we have a preference for AZ?
No preference.
And then the port is going to be the standard port of 3306.
Next for database authentication,
we have three options.
We have password authentication,
password and IAM database authentication
and password and Kerberos authentication.
So important to note the second option to use
IAM credentials, to login to RDS,
but to keep things simple,
I'm just going to use password authentication
for this hands-on.
And then we have a lot of additional configuration.
So we can first for example,
specify the initial database name.
Okay, if not, then let's just specify MyDB.
Perfect, some parameter groups
which is out of scope for this.
The backups, so do we want to have automatic backup?
Yes, the backup retention periods.
So seven days but we can specify from zero to 35 days.
The backup window,
so we could specify a specific window everyday to backup,
but no preference is fine and hence monitoring
to get more metrics from your database.
And do we want to export the logs into CloudWatch Logs.
We want to get the audit to the error,
general or the slow query logs.
The maintenance,
so we want to enable auto minor version upgrade, yes.
As well as we want to specify
the maintenance window for this.
And do we want to enable deletion protection
to prevent us from deleting the database accidentally?
So I'll keep this on.
So again, this is the estimated monthly cost.
And though,
if we have chosen the t2.micro type of instance,
this is within the free tier, okay.
But just so you know,
you may have here some estimated monthly cost shown as part
of this UI.
So when you're done,
let's create this database.
So while my database is being created,
let's go ahead and download Sqlectron.
And this is a SQL clients that we're going to use
to connect to our database.
So very simple, you're going to click on Download GUI
and then click on it,
take the latest version for whatever platform you have.
So you have latest windows,
and then for Mac is going to be a DMG.
So I'm going to do this one,
then open it and install it.
Okay, so my database is now created.
It took a little bit of time and now as you can see
it is available.
And so what I'm going to show you are a few options.
So first of all,
we have the end point right here and the port 3306,
and it's linked to this security group
and this Security Group,
if you click on it and look at the Inbound rules,
we can see that we have an inbound rule
here on TCP port 3306.
So that's great.
Okay, coming from just my IP address.
Okay, so you should of course modify this security group.
If you have problem connecting to your database instance,
to maybe have it to anywhere IPV C4.
Okay, so now let's take this end points
and we're going to connect to it using Sqlectron.
So using Sqlectron, I'm going to add a new database.
I'll call it RDS demo.
It's a database of type MySQL.
And then for the server address,
I'm going to enter what I have over here on port 3306.
The User is admin and the Password for me was password.
And then the Initial Database is Mydb
as I entered it from before.
Let's click on Tests and the connection is successful.
If it's not successful, please have a look
whether or not your database was set
to be a public database number one,
and number two,
have a look at your security group settings
to make sure that your IP is allowed in.
So let's save this and connect to our database.
And now I'm connected into my database directly into Mydb,
which was the database that was created.
And in here I could go ahead
and enter some create table statements.
So create my table,
and then just a name of VARCHA20
and first name of VARCHA20.
So it's just a very quick statement
just to show you how SQL works,
but this is definitely out of scope for the exam,
execute this.
So now we have my table that has been created,
and then we don't have any contents in it, okay.
But you could have an insert statement to insert some data
into your table.
So you would say, for example, enter the value Maarek.
And then the value here Stephane, execute this.
And then if you click on Select Rows,
then you see that my table has my name and my first name
to be Maarek and Stephane.
So this is how we would use a RDS database with MySQL.
But again, out of scope of the exam,
I just want you to show you the full picture
of using Sqlectron.
So back in here, my art is at a base is fully managed.
So this is great, we can use it. This is amazing.
Other things we can do that are worthy
are to create a replica directly from the database
so we can create a replica.
And then this replica would allow us
to have more read capacity for our database,
which will be very, very helpful.
And do we want with our knots,
that's a database should be multi-AZ for recovery purposes.
So I'll keep it as no and cancel it.
Next, we can have a look at monitoring.
And monitoring for example,
we could trust is CPU utilization.
And as we can see while the CPU utilization
is monitored by my database,
and we can monitor this, for example,
for scaling our database.
If in case we have too many connections into it,
we can have a look at the database connection counts as well
to see how many clients are connected to into our database
and a lot of metrics overall, okay?
Other things you can do with RDS,
is around creating snapshots.
So you can take snapshots
and this will snapshot your database
and you can restore it wherever you want.
You can restore to a point in time for your database,
or you can even migrate a snapshot
if you want to migrate a snapshot
into a different region, for example.
So all of these are a bunch of options that we can use,
but as we can see,
the whole power of RDS is to manage the database
for us to have replicas as multi-AZ.
We can increase the instance type as we go along and so on.
And that's all comes very handy
from a managed service perspective.
So you've seen all you need to know for your RDS database.
I hope you liked it.
And just to finish yourself,
please make sure to delete the database.
To delete it,
first you need to remove the termination protection.
So you go to Modify, and then at the very bottom,
you will scroll down
and find the delete protection settings.
So here it is, we'll disable it press and continue
and then Apply immediately.
And then once the delete protection is done,
you can go ahead and delete this database.
You can remove creating a final snapshot
and then say delete me and acknowledge the fact
that upon deletion everything will be lost.
Click on Delete and you're good to go.
So that's it for this lecture. I hope you liked it.
And I will see you in the next lecture.