Creating an RDS PostgreSQL Database on the AWS Free Tier

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone and in this video we're going to be walking through how you can set up a managed relational database for free on the aws free tier and we will get started so i'm at the aws management console right now i'm going to type in rds and we're going to view the rds dashboard so give this thing a second to load okay and then what we're going to do is we're going to click on create database and it's going to take us to a page where we can choose the type of database we're going to be making so i'm going gonna stick with standard creates and you're choosing the database engine right here i'm gonna stick with the default postgres and in terms of the templates right here because we're trying to keep this on the free tier to not get billed for it we'll stick with the free tier templates you'll note how they just took away our ability to have higher availability and durability with the multi-az stuff and that's because it would basically be spinning up additional instances in uh different azs that you have copies of your data but on the free tier this is really just to play around and learn with stuff so we're not going to be doing that and it doesn't let us choose it also which is great now in terms of the settings here we're going to give a name to our database instance and so i'm going to call this one my db instance very original and then we're going to give this thing a master username make sure you remember this username because it will be important for when we connect to it later on and then in terms of a master password i'm going to give you one yes of what my password is uh so basically we're just going to enter this into our database and make sure you remember your master password as well and in terms of the instance itself so this is the underlying computer the memory and the processor they're going to be running our particular database and in our case they're defaulting us to this db.t3 micro so we've got two cpus and one gig of ram and this will be free for us included in that free tier so we're going to stick with that which is great in terms of storage you have to stay with the gp2 the general purpose 2 ssd to stay on the free tier if you start trying other stuff you can get billed for it so make sure to just stick with the defaults on this and then you are allocated 20 gigabytes for free in your database on the free tier uh and they do default to check this box for auto scaling so basically you know let's say you just got in millions of additional records and now you need more space if you have this feature enabled it will automatically scale up your database uh to handle that but in our case just being careful not getting built for this thing we're going to uncheck it and 20 gigs is the minimum amount for this database that we're going to be creating or our rds and in our case i'm going to stick with the default vpc that we have associated with this aws account i'm also going to keep the subnet group as default and then in our case because we're going to want to be able to connect to this database from another computer or from this computer i'm going to select yes for public access and i'm just going to stick with the existing vpc and the default security group for this vpc and we're not going to have any preference for az but if you did you can specify that in here and then additional configuration stuff we're literally specifying the port which in the case of postgres engine it will be 5432 but you can change this if you want and to make it easier for us to connect this thing we're only going to be doing password authentication but you can also include i am authentication and kerberos authentication but we're not going to do that just for learning this stuff and then additional stuff you give this thing an initial database name this is a very important thing to do because otherwise we will not have a database present so we want to type in a name so i'll call this initial db and we'll just leave it at that and then in our case you can also have backups created of your database if you have very sensitive data um i'm not we're already playing around with this so i'm not gonna be doing backups but if you did you would check that box and configure it to your heart's content enabling encryption is recommended for security and we're just going to leave it and then performance insights these are things that are actually included for you on the free tier and if you wanted to have more duration of data to look at you can pay for it and not be on the free tier anymore so we'll keep it on just to see what that looks like for us uh in terms of monitoring um i'm not going to enable this because we're trying to stay cheap here and then in terms of maintenance we'll just gonna leave everything else here as default and they're pretty cool telling you your estimated monthly costs so basically um these are the details of our free tier instance and now we will just click on create and one thing i will make note of is that creating these rds databases uh does take quite a while and obviously they saw that my very generic password has been used in the breach before so uh just promise you don't tell anyone and we're going to give this thing a few minutes to finish spinning up and we'll come back to it uh while that's happening uh and also while this thing's going another thing i want to make note of is that in order to connect to our database if you're on a windows or a mac or an ubuntu machine or whatever there is this nice little client here called sqltron and you can google them i'll paste in a link right here and i'll include one in the description but basically very simple just service to give us a little thing i downloaded the executable for windows if you're on mac you download the dmg um and so once our database comes up online uh we will be able to go through the steps of actually connecting to it so we'll come back to the action when we get there alrighty and so after about five minutes uh the rds data uh is now online for us so that's great and what we're gonna do is we're going to uh click on your db identifier so the mydb instance thing and make sure that you look at its endpoints so in our case we're going to make sure we copy this particular endpoint and just save this for later so i'm going to paste this on a little notepad i have and then we're also going to make sure that we remember this port right there and then also if you completely forgot what your master username was if you click on the configuration tab you can see exactly what you know the initial db name is as well as the master username like that so now what we're going to do is we're going to actually connect to this guy that aws is hosting for us so we're going to open up the sql tron installer that we have and this is the default home page i don't have anything here yet so we're going to click on add and in terms of the name you know we'll just call this the my db let me call it whatever you like and then in terms of the database type we chose to go with a postgres uh engine so that's what we're going to put in here if you did something else obviously put that there in terms of the server address this is going to be that endpoint that aws told us you can see that 5432 is a default for postgres we're going to keep that where it is and then also in terms of the user and the password this is where we're going to put in the credentials that master user that we created which was conveniently called postgres and then also the password which uh you know we know what that is um and then finally uh what we're going to do here is we're going to give it the initial database name and in our case we called it like uh initial db and that is all we need for this and then if you click on this blue test button right here it'll hopefully tell us that this thing is good so give it a second so we're getting a timeout right now and so when you get network timeouts like this uh what you want to make sure of is that you have configured your security groups correctly so in my case i'm going to minimize this window we're going to go back to the rds dashboard in aws and it's because i forgot to do something which is configuring my security group appropriately so in our case remember port 5432 because that is the port that our instance is listening on so we're going to click on this default security group that was created for us and i'm going to look at the inbound rules right here and what i'm going to do is i'm going to click on edit inbound rules i'm going to add a rule allow custom tcp traffic port 5432 and we're basically going to allow it to come from any ipv4 address i'm going to add another custom tcp rule again port 5432 and then we're going to allow it to come from any ip6 address ipv6 we're going to click on save rules i'm going to give this thing a second to propagate and now what i'm going to do is i'm going to go back to the rds page that we were on where we were looking at this database instance and we can see that this thing is running it online but we're just having a hard time connecting to it so now what we're going to do is we're going to open up sqltron we're again going to try connecting to this guy and it's telling us that this initial db database does not exist so let me just confirm here that i've named my initial i'm had a typo which is all reason why it's not connecting so what we're going to do is we're going to paste in the typo name and we're going to again test this and what we're going to see is that this thing is now successfully connected and i'm going to save this and what i'm going to do next is now we can actually connect to this thing so our test was successful we're going to connect to it and we are going to now perform the following so we're going to start out by just making a table and this is literally just playing around at this point we're going to execute this command you can see it successfully makes the table and then we're going to insert some lines into this table and these are all stuff that you can copy paste off somewhere else on the internet but we're just pasting in some values into our table to show that our uh hosted database in aws is actually working as expected and then um now what i'm going to do is i'm going to run some additional commands just to see like we're actually getting results back so we can see that we're seeing those two data entries we just added and then finally when we're done with all this stuff we can drop our table to just delete everything by just doing drop table links which is our table name and so that is how simple and easy it is to get up and started with a hosted aws database for us in rds and we're using the postgres engine so that's pretty cool so i'm going to press this little power button here to disconnect from my database i'm just going to close out the sql tron at this point and now what we're going to do to make sure we get built from this stuff like a year or two from now if we forget is we're going to go to the databases section of rds and then i'm going to click on this guy and click on actions and then click on delete and i do not want to create a file snapshot so i'm going to uncheck this box and then say i know that i'm going to lose everything and we're just going to type delete me into this box and hit delete and deleting this database will take some time to complete so we're just going to let this thing do its thing but basically that is how you can get up and started with playing around with hosted databases in rds with aws i hope this is helpful let me know if you have any questions and i'll talk to you guys next time
Info
Channel: Vincent Stevenson
Views: 13,344
Rating: undefined out of 5
Keywords:
Id: I_fTQTsz2nQ
Channel Id: undefined
Length: 11min 19sec (679 seconds)
Published: Fri Jun 17 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.