Profile Applicability:
- Level 1
Description:
Access control and authentication mechanisms ensure that only authorized users or services can access AWS-managed database services. This can be enforced using IAM-based policies or database-native credentials depending on the service.
Rationale:
Strong access control and authentication reduce the risk of unauthorized access and data exposure. Implementing least privilege access and using identity-aware authentication enforces secure database interaction patterns.
Impact:
Pros:
Reduces unauthorized access risk
Provides granular access management
Supports audit and compliance needs
Cons:
Misconfigured policies may block legitimate access
Requires regular review and maintenance of IAM roles and permissions
Default Value:
Most database services do not enforce access control or IAM authentication by default unless explicitly enabled.
Pre-requisites:
IAM access to create/modify roles and policies
Database engine that supports IAM or native authentication
Knowledge of user roles and responsibilities
Remediation:
Test Plan
Using AWS Console:
Sign in to the AWS Console
Navigate to the target database service (e.g., Amazon RDS, DocumentDB)
Select the database instance or cluster
Go to the Connectivity & security or Configuration tab
Verify whether IAM authentication or database login user management is enabled
Using AWS CLI:
Describe the DB instance and check IAM authentication status:
aws rds describe-db-instances --db-instance-identifier <your-db-instance-id> --query "DBInstances[*].IAMDatabaseAuthenticationEnabled"
List attached IAM policies for a user:
aws iam list-attached-user-policies --user-name <user-name>
List DB users for Aurora/MySQL (if connected):
SELECT user, host FROM mysql.user;
Implementation Plan
Using AWS Console:
Sign in to the AWS Console
Navigate to Amazon RDS > Databases
Select the target DB instance and click Modify
Under Database authentication, enable IAM DB authentication
Apply the changes and reboot the instance if required
Go to IAM > Policies, create a policy allowing rds-db:connect on the DB resource
Attach the policy to the intended IAM user or role
Use the RDS Auth Token to connect securely
Using AWS CLI:
Enable IAM authentication on a DB instance:
aws rds modify-db-instance --db-instance-identifier <your-db-instance-id> --enable-iam-database-authentication --apply-immediately
Create a new IAM policy for database access:
aws iam create-policy --policy-name AllowRDSAccess --policy-document file://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/AllowRDSAccess
(Optional) Generate an RDS Auth token to connect:
aws rds generate-db-auth-token --hostname <db-endpoint> --port 3306 --username <db-user>
Backout Plan
Using AWS Console:
Sign in to the AWS Console
Navigate to the RDS instance and click Modify
Disable IAM database authentication
Click Continue, then Apply Immediately
Detach IAM policies from users or roles as needed
Using AWS CLI:
Disable IAM DB authentication:
aws rds modify-db-instance --db-instance-identifier <your-db-instance-id> --no-enable-iam-database-authentication --apply-immediately
Detach the policy from the user:
aws iam detach-user-policy --user-name <user-name> --policy-arn arn:aws:iam::<account-id>:policy/AllowRDSAccess
(Optional) Delete the IAM policy:
aws iam delete-policy --policy-arn arn:aws:iam::<account-id>:policy/AllowRDSAccess
References: