Hi friends, I am Parwayze and in this video I'm going to show you that how you can connect your Django project with Amazon RDS My Skill instance
So before starting our main topic, if you're interested in Django and DjangoRist framework, you can join my course on Jango and Jango Rist framework
It's about a 17 hours training course. You can see the Jenga and JengaRest framework with React Frontend
We are building a blog application in Django, chatbot integration with Jango
and also we have a question and answer app, Django Rest framework and also Rest
API backend for Q&A app and also at the end we are integrating our back-end
rest API with React the JS front-end. So if you're interested in this course I have
added the link in the video description and you can join this course. Now first of all
what is Amazon RDS. Now Amazon RDS or we can say RDS it stands for Amazon
relational database service. It makes it easy to set up, operate and scale a relational database in the cloud
It provides cost-efficient and resizable capacity while automating time-consuming administration tasks, such as hardware provisioning, database setup, patching, and also backups. Now there are different
instance types and also engines that you can use for the RDS. For example, we can use Amazon
Aurora, Postgres, MySQL, MarioDB, Oracle database, and also SQL server. So we are interested in MySQL
Now, first of all, you should have an account in Amazon AWS, so I already have created an account
And also you need to have a user, also I have created a user in here
After that, we can just click on all services. There are different services for Amazon AWS
We are interested in RDS,ive, so along in the database. section along with DynamoDB we have RDS. Now let's just click on RDS and let's just wait
And now we're going to just click on create database and from here if you see let's just wait for this
Okay now you can see that from here we need to choose a standard create and if you see that there are
different engine types and We have MySQL, this is from the Amazon itself, we have MarioDB, Postgres, Oracle, and Microsoft SQL server
So we're interested in MySQL. Let me just check this MySQL. And this is the version. We want to just use the default version
And from here, we are going to just use free tight template because it's not a production level
And we can just click on this. And for example, if you have a production label, then you can just pay for this
And after that, this is the deployment options. For example, for the free time, these are disabled
And if you're using, for example, production or if you're paying, these will be enabled
And the settings, we have DB and Stens identifier. This is the, for example, the database name
For example, let me just say AWS DJ. And after that, so these are the credentials that we have
and in here you can see that we need to give the username so this is at main but if you're changing
then you should remember that this is the password let's just give a password in here
and let's confirm the password for example like this we can just give it a password
and this is the db instances right now there's just one in instance but for example if you're
using a paid version you will have more instances and also this is the storage so
leave it as a default and this is the allocated storage 20 gigabyte for example if you
want to change you can change it and you can see this is the maximum this is the
minimum and also we have maximum this is the maximum that you can add it in here also
we have auto scaling for example it reaches the maximum and it will use the
auto scaling and also we have maximum storage threshold it's 1,000 gigabyte so we
connectivity we want to just leave it as itself because we're using from local
house then we can choose the public access yes and we have additional seating so
this is the port and you can just leave it like this so this is 3306 and after
that this is the database authentication we are not touching this and let's just
click on create And it will take a little bit. And you can see that your database might take
might take a few minutes to launch, and let's just wait for this
So now you can see that our database is created, and it's AWSDG
And if you see, this is the status and this is available
it means that the MySQL instance database is created. Now let's just click on this, and let's check the information
check the information about you can see that this is the end point this is the port number we have security also we have availability zone and these are the information for the MySQL database So now we have our MySQL instance Now let test this So for this I going to use
MySQL workbench. So first of all, let's just copy this endpoint and we can just click on this
and let's so in here we can just give a name let me just say my connection we need to give the host name so this should be the host name this is the port and if you see in here we have the port and also we need to change the username to admin because we have admin username and let's just give the password in here so let me just give the password
after that click on okay and let's just click on if I let me just check this okay fail
to connect with a user admin now let me check that I have internet connection so
now let me just test connection make sure that you have internet connection and
here let's first check that so we are receiving the connection or we are
receiving the error. Now if there was an error, so let me just let me click on okay. So this is my
connection. Let me just click on this my connection and let's just wait for this. So you can see
that we're receiving error and the last connection. So if you are facing this problem, you can just
go to this VP security group and from here you need to add some configuration
And let's just wait for this. And in here we have one inbound rules. So you can see that this is the inbound rules
And in this section we need to edit inbound rules. and let's just add rule in here and from here we can just use all traffic and we can just use thisattae and let's just save rule
there was an error modifying your security inbound rules rule per allowed exists let's just check
so this is the inbound rule and let me remove or we have this old traffic let me delete this and
let me just add another one so let me just choose where is it all traffic
and we can just use this and let's save rule okay now inbound group security group
rules modified and now let's just try this once more click on this all right guys
now you can see that it's connected and now we have our my connection in here so
in this section if I say for example show databases and and let's run this and let's just wait for the featuring so you can see that we have these in here
now let's just create a database so let me just say create database and let me just name it my blog
and let's run this so now it's create it create database my blog and
And now if I say show databases, so now you can see that we have our MyBlock database in here
So you can see that now we have our connection and with MySQL work bench and also MySQLRDs from Amazon
Now what we want, we want to create our Django project. So I'm using PiCharm ID
Now let's install Django, so PEP install Django. And also, let's just wait for the installation
And also when you're connecting your MySQL with the MySQL workbench. Now make sure that you have internet connection
If you don't have, there will be problem and also a problem in the connection
So it installed Let install MySQL client MySQL client Because we using MySQL and by the fault Django uses SQL iC2 we want to change the configuration to mySQL and for that we need to
install the driver for the mySQL and that's called my skill client so now
these are installed and so now let's create our Django project so
So Django AdMain start project and let me just call it My project for example
And you'll see that we have our My project and these are the files
And now I can just say Python manage. . migrate. So we need to change directory to my project and now we can just say Python manage
migrate and now you will see that we have some migrate files and also you can see
that it will create a db.clyte tree because by the fault Django uses SQLite now
if you see in the settings dot pi file in here and if I come down and so let me just
okay now you can see that in the databases we have the engine and this is
cclyte3 and this is the db.clic3 that's created okay so we want to change this
to MySQL and also now in the name in here we need to change that so first we need to give
the name of the database so that's my blog our right side thing uppercase so let me just
grab this and let's just add this in here and after that we need to just give the user so
the user is a admin and also we have the password like this and the password is I think this was
the password and also we have the host so I can just say host and for the host I need to just
copy this end point and let me just copy this and let me paste that in here
also we need the port and the port is 3 3 this is the port and if you see in here
and out this section you can see that this is the port okay so now we have our
information and after adding of these information now let's just run again we
can just say Python manage dot pi and I can just say migrate so I need to
migrate this again because now I have used MySQL database and now it is doing the migration
And now this warning, there's no problem with the warning and let's just wait for this
And now it's adding the information. So let's wait for this and it is doing its job
Okay, now it's done
So now if I say, I show data. databases let's just run this let's just wait for this and you can see it's working
okay so we have the database but we want to show the tables so show the tables so show
tables and let's just run this show tables error no data we selected okay so first we need to just say
for example so first let me remove this I can just say use my blog and let's run this
So now it's selected after that we can just say show tables
Okay, now you can see that we have outgroup, outpermation. Now these are the tables from the Django
So now if I check this OTH user, you will see that I don't have any user in here
So if I say Describe ot underscore user. and if I run this okay so now you can see that I have my ID password now these are the
fields for this Everyone out user now if I say for example select so select
all from a out underscore user and let run this okay so now So now you can see that there no data so we have ID password login Now let create a super user and in here I can just say Python manage
Create super user and let's just wait so we can just leave it as this
You can give an email address and we can give a password so we can give a password so we can
let me just give a password in here like this so now super user is created now if i say select all from
out user and if i refresh if i run this uh you will see that now i have just you can see that i have
this user it's super user this is the username that we have created and this is the email address
and these are the information so now let's create an app here and we want to create our own model in here let me just say Python manage
. Start app and I can just go out my app. So it's created and let's add the app in the settings.pai file so we can just in the installed
apps and here I can just say my app and after doing that let's just open our my app and
in the models. Let me create a model. So let me just call it, for example, blog model
So you can just say models.model. I want two fields, title, models.chartfield
And I can give the max length to 250. And I can just give, for example, the body
And let's just say models. Text field like this. And let's register this model to that main or first let me just
migrate this so you can just say Python manage. pi make migrations and now you can see
create model block and now you can just say Python manage.pai migrate migrate
the migration and it will take a little bit so now in here if I for example if I say show
tables so now you can see that we have my app block so this is the new table
Right now, there is no data in this table. If I just say, for example, select all from my app, my app, underscore block
And if I execute this, you will see that I have ID, title, body, but I don't have any data
in here. add some data let's register this model in our admin. pify so in here from dot models we're
going to import blog and in here I can just say admin dot site dot register and I want to register
the blog model so now let's just run this run over this Jang application
Python manage.pyram server. Now this is the latest version of Django
It's Django4. So let me just open this in another browser in here
So you can see that this is Django4. And now we need to just open our
add main panel we can just go to the add main and let me just add my username and also let me just add my password
and let's log in so now we have our blog now let me just click on this and from here we need to just add data
so let me just wait and I can add for example title also let me just wait for this
so for example let me just say first title and I can just say first body and let's save this
and now this will be the first data that's added to our this model
now this is added now if i run this and if i run this you'll see that now you can see first title
and also first body so thank you guys if you have any question please let me know and for the
further further videos please subscribe to my channel like the video and also share the video