More Info:
Amazon RDS sends general, slow query, audit and error logs from your MySQL, Aurora and MariaDB databases to AWS CloudWatch Logs. Broadcasting these logs to CloudWatch allows you to maintain continuous visibility into database activity, query performance and errors within your RDS database instances.Risk Level
LowAddress
Operational Maturity, Reliability, SecurityCompliance Standards
HITRUST, SOC2, NISTCSF, PCIDSSTriage and Remediation
Remediation
Using Console
Using Console
To remediate the misconfiguration of log exports not being enabled for an AWS RDS instance, you can follow these steps using the AWS Management Console:
- Login to AWS Console: Go to the AWS Management Console (https://aws.amazon.com/console/) and log in to your account.
- Navigate to RDS Service: Click on the “Services” dropdown menu at the top left corner of the console. Under the “Database” section, click on “RDS” to open the Amazon Relational Database Service dashboard.
- Select the RDS Instance: From the list of RDS instances, select the instance for which you want to enable log exports by clicking on its name.
- Enable Enhanced Monitoring: In the RDS instance dashboard, scroll down to the “Logs & events” section. Click on the “Modify” button.
- Enable Log Exports: In the “Modify DB instance” page, scroll down to the “Monitoring & logging” section. Check the box next to “Enhanced monitoring” to enable it.
- Configure Log Exports: Under the “Enhanced monitoring” section, you can configure the log types that you want to export. Select the log types (e.g., slow query logs, audit logs) that you want to export.
- Save Changes: Scroll down to the bottom of the page and click on the “Continue” button. Review the changes you have made, and click on the “Modify DB instance” button to save the changes.
- Verify Log Exports: Once the changes are saved, AWS will start exporting the selected logs from your RDS instance. You can verify the log exports by checking the log destination you have configured (e.g., CloudWatch Logs).
Using CLI
Using CLI
To remediate the misconfiguration of enabling log exports for AWS RDS using AWS CLI, follow these step-by-step instructions:
-
Enable Enhanced Logging: First, enable Enhanced Logging for your RDS instance. This will allow you to export the logs to CloudWatch Logs.
Replace
YOUR_DB_INSTANCE_IDENTIFIER
with the identifier of your RDS instance,YOUR_CLOUDWATCH_ROLE_ARN
with the ARN of the IAM role that has permission to write logs to CloudWatch Logs, andYOUR_INTERVAL
with the interval at which logs should be sent to CloudWatch Logs. -
Configure Log Exports: Next, configure the log exports for your RDS instance. You can specify which logs you want to export (error, slow query, general logs, etc.).
Replace
YOUR_DB_INSTANCE_IDENTIFIER
with the identifier of your RDS instance. In theEnableLogTypes
array, specify the types of logs you want to export. -
Verify Configuration: You can verify that the log exports are enabled for your RDS instance by describing the instance.
This command will provide detailed information about your RDS instance, including the log export configuration.
Using Python
Using Python
To enable log exports for AWS RDS using Python, you can use the AWS SDK for Python (Boto3). Here are the step-by-step instructions to remediate this misconfiguration:
-
Install Boto3: If you haven’t already installed Boto3, you can install it using pip:
- Configure AWS Credentials: Make sure you have your AWS credentials configured either through environment variables, shared credentials file, or IAM role.
- Use the following Python script to enable log exports for AWS RDS:
-
Replace
'your_rds_instance_identifier'
with the actual identifier of your RDS instance and update thelog_types
list with the specific log types you want to export (e.g., error, general, slowquery). - Run the Python script to enable log exports for the specified RDS instance.