RDS

In this we will create RDS Security Group and RDS subnet group with private subnets
RDS Subnet: Also called custom subnet, database subnet, private subnet
Firstly for RDS you have to create RDS security group

In Inbound  add mysql
type: mysql,protocol: tcp,port range: 3306, source: custom with value of the security group id of the web servers (so that all the web servers could access the RDS instance)


Parameter Groups: On RDS>click on create parameter groups>select mysql > write a group name > click create (can edit parameter groups for parameters like timezones etc)
You can modify the parameters on the edit parameters option.
Subnet Groups : Goto create DB subnet group > add the public subnets (minimum 2 req from different azs) to the
Create RDS Instance
Connect RDS instance with EC2 instance(a public ec2 instance)
For connection use
$ ssh -i  project.pem ec2-user@-public-ip-address
Setup DB client
$ yum -y install mariadb (install MySQL/MariaDB client)
rep1) $ mysql -h <RDS Endpoint> -P 3306 -u <userneme> -p(will prompt)
mine endpoint : project.cuhcuc7a50ji.us-west-2.rds.amazonaws.com
ec2: 34.222.130.122
 mysql -h project.cuhcuc7a50ji.us-west-2.rds.amazonaws.com -P 3306 -u admin -p  
result: not able to connect to my rds instance ,not able to telnet ->
added port 3306 on inbound sg of ec2 instance now able to telnet, lets go to rep1 and try connecting... and horray we are connected.
 once you are connected let us start playing:
Mysql> show databases;
Mysql> create database project;
Mysql> use project;
Mysql>
CREATE TABLE Students ( StudentID int, LastName varchar(255), FirstName varchar(255), City varchar(255) );
Mysql>
INSERT INTO Students ( StudentID, LastName, FirstName, City) VALUES ( "001", "Kumar", "Anil", "Singapore" );

INSERT INTO Students ( StudentID, LastName, FirstName, City) VALUES ( "002", "Reddy", "M", "Hyderabad" );

INSERT INTO Students ( StudentID, LastName, FirstName, City) VALUES ( "003", "Reddy", "N", "Hyderabad" );

INSERT INTO Students ( StudentID, LastName, FirstName, City) VALUES ( "004", "Vel", "D", "Chennai" );

INSERT INTO Students ( StudentID, LastName, FirstName, City) VALUES ( "005", "Student", "Martian", "Mars" );
Mysql>
select * from Students;

Now let us create snapshot for the RDS Instance 
via the create snapshot button
Create new RDS Instance with snapshot.
https://youtu.be/TdLhNA9cDuc
 




Comments

Popular Posts