Setting up a Relational Database Service (RDS) database in Amazon Web Services (AWS) is an essential skill for developers and data engineers. This blog post outlines four different methods for creating an RDS database, providing step-by-step instructions that are easy for beginners to follow. Additionally, we will discuss how to create schemas after establishing the database.
1. Creating RDS Database through AWS Management Console
The AWS Management Console offers a user-friendly way to create an RDS instance.
Steps:
- Log in to the AWS Management Console:
- Go to AWS Management Console.
- Sign in with your credentials.
- Navigate to RDS:
- In the console, find the search bar and type “RDS.”
- Click on “RDS” to open the RDS dashboard.
- Launch DB Instance:
- Click on the “Create database” button.
- Choose the “Standard Create” option for a detailed setup.
- Select Database Engine:
- Choose your preferred database engine (e.g., MySQL, PostgreSQL, Oracle, SQL Server).
- Click “Next.”
- Configure Database Settings:
- Set a unique DB instance identifier.
- Create a master username and password.
- Choose the instance class and storage type.
- Configure Connectivity:
- Select your Virtual Private Cloud (VPC).
- Configure public accessibility if you wish to access the database from the internet.
- Additional Configuration:
- Set backup, security, and monitoring options based on your needs.
- Create the Database:
- Review your selections, then click the “Create database” button.
- Wait for the DB instance status to change to “Available.”
Create Schema:
- Connect to the RDS Instance:
- Use a database client like MySQL Workbench or pgAdmin.
- Connect using the endpoint, master username, and password.
- Create Schema:
- Run the SQL command:
CREATE SCHEMA your_schema_name;
- Run the SQL command:
2. Creating RDS Database via AWS CLI
If you prefer command line interfaces, the AWS Command Line Interface (CLI) is a powerful tool.
Steps:
- Install AWS CLI:
- Follow the installation guide from AWS CLI Documentation.
- Configure AWS CLI:
- Run the command:
aws configure - Enter your Access Key, Secret Key, region, and output format.
- Run the command:
- Create RDS Database:
- Use the following command:
aws rds create-db-instance --db-instance-identifier your-db-identifier --db-instance-class db.t2.micro --engine mysql --master-username your_username --master-user-password your_password --allocated-storage 20
Create Schema:
- Connect to Database:
- Use the command line to connect using MySQL or PostgreSQL client.
- Run SQL Command:
- Execute:
CREATE SCHEMA your_schema_name;
- Execute:
3. Creating RDS Database using CloudFormation
AWS CloudFormation allows you to provision RDS instances as code.
Steps:
- Create CloudFormation Template:
- Create a
template.yamlfile with the following content:Resources:
MyDBInstance:
Type: AWS::RDS::DBInstance
Properties:
DBInstanceIdentifier: your-db-identifier
AllocatedStorage: '20'
DBInstanceClass: db.t2.micro
Engine: mysql
MasterUsername: your_username
MasterUserPassword: your_password
- Create a
- Deploy the Stack:
- Use the CLI command:
aws cloudformation create-stack --stack-name mystack --template-body file://template.yaml
Create Schema:
- Connect to Database:
- Connect via your preferred SQL client.
- Run SQL Command:
- Execute:
CREATE SCHEMA your_schema_name;
- Execute:
4. Creating RDS Database with Terraform
Terraform is another Infrastructure as Code (IaC) tool that simplifies database creation.
Steps:
- Install Terraform:
- Download and install Terraform from Terraform Downloads.
- Create a Terraform Configuration File:
- Create a file named
main.tf:provider "aws" {
region = "us-west-2"
}
resource "aws_db_instance" "default" {
allocated_storage = 20
engine = "mysql"
instance_class = "db.t2.micro"
db_username = "your_username"
db_password = "your_password"
db_name = "your_db_name"
name = "your_db_identifier"
}
- Create a file named
- Initialize and Apply Terraform:
- Run the following commands:
terraform init
terraform apply
- Run the following commands:
Create Schema:
- Connect to Database:
- Connect using your database client.
- Run SQL Command:
- Execute:
CREATE SCHEMA your_schema_name;
- Execute:
Conclusion
Creating an RDS database in AWS can be accomplished through various methods, each suitable for different skill levels and preferences. By following the steps outlined in this blog, you can set up your RDS database and create schemas successfully. Choose the method that fits best with your workflow and start building your projects with AWS RDS!






Start Discussion