'How to create table in RDS database on amazon web service

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?



Solution 1:[1]

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.

Solution 2:[2]

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

Solution 3:[3]

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.

Solution 4:[4]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 slayedbylucifer
Solution 2
Solution 3 Emre Tapc?
Solution 4