How to 'switch' from MySQL to Amazon RDS w

2019-04-04 14:21发布

问题:

Amazon officially states: "Amazon RDS gives you access to the full capabilities of a familiar MySQL database. This means the code, applications, and tools you already use today with your existing MySQL databases work seamlessly with Amazon RDS."

I don't get this. Amazon RDS is accessible via web services and there a client libraries (like the one for .Net).

So if I have an existing .Net application that uses a DAL which in turn queries MySQL, how can I make the same DAL talk to the Amazon RDS (via the web services). Or am I missing something here?

回答1:

Amazon RDS is pure MySQL, accessible by your app the same way as any other MySQL database; the web services interface to RDS is purely for creation, deletion, and modification of the DB instances, not the DB data. From their FAQ:

Q: How do I access my running DB Instance?

Once your DB Instance is available, you can retrieve its endpoint via the DescribeDBInstance API. Using this endpoint you can construct the connection string required to connect directly with your DB Instance using your favorite database tool or programming language. In order to allow network requests to your running DB Instance, you will need to authorize access. For a detailed explanation of how to construct your connection string and get started, please refer to our Getting Started Guide.

This is the part of the Getting Started Guide you need -- it explains how to get the hostname of your new instance so you can connect to it, authorize the instance for access from the client, and then connect using the MySQL command-line client (as an example):

$ rds-describe-db-instances --headers
$ rds-authorize-db-security-group-ingress default --cidr-ip 192.0.2.0/30 --headers
$ mysql -h myinstance.crwjauxgijdf.us-east-1.rds.amazonaws.com -P 3306 -u mymasteruser -p


回答2:

Amazon RDS is just a normal server with normal MySQL access. There's only the webservice that handles instance creation etc., but everything mysql related is still the same.