"Mastering AWS Database Services: A Step-by-Step Guide to Creating RDS, DynamoDB, and DocumentDB"
AWS - RDS, DynamoDB, And DocumentDB:
1- AWS RDS (Relational Database Service):
AWS RDS is a managed database service that makes it easy to set up, operate, and scale relational databases in the cloud.
It supports popular database engines like MySQL, PostgreSQL, Oracle, SQL Server, and Amazon Aurora.
RDS takes care of routine database management tasks such as backups, software patching, and hardware provisioning, allowing you to focus on your application.
2- AWS DynamoDB:
DynamoDB is a fully managed NoSQL database service provided by AWS.
It offers high scalability, low latency, and automatic scaling to handle varying workloads.
DynamoDB is schema-less, meaning you don't need to define a fixed structure for your data.
It provides a flexible and scalable solution for applications that require high performance and seamless scalability.
3- AWS DocumentDB:
DocumentDB is a fully managed NoSQL document database service offered by AWS.
It is compatible with MongoDB, which means you can use existing MongoDB drivers, code, and tools with DocumentDB.
DocumentDB is designed to handle heavy workloads and offers automatic scaling, replication, and backups.
It allows you to store, retrieve, and query JSON-like documents, making it suitable for document-based applications.
In summary, AWS RDS is ideal for managing relational databases, DynamoDB is a fully managed NoSQL database for high scalability, and DocumentDB provides a scalable document database compatible with MongoDB. Each service offers its own unique features and benefits, catering to different application requirements.
Create RDS:
Once signed in, navigate to the RDS service by searching for "RDS" in the AWS Management Console search bar or by locating it under the "Database" section
In the RDS dashboard, click on the "Create database" button to start the instance creation process
Select the desired database engine from the available options like MySQL, PostgreSQL, Oracle, SQL Server, or Amazon Aurora.
Choose the engine version and click on the "Next" button to proceed.
Provide the necessary details for your database, such as DB instance identifier, master username, and password
Configure other settings like database size, backup retention period, and availability zone as per your requirements."IF NEEDED"
Click on the "Next" button to proceed
Set up Ec2 option - select - connect to Ec2 computer resource and Provide the EC2 instance which is active and running.
Review the configuration details of your RDS instance and ensure they are accurate. If everything looks correct, click on the "Create database" button.
The creation process may take a few minutes. You can monitor the progress in the RDS dashboard.
You need to configure the AWS CLI (Command Line Interface) with the appropriate access key credentials on your EC2 instance to connect with an RDS instance.
Obtain the access key ID and secret access key for the IAM user. Ensure the user has the necessary permissions to access both the EC2 and RDS resources
Start the AWS CLI configuration process: Enter the access key ID and secret access key obtained
In the EC2 instance - update and Install the MySQL client
Once the database instance is created and available, you can access it using the provided endpoint and connect to it using the specified username and password.
Run the command to connect ec2 with the database -
mysql -u user_name -h endpoint_URL -P 3306 - p
and provide the MySQL password that you created in the configuration step.
Congratulations! You have successfully created an RDS instance in AWS.
Create DynamoDB:
Navigate to the DynamoDB service by searching for "DynamoDB" in the AWS Management Console search bar or by locating it under the "Database" section.
In the DynamoDB dashboard, click on the "Create table" button to start creating a new table.
Provide a table name that represents your data.
Specify the primary key, consisting of a partition key and an optional sort key, which are used for item storage and retrieval.
Configure other table settings like read and write capacity mode based on your expected workload and performance requirements."If Needed" or just go with default options
Review the configuration settings for your DynamoDB table to ensure they are accurate. If everything looks correct, click on the "Create" button to create the table.
The creation process may take a few moments. You can monitor the progress in the DynamoDB dashboard
Once the table is created and available, you can start storing and retrieving data.
Inside Database - Is empty - let's put some data.
Go to tables - your db - select "Explore table items" - create item.
Add data such as - email and roll_no and
can also add additional attributes from - Add new attributes and create item
Data is added
Now we can Query - give the email and roll_no and run - you will find your data.
Can add additional data just by creating an item from - Your_database-select-action-create item
Congratulations! You have successfully created a DynamoDB table in AWS. You can now start utilizing the table to store, retrieve, and query your data.
Create DocumentDB:
I have not created DocumntDB myself for now but I will provide you with the required steps to create one.
Step 1: Sign in to the AWS Management Console
Step 2: Open the DocumentDB Service
- Once signed in, navigate to the DocumentDB service by searching for "DocumentDB" in the AWS Management Console search bar or by locating it under the "Database" section.
Step 3: Create a New Cluster
- In the DocumentDB dashboard, click on the "Create cluster" button to start creating a new cluster.
Step 4: Configure Cluster Settings
Provide a cluster identifier and choose the instance class and storage capacity for your cluster. Select the VPC (Virtual Private Cloud) where you want to create the cluster and choose the subnets for the cluster instances.
Step 5: Set Up Cluster Security
Choose the security group for your cluster instances. This group controls inbound and outbound traffic to the cluster.
You can either create a new security group or select an existing one.
Step 6: Configure Advanced Settings (Optional)
If needed, you can configure additional settings like backup retention, maintenance window, and monitoring options.
You can choose the desired backup retention period and define the maintenance window for updates and maintenance activities.
Step 7: Review and Create the Cluster
Review the configuration settings for your DocumentDB cluster to ensure they are accurate.
If everything looks correct, click on the "Create cluster" button to create the cluster.
Step 8: Wait for the Cluster to be Created
The creation process may take several minutes. You can monitor the progress in the DocumentDB dashboard. Once the cluster is created and available, you can access it using the provided endpoint and connect to it using the specified username and password
Congratulations! You have successfully created an Amazon DocumentDB cluster in AWS. You can now start utilizing the cluster to store and manage your document-based data.
Difference between RDS, DynamoDB, and DocumentDB:
1- Data Model:
RDS: RDS is based on a traditional relational database model. It uses tables with rows and columns to store structured data. It supports SQL queries and provides transactional consistency.
DynamoDB: DynamoDB follows a NoSQL data model. It stores data in a flexible schema-less format using key-value pairs or document-like structures. It is suitable for unstructured or semi-structured data and offers high scalability and performance.
DocumentDB: DocumentDB is also a NoSQL database but designed specifically to be compatible with MongoDB. It stores data as flexible JSON-like documents and supports MongoDB queries and operations.
2- Scalability:
RDS: RDS allows you to scale your database vertically by increasing the computing and storage capacity of the underlying hardware. Horizontal scaling (scaling across multiple instances) is available for some database engines like Amazon Aurora.
DynamoDB: DynamoDB is designed for horizontal scalability. It automatically scales to handle high-traffic and large datasets by distributing data across multiple partitions. It can handle millions of requests per second without performance degradation.
DocumentDB: DocumentDB supports horizontal scaling through replica sets, where data is automatically replicated across multiple instances in different availability zones to provide high availability and scalability
3- Performance:
RDS: RDS is optimized for complex queries, joins, and ACID (Atomicity, Consistency, Isolation, Durability) transactions. It is suitable for applications that require advanced SQL capabilities and consistent, predictable performance.
DynamoDB: DynamoDB provides low-latency, high-throughput performance. It is optimized for simple key-value lookups and can handle massive read and write workloads. It offers fast and predictable performance regardless of data size.
DocumentDB: DocumentDB delivers low-latency performance for MongoDB-compatible workloads. It provides rapid document retrieval, indexing, and querying capabilities, making it suitable for document-oriented applications
4- Flexibility:
RDS: RDS supports a variety of relational database engines such as MySQL, PostgreSQL, Oracle, SQL Server, and Amazon Aurora. It is suitable for applications that require strict data consistency, complex relationships, and advanced SQL operations.
DynamoDB: DynamoDB is a fully managed NoSQL database. It offers flexible schemas, allowing you to store and retrieve data without a fixed structure. It is well-suited for applications with evolving data models, unstructured data, or high write-and-read demand
DocumentDB: DocumentDB, like DynamoDB, provides a flexible document data model. It allows you to store and retrieve documents without a fixed schema, accommodating changing data requirements.
In summary, RDS is a traditional relational database service that provides structured data storage with SQL support, while DynamoDB is a NoSQL database service that offers flexible schema, high scalability, and fast performance.DocumentDB is a MongoDB-compatible NoSQL database with JSON document storage. Your choice between them depends on your application's data model, scalability needs, performance requirements, and the level of schema flexibility you require.
Thank you for taking the time to read my blog! I truly appreciate your interest and support. I hope you found the content valuable and enjoyable. Stay tuned for more articles coming soon. Your readership means a lot to me. Thank you once again, and have a fantastic day!!!!!