How Can I Connect to AWS RDS Instance from AWS EC2? | Connect to AWS RDS from AWS EC2 | AWS RDS Demo

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi everyone welcome back to my channel in this video I am going to demonstrate how to connect to your database running on your RDS instance inside an AWS ec2 instance all right so let's get started see you in my AWS console so now if you see for this demonstration so I have created an ec2 instance from which inside which I'm going to connect to my RDS instance database okay so this is my RDS instance so I've created this one so if you do not know how to create an RDS instance so I would recommend you to go and watch my previous video where I have shown you step by step it is a 20 minute long video in which I've explained every single detail related to RDS instance alright so the engine that is currently running is Maria DB and this is in East US 1B the size of this ec2 instead I mean RDS instance is db.t2.micro and the status is available all right so let me check for you need to have one important thing and that is endpoint and Port so make sure that you allow port number 3306 in your ec2 instance as well as your you know RDS instance okay so in my RDS instance the the security group this is the security group I am using so inside this Security Group I have allowed this particular 3306 port number so without which we cannot able to login so if you see I'm allowing my SQL Arora the port range is 3306 okay so that's what I've done so now let me connect to this ec2 instance first and then later on let me connect to this RDS instance from my ec2 instance okay so I'm going to use ec2 instance connect method I'm going to connect using EC to instance connect so there is a prerequisite before you want to connect to your database on your RDS instance you need to install some softwares on your ec2 instance so the first one is to install mariadb server so that is the engine that I'm currently running so that is why I need to install my ADB server on my ec2 instance and I'm going to enable and start Maria AV so these are the things these are the prerequisites because without which we if you do not have this server installed on your EC tour for example if you are trying to connect to the database from your local machine also you need to have this server installed on your laptop right so in the same way we need to go ahead and install this one so I've already done this so I've run through this command and I've downloaded my ADB server enabled it and restarted it okay so the username that I'm using inside the RDS instance is RDS user so if you want you can go and check that out and this is the password that I have given which is not at all secure so I'd highly recommend you to use a proper password as this is just a demonstration I'm going to use this password okay and this is my RDS endpoint so if you want to see what in in the console so if you see if you open this RDS instance under connectivity and security you will have RDS endpoint and Port so I what I've done is I've copied this endpoint and pasted in my notepad notepad that is all I've done okay so let me go to configuration okay so if you see I while creating itself RDS will ask you if you want to um you know create a new database so I said yes and I created a database called rdsdb and you can also see the master user name I'm using is RDS user so that is what I've written here RDS user and the password for that user is this one and this is my end point okay so to connect to your RDS instance you need to run this command so this is just a simple command so MySQL all right hyphen hyphen H for the hostname this is our host RDS demo you need to copy your endpoint from RDS and you need to paste it here so in this placeholder you need to place the RDS instance end point later on hyphen P capital P for mentioning the port number our port number is 3306 this is the default port for your MySQL and Aurora okay hyphenu meaning what is the username our username is RDS user so I'm mentioning RDS user and again hyphen small P small letter P lowercase p so it will prompt you for the password so you need to provide this password when it when after running this command it will prompt you for a password and you need to provide this password so let me copy this whole command and run this inside my ec2 instance okay so this is my ec2 instance I'm gonna become a super user I will say sudo Su hyphen and now let me clear my screen and I'll I'm going to paste that command that I copied okay so now if you see I'm running this command I will hit enter it is prompting me for password so I'm gonna copy my password Here admin123456 let me copy that and provide it here so whatever you paste the password it will not be appearing so it will be you know behind the scenes it will be entering so if you just need to enter it just click on enter and you you are inside mariadbi right now see so this this is how you can connect to your database or your mariadb instance using ec2 instance okay so now let us see so as you already saw right so I created a database called rdsdb so let us verify if that is available or not so to do that there is a small query that you need to run so databases so if you run this it will display all the databases that are inside this mariadb instance okay so if you see so these are all the default um you know schemas that are getting created or the databases that are getting created but this one RDS TV I created it while I was you know creating this RDS instance so that is the one you are seeing here right so that confirms that we are inside the same RDS instance that we have created all right so this is how you can connect to your RDS instance using ec2 instance all right so that's it for today's video if you're liking the content that I'm creating please consider subscribing and share it among your friends thank you foreign
Info
Channel: A Monk in Cloud ☁️
Views: 56,030
Rating: undefined out of 5
Keywords: #AWS, #LearnAWSforFree, #Free, #FreeResources, #2022, #AWSCommunityBuilderProgram, #Community, #Server, #EC2, #Instance, #EC2_Instance, #Demo, #Commands, #LearnAWS, #AWSCommunityBuilder, #AWSCertified, #Automation, #SnapshotCreation, #AWSEC2Instance, #CompleteTutorial, #LiveDemo, #ProjectBasedLearning, #ClearAWSInterview, #InterviewPreparation, #OnlineLearning, #SelfThoughtLearner, #Opportunity, #DevOps, #ITCareer, #DevOpsRoles, #Jobs, #India, #AWSDevops, #Happy, #AWSAccount, #TrainingOnAWS, #CloudComputing, #Tutorial, #AWSDemo
Id: 7e_mjVUV-zA
Channel Id: undefined
Length: 7min 14sec (434 seconds)
Published: Fri Sep 30 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.