Profile Applicability:
- Level 1
Description:
Fine-Grained Access Control (FGAC) restricts access to individual items or attributes within database tables using IAM policy conditions such as dynamodb:LeadingKeys or dynamodb:Attributes. This allows different users or applications to access only the data they are authorized to see.
Rationale:
FGAC enforces the principle of least privilege at the data level, reducing the risk of unauthorized data exposure. It’s especially critical for multi-tenant applications or sensitive datasets where row-level or attribute-level isolation is required.
Impact:
Pros:
Provides granular security controls
Enables tenant or user-specific data access
Reduces lateral access in shared tables
Cons:
Increases complexity in policy authoring and testing
Misconfigured conditions may unintentionally block or allow access
Default Value:
IAM access to DynamoDB and Timestream tables is not fine-grained by default. Policies must be explicitly created with condition elements.
Pre-requisites:
An existing DynamoDB or Timestream database
IAM permissions to create and attach custom policies
Understanding of dynamodb:LeadingKeys, dynamodb:Attributes, or similar IAM conditions
Remediation:
Test Plan
Using AWS Console:
Sign in to the AWS Console
Navigate to IAM > Policies
Review policies attached to roles accessing DynamoDB or Timestream
Confirm the use of condition keys like dynamodb:LeadingKeys or dynamodb:Attributes
Verify that access is scoped to specific items or attributes
Using AWS CLI:
List attached role policies:
aws iam list-attached-role-policies --role-name <role-name>
Retrieve the policy document:
aws iam get-policy-version --policy-arn <policy-arn> --version-id <version-id>
Verify presence of condition blocks like:
"Condition": { "ForAllValues:StringEquals": { "dynamodb:LeadingKeys": ["${aws:username}"] } }
Implementation Plan
Using AWS Console:
Navigate to IAM > Policies > Create Policy
Select JSON tab
Define a policy using dynamodb:LeadingKeys or dynamodb:Attributes
Name the policy (e.g., DynamoDBFineGrainedPolicy)
Go to Roles > YourRole > Attach policies
Attach the newly created fine-grained policy
Using AWS CLI:
Create the policy:
aws iam create-policy --policy-name DynamoDBFineGrainedPolicy --policy-document file://fine_grained_policy.json
Attach the policy to a role:
aws iam attach-role-policy --role-name <role-name> --policy-arn arn:aws:iam::<account-id>:policy/DynamoDBFineGrainedPolicy
Backout Plan
Using AWS Console:
Go to IAM > Roles > YourRole
Click Permissions > Detach policies
Uncheck DynamoDBFineGrainedPolicy and click Remove
Navigate to IAM > Policies, select and delete the policy
Using AWS CLI:
Detach the policy:
aws iam detach-role-policy --role-name <role-name> --policy-arn arn:aws:iam::<account-id>:policy/DynamoDBFineGrainedPolicy
Delete the policy:
aws iam delete-policy --policy-arn arn:aws:iam::<account-id>:policy/DynamoDBFineGrainedPolicy
References: