Hi, everyone, and welcome back.
Now, in today's video, we are going to discuss about the basics of Rrd's proxy.
Now, before we understand this topic in more detail, it is important for us to first understand the
basics and the advantages that the database proxy provides.
So first, let's go ahead and discuss the basics of database proxy at a high level overview.
Database proxy is an intermediary between a user and the database, and same can be depicted from this
diagram where the proxy acts as a middleman between the client and the database.
Now, one of the benefit of this approach is that since all of the queries from the client goes through
this specific proxy, there are a lot of controls and optimizations that can be applied at a proxy level.
For example, let's say you want to block a specific kind of a request.
This is something that you can do at a proxy level itself.
So if such request is received from a client, any time it is directly blocked at a proxy, the request
never goes to the database and hence there are a lot of controls and optimizations that you can apply
in such architecture.
So in order to understand things in a better way, let's take a simple use case associated with a failover
scenario.
So in this specific diagram, you have a single database and all the connections to the database are
going through the proxy.
Now due to some reason, let's say that this primary database fails in such cases.
If there is a standby database that is available, then proxy can go ahead and redirect the request
to the standby database instance.
All right.
Now, here, the client does not really need to worry about the IP address of the standby DB instance,
because if the primary feels the IP address of the DB will also change or the URL of the database will
also change.
But since client is connecting to the proxy, proxy takes care of redirecting the request, along with
that, the existing request that had come to the proxy that was supposed to go to the primary database.
Since the primary database has failed, the proxy can redirect those requests to the standby DB.
Those requests will not fail and this will improve the overall resiliency of the application as well.
Otherwise, if the client was directly communicating with the primary DB and if the primary DB fails,
then the entire application would go down and this is something that is not recommended for production.
Now, along with that, in order to understand the AIDS proxy, it is important that we understand the
basics of database connection.
For example, when a client sends a request to a database, let's say a client sends a write request
where he wants to write a specific data to the database.
So behind the scenes, even if a small data is written to the database, there are a lot of steps that
are taken up behind the scenes.
So one of the first primary step is that the application makes use of the database driver to open the
connection to the database.
So this is the first part.
Second is the network socket is open at the operating system level to connect the application to the
database.
Then you also have authentication that takes place.
You also have data that is written to once the authentication completes and once the operation, whatever
database operation is completed, the connection can be closed from the application side and then the
network socket is closed.
So from here we can understand that even if a client wants to read small amount of data or write small
amount of data behind the scenes, there are a lot of things that are taking place.
And this in turn cost in terms of CPU and memory.
Now if there is one request, this does not really impact, but let's say there are millions of requests,
there are millions of users who are visiting website, there are millions of requests that are going
to the database.
Then maintaining the database connection is something that will increase the load significantly.
So in order to overcome this, there is a concept called connection pooling.
So the database connection pooling is a way to reduce the cost of opening and closing the connection
by maintaining a pool of open connections.
So what happens here is that you have the proxy for an example between a proxy and a database.
There is an open connection that is already established.
So now when the client sends the request to the proxy, since the connections are already present,
the proxy will use the existing connection to go ahead and perform the operation that the client has
requested.
So a certain set or a certain pool of open connections are maintained by the proxy and this reduces
the cost in terms of CPU and memory here.
All right.
So I hope with this you understood some of the benefits that a database proxy can provide.
And in a similar way, when we discuss about ads, we have a feature called RDF Proxy.
So at a high level overview Ideas proxy is a fully managed database proxy for Amazon ideas as we're
discussing.
Similar to the database Proxy ideas, Proxy also provides multiple set of benefits like connection pooling.
We have discussed like the availability in case if the primary DB fails, then the proxy can automatically
connect to the standby instance and the connections are not dropped.
And you also have the benefit of authentication where at a proxy level you can enforce the IAM authentication
for database, you do not really need to specify the database credentials.
So all of these enforcement can be done at the proxy level.
So let's do one thing.
Let's go ahead and have a quick demo.
Now for today's demo I have a database instance that is available.
Let's quickly open this up.
This is the endpoint of the database.
Let's go ahead and quickly connect to it now from the CLA.
Let me go ahead and quickly connect to the database endpoint.
I'll specify the username of admin and the password as expected.
You see, we are logged in and if you do something like show databases, we are able to see the list
of database grid.
So let's go ahead and come out.
Now at this stage we have taken an example where the client is directly communicating with the database.
Now let's go ahead and take an example of Rrd's proxy, where the client will connect to the database
through a Rrd's proxy.
Now, from the IDS console, I already have the proxy configured.
Let me quickly show you.
So there is a proxy that is configured.
Now, if we look over here, there is a proxy endpoint.
So this is the endpoint that the client needs to connect to.
Now generally once you have the proxy available, you have to configure the client so that they send
request only to the proxy and not to the database.
And this can also be enforced using the security group, if you'd like.
And within you you see that you have the target group and the target group here is database one.
So the associated database is database one, which is nothing but this specific database.
So the proxy is connected to the database.
Now let's go ahead and send the request to the proxy endpoint.
So from my CLA again, let's go ahead and try connecting to the proxy.
Let's specify the password.
And you see, we are connected to the database.
If you do a show databases again, you will see the same list of databases that are available Now,
since you have the IDs proxy in place.
Various things like the connection pooling and others are automatically taken care by the proxy.
Now, along with that, there are other things that you can also enforce.
Let me quickly give you an example.
So here in the IAM authentication, you can specify whether it is required or not.
Sometimes as we are discussing in this case, we had manually supplied the administrator, user and
password.
Let's say you do not really want or you do not want to allow that at all.
So this is also something that can be enforced at a proxy level.
So in case if you select it as required, this means allow only IM authentication, database credentials
cannot be used, so all of these things can be configured.
You can also configure the TLS in case if you'd like.
Great.
So I hope with this at a high level overview, you understood the basics on what our proxy allows us
to do, and with this will conclude today's video.