Reputation: 393
I am using AWS Amazon Web Service RDS for database. I have set up a database instance but how should I add the tables in that database instance or create any new tables in the database? Any idea how to add table?
Upvotes: 14
Views: 38863
Reputation: 21
Connecting and manipulating a AWS RDS is no different from a local database. However, AWS regions, VPCs, Subnets, and IAMs have to be configured correctly.
I would suggest extracting what you need from the AWS getting started with RDS MySQL documentation. Pay close attention to the Connectivity section in Create a MySQL DB Instance for configuring the security features and related links.
https://aws.amazon.com/getting-started/hands-on/create-mysql-db/
Upvotes: 0
Reputation: 642
Upvotes: 1
Reputation: 1908
You can create a lambda function in the VPC, use an ORM to create migrations and call the function from the command line using aws command line tool.
Upvotes: 1
Reputation: 741
Is your database in private or public subnet? That matters as it will affect how we can connect to it. If your RDS database is in a private subnet, then you cannot directly connect to it with a SQL client like MySQL Workbench from your PC.
I would advise you to put the database in private subnet for security concerns.
Now let's assume your database is in private subnet. What you can do is to rent a very cheap EC2 instance as a bastion instance in a public subnet. You can use SSH over TCP/IP or SSH tunneling to connect to this RDS instance even from outside your VPC as mentioned here https://www.youtube.com/watch?v=gM7JvNMOUQM.
Here is a blog that has some details of how to do it. https://bobbyhadz.com/blog/aws-cdk-rds-example
Upvotes: 1
Reputation: 2086
If you manage to ssh to your EC2 instance you can connect to your database using MySQL command line tool.
mysql -h [DatabaseConncetivityEndpoint] -u [usernameOfDatabaseInstance] - p [password]
Make sure that you have installed MySQL client using > mysql -v
. If not you can install MySQL client inside EC2 instance:
> yum update
> yum install mysql
Then, you can flow the normal MySQL operation on the database.
Upvotes: 0
Reputation: 23502
Which RDS are you using? I have been using RDS for MySQL for a long time. I create an RDS instance of MySQL and then connect to it from my laptop where I have install MySQL client program. Once I am connected, I can run all the MySQL commands just as if I ma connected to a remote database. I can create DB, Tables...blah blah..
You should provide information on the RDS instance that you are using and how your connecting to it.
Upvotes: 6