Hosting Database(Database Tier)- AWS(Amazon Web Services)

BySai Charan Paloju

Nov 26, 2022 #AmazonEC2Components, #AmazonEC2InstanceTypes, #AmazonElasticBlockStorage-EBS, #AmazonElasticFileSystem-EFS, #AmazonMachineImages(AMI), #AmazonS3WebHosting, #AmazonSimpleStorageService-S3, #ApplicationLoadBalancer, #AttachLoadBalancertoAutoScaling, #AutoScalingGroups, #AWS Command Line Interface, #AWS Curriculum, #AWS Database Management, #AWS High Availability, #AWS Monitoring, #AWS Networking, #AWS Server Management, #AWS Storage Management, #AWSAvailabilityZones, #AWSCLIConfigurations, #AWSCLIFeatures, #AWSCommandLineInterface, #AWSDatabaseManagement, #AWSHighAvailability, #AWSInternetGateway, #AWSManagementConsole, #AWSMonitoring, #AWSNetworking, #AWSRegions, #AWSServerManagement, #AWSStorageManagement, #Backups-SNAPSHOTS, #Cloud Concepts, #Cloud DevOps Engineer Course, #CloudConcepts, #CloudProviders-AWSvsAZUREvsGCP, #CloudwatchAlarms, #CloudwatchDashboards, #ConfigureAWSCLI, #ConfigureEmailForHighCPUUsage, #ConfiguringFirewallsForEFSAccess, #CreatePAASMySQLDatabase, #CreatingaCustomVPCUsingAWSCLI, #CreatingDownScalePolicy, #CreatingUpScalePolicy, #CustomAmazonMachineImages, #Database&Tables, #DatabaseConcepts, #DefinethebenefitsoftheAWScloudincluding, #DeployingWebApplicationsOnEC2Instance, #DesigningCustomVPC-ClientRequirement, #DesigningHighlyAvailableVPC, #DesktopsvsServers, #EBSADDITIONALVolume, #EBSROOTVolume, #EBSVolumeTypes, #EBSvsEFSvsS3, #EC2IPAddressTypesPublicvsPrivatevsElastic, #Elasticity, #FundamentsofCloudComputing, #HighAvailability, #IAASvsPAASvsSAAS-CloudOfferings, #IAMOverview, #IAMPolicies, #IAMUsers, #ImplementingApplicationLoadBalancer, #InfrastructureAsAService(IAAS), #InstallAWSCLIonCentOS, #IntroductiontoLoadBalancing, #IntroductiontoScalability, #LaunchConfigurations, #LogicalDataCenters, #Monitoring-Cloudwatch, #NetworkingBasics-Protocol-Port-Firewall, #Pay-as-yougopricing, #PlatformAsAService(PAAS), #ProvisionEFSFileSystem, #RelationalDatabaseService(RDS)-Features, #Reliability, #sai charan paloju, #Scalability, #Security, #SetupJavaWebApplication-PAASMySQL, #SharedFileAccessacrossMultipleInstances, #SharesFileAccessacrossMultipleAvailabilityZones, #SimpleNotificationService-SNS, #smart cherrys tech, #smart cherrys thoughts, #SoftwareAsAService(SAAS), #SSHSoftware's-GitBash&Putty&Terminal, #TakeEC2ActionUsing-CloudWatch, #TraditionalNetworkingComponents, #UnderstandingCLIReference, #UnderstandingDefaultVPC, #UnderstandingRequirementsFromClient, #VPCNACL's, #VPCPublicSubnets, #VPCRouteTables, #VPCSecurityGroups, #VPCSubnetting, #WalkthroughAWSFreeTierAccount, #WorkwithSSHKeyPairs

Hosting Database(Database Tier)- AWS(Amazon Web Services)- In computing, a database is an organized collection of data stored and accessed electronically. Small databases can be stored on a file system, while large databases are hosted on computer clusters or cloud storage.


  1. Open EC2 Intance on AWS
  2. Click on Security Groups, Click on Create Security Group
  3. Give Security group name, I’m giving databasetiersg, & Description Allow My sql
  4. Inbound rules, Type- MYSQL/Aurora, Protocol- TCP, Port range 3306, Source-Anywhere, 0.0.0./0, Description- Allow MySQL from anywhere
  5. Click on Create Security group, Security Group will be created
  6. Search rds(Managed Relational Database), Click on it
  7. Click on Create database
  8. Engine options->Select MySQL
  9. Engine Version- MySQL 5.7.40(My App Supports this, You Select Accoring to your app)
  10. Templetates- Free tier(I’m using free tier, you can use depending on your requirement)
  11. DB instance identifier- databasetierdb, Master username- root, Master Password- admin123, Confirm Password- admin123
  12. Instance Configuration- db-t3.micro(2 vCPUS, 1 GB RAM), this is enough for my app
  13. Allocated STORAGE- 20 GB, This is enough for my app
  14. Existing VPC security group- mydatabasetiersg(here im seclecting security group I created)
  15. Click on Create database
  16. Database will be created.
  17. Open Your App that you got on Github, This is my app
  18. Click on Code, Copy HTTPS Github link of your App, this is my App
  19. Connect To EC2 Instance Using Gitbash & Install Git Software on EC2 Instance Using Gitbash, To Install Type sudo yum install git
  20. Copy Link of your App on Github
  21. Type sudo git clone <Github App Link> /var/www/html & Press Enter, This Command is to clone App to Document root
  22. Type Clear & Press Enter, This Command is to clear screen
  23. Type ls /var/www/html, This command to check what is there in /var/www/html, our app files cloned to this location, we can see it
  24. Open AWS-> RDS->Databases->databasetierdb(database you created)
  25. Copy Endpoint
  26. Type yum -y install mysql php, we are installing mysql & php-mysql 
  27. Type mysql -h <Endpoint> -u <DB Instance Identifier> -p
  28. Enter Password: admin123 (Database password)
  29. We are connected to RDS-MySQL Database(5.7.40)
  30. Type show databases; This is MySQL Command, it means show databases
  31. Type show tables; This command is to show tables in databases,It says no database selected
  32. Type use mysql; here we are selecting mysql database from the list of databases, Which means database changed to mysql  now, we are on mysql database now
  33. Type show tables; This command show tables means it shows tables of mysql database, because we are on mysql database in databases, It has 40 rows
  34. Type desc user; desc means description, user means one table in database, we are seeing the description of the table called user. we can see 45 rows in user table
  35. Type Select user from user; In User table again we are selecting user with this command. we can see 4 rows in user.
  36. Type show databases; This command is to see databases. it again shows databases in mysql. 
  37. Type Create database ibm; This command is to create database, ibm is the name of the database we are giving to new database, we are creating this database in mysql database
  38. Type show databases; we can see all the databases in the list along with ibm database we created.
  39. Now Open New Gitbash session, Connect with same EC2 Instance, Dont Close the previous Gitbash session.
  40. Type ls /var/www/html, To See the list in Document root /var/www/html
  41. You Can see Our App Files Here, health.html index ph.p Licence php style.css
  42. Type sudo vi /var/www/html/php/db.php, we are creating Text file in php with the name db.php
  43. Text file is created, Press i, To Come into INSERT MODE(Edit Mode)
  44. On AWS->Databases-> Database we created-> Copy End point
  45. Paste End point at servername
  46. Replace user name & password with root & admin123, Note- this is my database instance name in aws, you write yours
  47. Press ESC & Type :wq, Press ESC Is to come out of Inset mode, :wq is to save & quit the file, db.php file will be saved on /var/www/html/php
  48. Type sudo systemctl restart httpd, to restart mysql server
  49. Copy Ipv4 address of EC2 Instance
  50. Open New tab Paste The Ipv4 address and Press Enter, You’ll see your app successfully Opened, This is my app Book Store
  51. On First Gitbash session Type use bookstore;
  52. Type show tables; to see tables in bookstore
  53. Type desc books; To see description of books table in bookstore
  54. Type select book_name from books; to see book name in books table, It shows Empty set, which means no books are there.
  55. Come to browser, Give a name of the book & name of author & price of it.I’m giving DevOps as book name, Sai as author name, 99 for the cost
  56. Type Select * from books; to see any books are there in books table, we can see the book name DevOps, author name Sai, Cost 99, which means the data is successfully saved.
  57. Give another book name, author, cost.I’m giving aws, sai,49
  58. I’m clicking on Blue color refresh button on the page, we can see number of books created and save with author names and cost of it.
  59. Come to AWS->RDS
  60. Click on Databases
  61. Select the database that you created, my database is dabasetierdb & Go to actions and select delete to delete the database.
  62. Unselect Create final snapshot, retain automated backups, because i dont the data anymore so im deleting it without creating snapshots or automated backups
  63. Select Acknowledge, and write delete me, click on delete
  64. The database i created for my app is deleted on RDS, i will not be charged anymore.
  65. Also I’m going to EC2 Instance that is created, selecting it & Terminate it, I Terminated the instance, i will not be changed for Ec2 anymore.

if you have any doubts, comment below

By Sai Charan Paloju

Trained AWS Certified Solutions Architect Associate Course SAA-C02/Content Writer/Creator, Masters Degree- Software Engineering, Bachelors Degree- Computer Science & Engineering, Youtuber- Host/Interviewer/Content Creator/Video Editor, Podcaster- Host/Interviewer/Content Creator/Editor, Technical Writer, Social Media Manager/Influencer Ex-Professional Cricketer

4 thoughts on “Hosting Database(Database Tier)- AWS(Amazon Web Services)”
  1. It appears to own evaluated exactly what people are searching
    for within an online gaming expertise and drawn every one of the halts to supply the product.
    If you’re enjoying on the beginning position, you may want to play larger cards
    and crease around the smaller people.

Leave a Reply

Your email address will not be published. Required fields are marked *