📖 Scenario: You are managing a small online store's customer data using DynamoDB. Protecting this data is very important to keep customers' trust and comply with laws.
🎯 Goal: Build a simple DynamoDB table setup that shows how to store customer data securely and understand why data protection matters.
📋 What You'll Learn
Create a DynamoDB table named Customers with CustomerID as the primary key.
Add a configuration variable encryption_enabled set to True to represent data encryption.
Write a query to get customer data by CustomerID.
Add a final setting to enable point-in-time recovery for data protection.
💡 Why This Matters
🌍 Real World
Protecting customer data in online stores is critical to maintain trust and comply with privacy laws.
💼 Career
Database administrators and developers must know how to configure and protect data in cloud databases like DynamoDB.
Progress0 / 4 steps
1
Create the DynamoDB table
Create a DynamoDB table named Customers with CustomerID as the primary key.
DynamoDB
Hint
Use a dictionary named Customers with keys TableName, KeySchema, and AttributeDefinitions.
2
Add encryption configuration
Add a variable called encryption_enabled and set it to True to represent that data encryption is enabled.
DynamoDB
Hint
Just create a variable encryption_enabled and assign True.
3
Write a query to get customer data
Write a function called get_customer_data that takes customer_id and returns a query dictionary to get the item from Customers table using CustomerID as the key.
DynamoDB
Hint
Define a function that returns a dictionary with TableName and Key using the customer_id parameter.
4
Enable point-in-time recovery
Add a key PointInTimeRecoverySpecification to the Customers dictionary and set its Status to ENABLED to enable point-in-time recovery for data protection.
DynamoDB
Hint
Add the PointInTimeRecoverySpecification key with a nested Status set to ENABLED inside the Customers dictionary.
Practice
(1/5)
1. Why is data protection essential when using DynamoDB?
easy
A. It keeps your data safe and private from unauthorized access.
B. It makes your database run faster.
C. It automatically deletes old data.
D. It increases the size of your database.
Solution
Step 1: Understand the purpose of data protection
Data protection is about keeping data safe and private, preventing unauthorized access.
Step 2: Identify the correct benefit in DynamoDB context
Among the options, only keeping data safe and private matches the purpose of data protection.
Final Answer:
It keeps your data safe and private from unauthorized access. -> Option A
Quick Check:
Data protection = safety and privacy [OK]
Hint: Data protection means keeping data safe and private [OK]
Common Mistakes:
Confusing data protection with performance improvements
Thinking data protection deletes data automatically
Assuming data protection increases database size
2. Which of the following is the correct way to enable encryption at rest in DynamoDB?
easy
A. Set EncryptionEnabled = true in the table creation parameters.
B. Use EnableEncryption = 'yes' in the AWS CLI command.
C. Add EncryptData: true in the item attributes.
D. Specify SSESpecification: { Enabled: true } when creating the table.
Solution
Step 1: Recall DynamoDB encryption syntax
Encryption at rest is enabled by setting SSESpecification: { Enabled: true } during table creation.
Step 2: Check each option for correctness
Only Specify SSESpecification: { Enabled: true } when creating the table. uses the correct syntax recognized by DynamoDB.
Final Answer:
Specify SSESpecification: { Enabled: true } when creating the table. -> Option D
Quick Check:
Encryption at rest = SSESpecification enabled [OK]
Hint: Look for SSESpecification with Enabled true [OK]
Common Mistakes:
Using incorrect parameter names like EncryptionEnabled
Trying to encrypt individual items instead of the table
Using string values instead of boolean true
3. Consider this DynamoDB table with encryption enabled and IAM access control. What happens if a user without permission tries to read data?
medium
A. The request is denied due to lack of permissions.
B. The user can read the data without restrictions.
C. The data is returned but encrypted and unreadable.
D. The table automatically deletes the data.
Solution
Step 1: Understand IAM access control in DynamoDB
IAM policies control who can access the table. Without permission, access is denied.
Step 2: Analyze the options based on access control
Only The request is denied due to lack of permissions. correctly states that unauthorized requests are denied.
Final Answer:
The request is denied due to lack of permissions. -> Option A
Quick Check:
IAM access control denies unauthorized users [OK]
Hint: No permission means access denied, not encrypted data [OK]
Common Mistakes:
Thinking data is returned but unreadable
Assuming unauthorized users can read data
Believing data is deleted automatically
4. You wrote this IAM policy to allow read access to a DynamoDB table but users still get AccessDenied errors. What is the likely problem?