Database
RDS and EC2

RDS and EC2 JUMPHOST

RDS and EC2 are two different services provided by AWS that can be used for database management.

Alt text for the image

There is a concept called subnect group in RDS which is a collection of subnet. When you lauch your AWS RDS instance you need to specify the subnet group that you want to use and by default RDS requires your subnet into two different availability zone.

To understand more on creating subnet group you can refer to the VPC & Subnet (opens in a new tab)

Here since we require two different availability zone we will create two different private subnet group one in ca-central-1a with 10.0.2.0/24 and ca-central-1b 10.0.3.0/24.

Now you can create a subnet group for you RDS instance.

Alt text for the image

Now create you RDS Database instance.

Alt text for the image Alt text for the image Alt text for the image Alt text for the image

Now finally go to your newly created security group and add a new inbound rule to allow access from your EC2 instance security group.

  1. Add rule
  2. Select PostgresQL / TCP / 5432 / Custom / Select your EC2 security group (security group that is assigned for you ec2 instance).
  3. Save