Fine-grained Access Control with DynamoDB
📖 Scenario: You are building a simple employee database for a company. Each employee record contains sensitive information like salary and department. You want to control who can see the salary based on their role.
🎯 Goal: Create a DynamoDB table with employee data, add a role-based access control configuration, write a query that only returns salary if the user role is 'manager', and finalize the policy to enforce this fine-grained access control.
📋 What You'll Learn
Create a DynamoDB table called
Employees with EmployeeID as the primary key and attributes Name, Department, and Salary.Add a variable called
user_role to represent the current user's role.Write a query that retrieves
EmployeeID, Name, and Department for all employees, and includes Salary only if user_role is 'manager'.Add a condition expression or policy statement that enforces this fine-grained access control.
💡 Why This Matters
🌍 Real World
Companies often need to protect sensitive employee data and allow only authorized roles to see certain information like salaries.
💼 Career
Understanding fine-grained access control is essential for database administrators and backend developers to secure data properly.
Progress0 / 4 steps