Profile Applicability:
- Level 1
Description:
AWS Identity and Access Management (IAM) should be used to control access to AWS-managed database services, such as DynamoDB. IAM enables you to create and manage users, groups, and roles and to assign fine-grained permissions to securely access resources.
Rationale:
IAM allows you to enforce the principle of least privilege and protect sensitive resources by restricting access based on identity and role. Without IAM, access to database resources may be overly permissive, increasing the risk of unauthorized data access or modification.
Impact:
Pros:
Enables fine-grained access control to database resources
Prevents unauthorized data access or modification
Helps achieve compliance and audit requirements
Cons:
Requires configuration and periodic review
Misconfigured policies can inadvertently restrict legitimate access
Default Value:
IAM permissions must be explicitly created and applied. By default, no access is granted.
Pre-requisites:
IAM permissions to create and manage users, roles, and policies
Knowledge of required access patterns and database resources
Remediation:
Test Plan
Using AWS Console:
Sign in to the AWS Console
Navigate to IAM > Users, Roles, or Policies
Identify users or roles associated with database services (e.g., DynamoDB)
Verify that IAM policies are in place and grant only necessary permissions
Ensure the policies are scoped to specific actions and resources (e.g., table-level access)
Using AWS CLI:
List attached policies for a specific user:
aws iam list-attached-user-policies --user-name <user-name>
Retrieve a specific policy document:
aws iam get-policy-version --policy-arn <policy-arn> --version-id <version-id>
List roles with attached policies:
aws iam list-roles
Review inline policies for a role:
aws iam list-role-policies --role-name <role-name>
Implementation Plan
Using AWS Console:
Sign in to the AWS Console
Navigate to IAM > Policies > Create Policy
Choose Service as DynamoDB
Select specific Actions such as GetItem, PutItem, Scan, etc.
Choose Resources and specify the database table(s)
Click Next, name the policy, and create it
Go to Users or Roles, select the appropriate identity
Click Add permissions > Attach policies directly
Attach the newly created policy
Using AWS CLI:
Create a policy file Create the IAM policy:
aws iam create-policy --policy-name DynamoDBAccessPolicy --policy-document file://dynamodb-access-policy.json
Attach the policy to a user:
aws iam attach-user-policy --user-name <user-name> --policy-arn arn:aws:iam::<account-id>:policy/DynamoDBAccessPolicy
Or attach to a role:
aws iam attach-role-policy --role-name <role-name> --policy-arn arn:aws:iam::<account-id>:policy/DynamoDBAccessPolicy
Backout Plan
Using AWS Console:
Navigate to IAM > Users or Roles
Select the identity from which the policy should be removed
Click Permissions > Detach policies
Uncheck the policy and click Remove
Using AWS CLI:
Detach the policy from a user:
aws iam detach-user-policy --user-name <user-name> --policy-arn arn:aws:iam::<account-id>:policy/DynamoDBAccessPolicy
Detach the policy from a role:
aws iam detach-role-policy --role-name <role-name> --policy-arn arn:aws:iam::<account-id>:policy/DynamoDBAccessPolicy
Optionally delete the policy:
aws iam delete-policy --policy-arn arn:aws:iam::<account-id>:policy/DynamoDBAccessPolicy
References: