Aijaz Ali
Aijaz Ali

Reputation: 393

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?

Upvotes: 14

Views: 38863

Answers (6)

DEC
DEC

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

surge10
surge10

Reputation: 642

  1. First make sure you have an instance of ec2 running.
  2. Watch this video here on how to create security groups and add them to your database instance. This video actually guides you through the creation of a new database, but you will get it.
  3. Next, follow the video to create a "database". What you have created in amazon RDS isn't really seen as a database. So you will have to use an sql statement create a database. Hope this works.

Upvotes: 1

Emre Tapcı
Emre Tapcı

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

Yang Liu
Yang Liu

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

ewalel
ewalel

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

slayedbylucifer
slayedbylucifer

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

Related Questions