Logging AWS Backup API Calls with AWS CloudTrail - AWS Backup

Logging AWS Backup API Calls with AWS CloudTrail

AWS Backup is integrated with AWS CloudTrail, a service that provides a record of actions taken by a user, role, or an AWS service in AWS Backup. CloudTrail captures all API calls for AWS Backup as events. The calls captured include calls from the AWS Backup console and code calls to the AWS Backup API operations. If you create a trail, you can enable continuous delivery of CloudTrail events to an Amazon S3 bucket, including events for AWS Backup. 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 AWS Backup, 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.

AWS Backup Information in CloudTrail

CloudTrail is enabled on your AWS account when you create the account. When activity occurs in AWS Backup, 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 AWS Backup, 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 AWS 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 the following:

All AWS Backup actions are logged by CloudTrail and are documented in AWS Backup API Actions.

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 AWS Identity and Access Management (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 AWS Backup 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 aren't an ordered stack trace of the public API calls, so they don't appear in any specific order.

The following example shows a CloudTrail log entry that demonstrates the StartBackupJob, StartRestoreJob, and DeleteRecoveryPoint actions and also the BackupJobCompleted event.

{ "eventVersion": "1.05", "userIdentity": { "type": "Root", "principalId": "123456789012", "arn": "arn:aws:iam::123456789012:root", "accountId": "123456789012", "accessKeyId": AKIAIOSFODNN7EXAMPLE, "sessionContext": { "attributes": { "mfaAuthenticated": "false", "creationDate": "2019-01-10T12:24:50Z" } } }, "eventTime": "2019-01-10T13:45:24Z", "eventSource": "backup.amazonaws.com", "eventName": "StartBackupJob", "awsRegion": "us-east-1", "sourceIPAddress": "12.34.567.89", "userAgent": "aws-internal/3 aws-sdk-java/1.11.465 Linux/4.9.124-0.1.ac.198.73.329.metal1.x86_64 OpenJDK_64-Bit_Server_VM/25.192-b12 java/1.8.0_192", "requestParameters": { "backupVaultName": "Default", "resourceArn": "arn:aws:ec2:us-east-1:123456789012:volume/vol-00a422a05b9c6asd3", "iamRoleArn": "arn:aws:iam::123456789012:role/AWSBackup", "startWindowMinutes": 60 }, "responseElements": { "backupJobId": "8a3c2a87-b23e-4d56-b045-fa9e88ede4e6", "creationDate": "Jan 10, 2019 1:45:24 PM" }, "requestID": "98cf4d59-8c76-49f7-9201-790743931234", "eventID": "fe8146a5-7812-4a95-90ad-074498be1234", "eventType": "AwsApiCall", "recipientAccountId": "123456789012" } , { "eventVersion": "1.05", "userIdentity": { "type": "Root", "principalId": "123456789012", "arn": "arn:aws:iam::123456789012:root", "accountId": "123456789012", "accessKeyId": "ASIAQLTPYK3BWHVZP45U", "sessionContext": { "attributes": { "mfaAuthenticated": "false", "creationDate": "2019-01-10T12:24:50Z" } } }, "eventTime": "2019-01-10T13:49:50Z", "eventSource": "backup.amazonaws.com", "eventName": "StartRestoreJob", "awsRegion": "us-east-1", "sourceIPAddress": "12.34.567.89", "userAgent": "aws-internal/3 aws-sdk-java/1.11.465 Linux/4.9.124-0.1.ac.198.73.329.metal1.x86_64 OpenJDK_64-Bit_Server_VM/25.192-b12 java/1.8.0_192", "requestParameters": { "recoveryPointArn": "arn:aws:ec2:us-east-1::snapshot/snap-00a129455bdbc9d99", "metadata": { "volumeType": "gp2", "availabilityZone": "us-east-1b", "volumeSize": "100" }, "iamRoleArn": "arn:aws:iam::123456789012:role/AWSBackup", "idempotencyToken": "a9c8b4fb-d369-4a58-944b-942e442a8fe3", "resourceType": "EBS" }, "responseElements": { "restoreJobId": "9808E090-8C76-CCB8-4CEA-407CF6AC4C43" }, "requestID": "783ddddc-6d7e-4539-8fab-376aa9668543", "eventID": "ff35ddea-7577-4aec-a132-964b7e9dd423", "eventType": "AwsApiCall", "recipientAccountId": "123456789012" } , { "eventVersion": "1.05", "userIdentity": { "type": "Root", "principalId": "123456789012", "arn": "arn:aws:iam::123456789012:root", "accountId": "123456789012", "accessKeyId": "ASIAQLTPYK3BWHVZP45U", "sessionContext": { "attributes": { "mfaAuthenticated": "false", "creationDate": "2019-01-10T12:24:50Z" } } }, "eventTime": "2019-01-10T14:52:42Z", "eventSource": "backup.amazonaws.com", "eventName": "DeleteRecoveryPoint", "awsRegion": "us-east-1", "sourceIPAddress": "12.34.567.89", "userAgent": "aws-internal/3 aws-sdk-java/1.11.465 Linux/4.9.124-0.1.ac.198.73.329.metal1.x86_64 OpenJDK_64-Bit_Server_VM/25.192-b12 java/1.8.0_192", "requestParameters": { "backupVaultName": "Default", "recoveryPointArn": "arn:aws:ec2:us-east-1::snapshot/snap-05f426fd9daab3433" }, "responseElements": null, "requestID": "f1f1b33a-48da-436c-9a8f-7574f1ab5fd7", "eventID": "2dd70080-5aba-4a79-9a0f-92647c9f0846", "eventType": "AwsApiCall", "recipientAccountId": "123456789012" } , { "eventVersion": "1.05", "userIdentity": { "accountId": "123456789012", "invokedBy": "backup.amazonaws.com" }, "eventTime": "2019-01-10T08:24:39Z", "eventSource": "backup.amazonaws.com", "eventName": "BackupJobCompleted", "awsRegion": "us-east-1", "sourceIPAddress": "backup.amazonaws.com", "userAgent": "backup.amazonaws.com", "requestParameters": null, "responseElements": null, "eventID": "2e7e4fcf-0c52-467f-9fd0-f61c2fcf7d17", "eventType": "AwsServiceEvent", "recipientAccountId": "123456789012", "serviceEventDetails": { "completionDate": { "seconds": 1547108091, "nanos": 906000000 }, "state": "COMPLETED", "percentDone": 100, "backupJobId": "8A8E738B-A8C5-E058-8224-90FA323A3C0E", "backupVaultName": "BackupVault", "backupVaultArn": "arn:aws:backup:us-east-1:123456789012:backup-vault:BackupVault", "recoveryPointArn": "arn:aws:ec2:us-east-1::snapshot/snap-07ce8c3141d361233", "resourceArn": "arn:aws:ec2:us-east-1:123456789012:volume/vol-06692095a6a421233", "creationDate": { "seconds": 1547101638, "nanos": 272000000 }, "backupSizeInBytes": 8589934592, "iamRoleArn": "arn:aws:iam::123456789012:role/AWSBackup", "resourceType": "EBS" } }