Menu
Amazon Relational Database Service
User Guide (API Version 2014-10-31)

Logging Amazon RDS API Calls with AWS CloudTrail

Amazon RDS is integrated with AWS CloudTrail, a service that provides a record of actions taken by a user, role, or an AWS service in Amazon RDS. CloudTrail captures all API calls for Amazon RDS as events, including calls from the Amazon RDS console and from code calls to the Amazon RDS APIs. If you create a trail, you can enable continuous delivery of CloudTrail events to an Amazon S3 bucket, including events for Amazon RDS. If you don't configure a trail, you can still view the most recent events in the CloudTrail console in Event history. Using the information collected by CloudTrail, you can determine the request that was made to Amazon RDS, the IP address from which the request was made, who made the request, when it was made, and additional details.

To learn more about CloudTrail, see the AWS CloudTrail User Guide.

Amazon RDS Information in CloudTrail

CloudTrail is enabled on your AWS account when you create the account. When activity occurs in Amazon RDS, that activity is recorded in a CloudTrail event along with other AWS service events in Event history. You can view, search, and download recent events in your AWS account. For more information, see Viewing Events with CloudTrail Event History.

For an ongoing record of events in your AWS account, including events for Amazon RDS, create a trail. A trail enables CloudTrail to deliver log files to an Amazon S3 bucket. By default, when you create a trail in the console, the trail applies to all regions. The trail logs events from all regions in the AWS partition and delivers the log files to the Amazon S3 bucket that you specify. Additionally, you can configure other AWS services to further analyze and act upon the event data collected in CloudTrail logs. For more information, see:

All Amazon RDS actions are logged by CloudTrail and are documented in the Amazon RDS API Reference. For example, calls to the CreateDBInstance, ModifyDBCluster and CreateDBSnapshot actions generate entries in the CloudTrail log files.

Every event or log entry contains information about who generated the request. The identity information helps you determine the following:

  • Whether the request was made with root or IAM user credentials.

  • Whether the request was made with temporary security credentials for a role or federated user.

  • Whether the request was made by another AWS service.

For more information, see the CloudTrail userIdentity Element.

Understanding Amazon RDS Log File Entries

A trail is a configuration that enables delivery of events as log files to an Amazon S3 bucket that you specify. CloudTrail log files contain one or more log entries. An event represents a single request from any source and includes information about the requested action, the date and time of the action, request parameters, and so on. CloudTrail log files are not an ordered stack trace of the public API calls, so they do not appear in any specific order.

The following example shows a CloudTrail log entry that demonstrates the CreateDBInstance action.

{ "eventVersion": "1.04", "userIdentity": { "type": "IAMUser", "principalId": "AKIAIOSFODNN7EXAMPLE", "arn": "arn:aws:iam::123456789012:user/johndoe", "accountId": "123456789012", "accessKeyId": "AKIAI44QH8DHBEXAMPLE", "userName": "johndoe" }, "eventTime": "2018-07-30T22:14:06Z", "eventSource": "rds.amazonaws.com", "eventName": "CreateDBInstance", "awsRegion": "us-east-1", "sourceIPAddress": "72.21.198.65", "userAgent": "aws-cli/1.15.42 Python/3.6.1 Darwin/17.7.0 botocore/1.10.42", "requestParameters": { "enableCloudwatchLogsExports": [ "audit", "error", "general", "slowquery" ], "dBInstanceIdentifier": "test-instance", "engine": "mysql", "masterUsername": "myawsuser", "allocatedStorage": 20, "dBInstanceClass": "db.m1.small", "masterUserPassword": "****" }, "responseElements": { "dBInstanceArn": "arn:aws:rds:us-east-1:123456789012:db:test-instance", "storageEncrypted": false, "preferredBackupWindow": "10:27-10:57", "preferredMaintenanceWindow": "sat:05:47-sat:06:17", "backupRetentionPeriod": 1, "allocatedStorage": 20, "storageType": "standard", "engineVersion": "5.6.39", "dbInstancePort": 0, "optionGroupMemberships": [ { "status": "in-sync", "optionGroupName": "default:mysql-5-6" } ], "dBParameterGroups": [ { "dBParameterGroupName": "default.mysql5.6", "parameterApplyStatus": "in-sync" } ], "monitoringInterval": 0, "dBInstanceClass": "db.m1.small", "readReplicaDBInstanceIdentifiers": [], "dBSubnetGroup": { "dBSubnetGroupName": "default", "dBSubnetGroupDescription": "default", "subnets": [ { "subnetAvailabilityZone": {"name": "us-east-1b"}, "subnetIdentifier": "subnet-cbfff283", "subnetStatus": "Active" }, { "subnetAvailabilityZone": {"name": "us-east-1e"}, "subnetIdentifier": "subnet-d7c825e8", "subnetStatus": "Active" }, { "subnetAvailabilityZone": {"name": "us-east-1f"}, "subnetIdentifier": "subnet-6746046b", "subnetStatus": "Active" }, { "subnetAvailabilityZone": {"name": "us-east-1c"}, "subnetIdentifier": "subnet-bac383e0", "subnetStatus": "Active" }, { "subnetAvailabilityZone": {"name": "us-east-1d"}, "subnetIdentifier": "subnet-42599426", "subnetStatus": "Active" }, { "subnetAvailabilityZone": {"name": "us-east-1a"}, "subnetIdentifier": "subnet-da327bf6", "subnetStatus": "Active" } ], "vpcId": "vpc-136a4c6a", "subnetGroupStatus": "Complete" }, "masterUsername": "myawsuser", "multiAZ": false, "autoMinorVersionUpgrade": true, "engine": "mysql", "cACertificateIdentifier": "rds-ca-2015", "dbiResourceId": "db-ETDZIIXHEWY5N7GXVC4SH7H5IA", "dBSecurityGroups": [], "pendingModifiedValues": { "masterUserPassword": "****", "pendingCloudwatchLogsExports": { "logTypesToEnable": [ "audit", "error", "general", "slowquery" ] } }, "dBInstanceStatus": "creating", "publiclyAccessible": true, "domainMemberships": [], "copyTagsToSnapshot": false, "dBInstanceIdentifier": "test-instance", "licenseModel": "general-public-license", "iAMDatabaseAuthenticationEnabled": false, "performanceInsightsEnabled": false, "vpcSecurityGroups": [ { "status": "active", "vpcSecurityGroupId": "sg-f839b688" } ] }, "requestID": "daf2e3f5-96a3-4df7-a026-863f96db793e", "eventID": "797163d3-5726-441d-80a7-6eeb7464acd4", "eventType": "AwsApiCall", "recipientAccountId": "123456789012" }