Hands-On Lab: Provisioning AWS Database Services (RDS & DynamoDB)
AWS database services
Hands-On Lab: Provisioning AWS Database Services (RDS & DynamoDB)
Welcome to this guided hands-On lab! In this session, you will explore the AWS core database services covered in the AWS Certified Cloud Practitioner (CLF-C02) exam. You will gain practical experience deciding between and provisioning both relational (Amazon RDS) and non-relational/NoSQL (Amazon DynamoDB) managed databases.
Prerequisites
Before starting this lab, ensure you have the following:
- AWS Account: An active AWS account. (Free-tier eligible is recommended).
- IAM Permissions: An IAM user or role with
AdministratorAccessor specific full access to RDS and DynamoDB. - AWS CLI: The AWS Command Line Interface installed and configured (
aws configure) with your Access Key, Secret Key, and default region (e.g.,us-east-1). - Basic Knowledge: Familiarity with basic database concepts (rows, columns, key-value stores).
Learning Objectives
By completing this lab, you will be able to:
- Provision a fully managed NoSQL database using Amazon DynamoDB.
- Provision a managed relational database instance using Amazon RDS.
- Compare the deployment speeds and configuration requirements of relational vs. non-relational services.
- Navigate both the AWS CLI and the AWS Management Console to manage database resources.
Architecture Overview
In this lab, you will act as a Cloud Practitioner deploying two different database models to support a hypothetical application.
Database Selection Decision Tree
The following flowchart illustrates the decision-making process for choosing an AWS database service, based on the requirements discussed in the CLF-C02 curriculum:
Step-by-Step Instructions
Step 1: Create a DynamoDB Table
Amazon DynamoDB is a fast, flexible NoSQL database service. Because it is serverless, provisioning a table takes only seconds. We will create a table to store user profiles.
aws dynamodb create-table \
--table-name brainybee-lab-users \
--attribute-definitions AttributeName=UserId,AttributeType=S \
--key-schema AttributeName=UserId,KeyType=HASH \
--provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 \
--region us-east-1[!TIP] In the CLI command above,
AttributeType=Sdenotes that theUserIdpartition key is a String.
📸 Screenshot: You should see a JSON output showing the
TableStatusasCREATINGorACTIVE.
▶🖥️ Console alternative
- Log in to the AWS Management Console.
- Search for and navigate to DynamoDB.
- Click Create table.
- Enter Table name:
brainybee-lab-users. - Enter Partition key:
UserId(Leave type as String). - Leave default settings and click Create table.
Step 2: Insert Data into DynamoDB
Unlike relational databases, DynamoDB does not require you to define all columns before adding data. You can insert varied attributes on the fly.
aws dynamodb put-item \
--table-name brainybee-lab-users \
--item '{"UserId": {"S": "user_001"}, "Name": {"S": "Ada Lovelace"}, "Role": {"S": "Cloud Engineer"}}' \
--region us-east-1▶🖥️ Console alternative
- In the DynamoDB console, click on Explore items in the left sidebar.
- Select the
brainybee-lab-userstable. - Click Create item.
- Add the
UserIdvalue asuser_001. - Click Add new attribute -> String to add
NameandRole. - Click Create item.
Step 3: Provision an Amazon RDS Instance
Amazon RDS allows you to launch relational databases (like MySQL, PostgreSQL, or SQL Server) without worrying about hardware provisioning or OS patching. We will launch a small MySQL database.
Note: RDS instances take several minutes to provision because AWS is deploying a managed compute instance in the background.
aws rds create-db-instance \
--db-instance-identifier brainybee-lab-db \
--db-instance-class db.t3.micro \
--engine mysql \
--master-username admin \
--master-user-password LabPassword123! \
--allocated-storage 20 \
--no-multi-az \
--region us-east-1[!IMPORTANT] We are using
--no-multi-azto keep costs low and provisioning fast. In a production environment, you would enable Multi-AZ for high availability and synchronous replication to a standby instance in a different Availability Zone.
📸 Screenshot: Look for the
DBInstanceStatusfield in the CLI output. It will initially saycreating.
▶🖥️ Console alternative
- Navigate to RDS in the AWS Management Console.
- Click Create database.
- Choose Standard create and select the MySQL engine.
- Under Templates, choose Free tier.
- Enter DB instance identifier:
brainybee-lab-db. - Enter Master username
adminand passwordLabPassword123!. - Leave instance configuration as
db.t3.micro. - Click Create database at the bottom.
Checkpoints
Verify that your resources have been successfully provisioned.
Checkpoint 1: Verify DynamoDB Table Check if your DynamoDB table is active and contains the item you added.
aws dynamodb scan --table-name brainybee-lab-users --region us-east-1Expected Result: A JSON response showing Count: 1 and the item details for Ada Lovelace.
Checkpoint 2: Verify RDS Instance Status Check if your RDS instance has finished creating. (This may take 5-10 minutes).
aws rds describe-db-instances \
--db-instance-identifier brainybee-lab-db \
--query 'DBInstances[*].[DBInstanceStatus,Endpoint.Address]' \
--region us-east-1Expected Result: The status should eventually transition from creating to available, and an endpoint address will be populated.
Clean-Up / Teardown
[!WARNING] Cost Warning: Remember to run the teardown commands to avoid ongoing charges. RDS instances incur hourly charges if left running outside of the Free Tier. DynamoDB charges for provisioned capacity.
Execute the following commands to delete the resources created in this lab:
1. Delete the DynamoDB Table
aws dynamodb delete-table \
--table-name brainybee-lab-users \
--region us-east-12. Delete the RDS Instance
To delete the database without creating a final backup snapshot, use the --skip-final-snapshot flag.
aws rds delete-db-instance \
--db-instance-identifier brainybee-lab-db \
--skip-final-snapshot \
--region us-east-1Verify deletion by checking the AWS Console. The RDS instance status will change to deleting before it disappears.
Troubleshooting
| Common Error | Likely Cause | Solution |
|---|---|---|
AccessDeniedException | The IAM user configuring the CLI lacks sufficient permissions. | Ensure your IAM user has AmazonDynamoDBFullAccess and AmazonRDSFullAccess (or Administrator access). |
InvalidParameterValue (RDS) | The provided RDS password does not meet complexity requirements. | Ensure the password is at least 8 characters long and contains letters and numbers (e.g., LabPassword123!). |
ResourceNotFoundException (DynamoDB) | Table creation is still pending, or you specified the wrong region. | Wait 10 seconds and try again, or ensure --region us-east-1 is appended to your command. |
VPCIdNotSpecified (RDS) | Your account might lack a default VPC in the specified region. | Use the AWS Management console to create the RDS instance, which allows you to easily select an existing VPC. |
Concept Review
Before you finish, review how these two services align with the AWS Certified Cloud Practitioner requirements:
| Feature | Amazon RDS (Relational) | Amazon DynamoDB (Non-Relational) |
|---|---|---|
| Data Structure | Tables with strict columns and rows (Schemas) | Collections of key-value pairs or documents (Schemaless) |
| Use Case | Complex transactions, ERP, CRM, legacy applications | High-traffic web apps, gaming, IoT, real-time bidding |
| Management | Fully managed underlying OS, but requires choosing instance types (Compute) | Fully managed and serverless; scale based on read/write units |
| High Availability | Achieved by provisioning a Multi-AZ standby instance | Natively distributed and replicated across 3 AZs by default |
Excellent work! You have successfully deployed and torn down core AWS database services using both the CLI and Console methodologies.