DEV Community

Rajdwip Chaki
Rajdwip Chaki

Posted on

Playing with AWS RDS (#1)

Let's start by creating our own VPC first.
It's quite easy with the new UI.
New create VPC experience
Use the 'Name tag auto-generation' feature to generate the name tag for all resources. For example, if I enter the value 'myvpc' as a Name tag, then each of the vpc resources would contain this phrase 'myvpc' in each their respective name tags.
Name tags of VPC resources
Let's keep the no. of AZs, public and private subnets to 2 (as defaulted), NAT gateway in 1 AZ, and leave other attributes to their default values.
Click on the 'Create VPC' button now.
With this new create VPC UI experience, you can see the progress of each steps.
Create vpc workflow

Now as the VPC is created, let's move to the RDS part.
I'm selecting postgres for this example.

RDS Console

  1. Click on the 'Create database' button.
  2. Select 'PostgreSQL' as the DB engine. Let's use the default engine version populated (13.7-R1 for me).
  3. Select Dev/Test as a template.
  4. Select 'Single DB Instance' as deployment option which would create a single DB instance with no standby instances.
  5. Now select the DB instance attributes like DB instance name, master username & password, DB instance class etc. DB instance attributes
  6. Select general SSD (gp2) as storage class with a 25 GB storage.
  7. In the connectivity section, select the VPC that you created. Also, keep the 'Public access' to 'Yes' for us to connect to the DB through internet.
  8. Select 'Create new' for the VPC security group and provide a name for the new security group.
  9. Lastly, provide a name for the initial database in the 'Additional configuration' section.
  10. Leave other options to their default values, and click on the 'Create database' button.

Now the database is being created, it would take some time for up and running.

Meanwhile, let's download pgadmin (postgres admin tool) from https://www.pgadmin.org/download/. We would test the connectivity to our AWS RDS database using this pgadmin tool.
After the installation is completed, start the pgadmin tool. It would look something like the following.

pgadmin
We intend to setup the connection to our RDS database using pgadmin. For this, we first new our RDS endpoint.
Hopefully, the RDS configuration is completed by this time and it is up and running. Go to the AWS RDS console, and check the status of the RDS instance.

database instance status
Click on the DB identifier.

database instance details

Copy the endpoint shown under 'Connectivity & security' section.
Go to pgadmin. Right-click 'Servers'. Select Register->Server..
Provide a name to this connection.
Paste the endpoint information (copied earlier) in the 'Hostname/address' edit box and click on save.

pgadmin endpoint

Once the connection is established, you can find the initial database that you created your postgres DB instance.

postgres db

Check the events created in RDS console

rds events

What would happen if we change the instance type for this Single AZ deployment

Changing instance type from db.t3.micro to db.t3.small.
modify instance type

Modification is in progress..
modification in progress

The corresponding events get logged and can be seen in the 'Logs & events' section. Note that DB instance was shut down and restarted after the change was applied. It generally takes 2-5 mins (based on my experience) for the DB instance to be up and running after the modification.

db instance change

What would happen if we change the instance type for a multi-AZ deployment

Let's first make our DB instance multi-AZ.
multi-az
Wait till the multi-AZ conversion is completed. muti az status

muti-az events
Now, let's change back the instance type from db.t3.small to db.t3.micro.

db instance type change

Note that the moment the DB instance was shut down, Multi-AZ instance failover started. And hence the DB instance came back to a running state quite fast.

db ins type change events

Top comments (0)