Logging Amazon Route 53 API calls with Amazon CloudTrail - Amazon Route 53
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Logging Amazon Route 53 API calls with Amazon CloudTrail

Route 53 is integrated with Amazon CloudTrail, a service that provides a record of actions taken by a user, role, or an Amazon service in Route 53. CloudTrail captures all API calls for Route 53 as events, including calls from the Route 53 console and from code calls to the Route 53 APIs. If you create a trail, you can enable continuous delivery of CloudTrail events to an Amazon S3 bucket, including events for Route 53. 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 Route 53, the IP address that the request was made from, who made the request, when it was made, and additional details.

Route 53 information in CloudTrail

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

For an ongoing record of events in your Amazon account, including events for Route 53, 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 Amazon partition and delivers the log files to the Amazon S3 bucket that you specify. Additionally, you can configure other Amazon services to further analyze and act upon the event data collected in CloudTrail logs. For more information, see:

All Route 53 actions are logged by CloudTrail and are documented in the Amazon Route 53 API Reference. For example, calls to the CreateHostedZone, CreateHealthCheck, and RegisterDomain 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 Amazon service.

For more information, see the CloudTrail userIdentity element.

Viewing Route 53 events in event history

CloudTrail lets you view recent events in Event history. To view events for Route 53 API requests, you must choose US East (N. Virginia) in the region selector at the top of the console. For more information, see Viewing events with CloudTrail event history in the Amazon CloudTrail User Guide.

Understanding Route 53 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 eventName element identifies the action that occurred. (In CloudTrail logs, the first letter is lowercase for domain registration actions even though it's uppercase in the names of the actions. For example, UpdateDomainContact appears as updateDomainContact in the logs). CloudTrail supports all Route 53 API actions. The following example shows a CloudTrail log entry that demonstrates the following actions:

  • List the hosted zones that are associated with an Amazon account

  • Create a health check

  • Create two records

  • Delete a hosted zone

  • Update information for a registered domain

  • Create a Route 53 Resolver outbound endpoint

{ "Records": [ { "apiVersion": "2013-04-01", "awsRegion": "us-east-1", "eventID": "1cdbea14-e162-43bb-8853-f9f86d4739ca", "eventName": "ListHostedZones", "eventSource": "route53.amazonaws.com", "eventTime": "2015-01-16T00:41:48Z", "eventType": "AwsApiCall", "eventVersion": "1.02", "recipientAccountId": "444455556666", "requestID": "741e0df7-9d18-11e4-b752-f9c6311f3510", "requestParameters": null, "responseElements": null, "sourceIPAddress": "192.0.2.92", "userAgent": "Apache-HttpClient/4.3 (java 1.5)", "userIdentity": { "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "accountId": "111122223333", "arn": "arn:aws:iam::111122223333:user/smithj", "principalId": "A1B2C3D4E5F6G7EXAMPLE", "type": "IAMUser", "userName": "smithj" } }, { "apiVersion": "2013-04-01", "awsRegion": "us-east-1", "eventID": "45ec906a-1325-4f61-b133-3ef1012b0cbc", "eventName": "CreateHealthCheck", "eventSource": "route53.amazonaws.com", "eventTime": "2018-01-16T00:41:57Z", "eventType": "AwsApiCall", "eventVersion": "1.02", "recipientAccountId": "444455556666", "requestID": "79915168-9d18-11e4-b752-f9c6311f3510", "requestParameters": { "callerReference": "2014-05-06 64832", "healthCheckConfig": { "iPAddress": "192.0.2.249", "port": 80, "type": "TCP" } }, "responseElements": { "healthCheck": { "callerReference": "2014-05-06 64847", "healthCheckConfig": { "failureThreshold": 3, "iPAddress": "192.0.2.249", "port": 80, "requestInterval": 30, "type": "TCP" }, "healthCheckVersion": 1, "id": "b3c9cbc6-cd18-43bc-93f8-9e557example" }, "location": "https://route53.amazonaws.com/2013-04-01/healthcheck/b3c9cbc6-cd18-43bc-93f8-9e557example" }, "sourceIPAddress": "192.0.2.92", "userAgent": "Apache-HttpClient/4.3 (java 1.5)", "userIdentity": { "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "accountId": "111122223333", "arn": "arn:aws:iam::111122223333:user/smithj", "principalId": "A1B2C3D4E5F6G7EXAMPLE", "type": "IAMUser", "userName": "smithj" } }, { "additionalEventData": { "Note": "Do not use to reconstruct hosted zone" }, "apiVersion": "2013-04-01", "awsRegion": "us-east-1", "eventID": "883b14d9-2f84-4005-8bc5-c7bf0cebc116", "eventName": "ChangeResourceRecordSets", "eventSource": "route53.amazonaws.com", "eventTime": "2018-01-16T00:41:43Z", "eventType": "AwsApiCall", "eventVersion": "1.02", "recipientAccountId": "444455556666", "requestID": "7081d4c6-9d18-11e4-b752-f9c6311f3510", "requestParameters": { "changeBatch": { "changes": [ { "action": "CREATE", "resourceRecordSet": { "name": "prod.example.com.", "resourceRecords": [ { "value": "192.0.1.1" }, { "value": "192.0.1.2" }, { "value": "192.0.1.3" }, { "value": "192.0.1.4" } ], "tTL": 300, "type": "A" } }, { "action": "CREATE", "resourceRecordSet": { "name": "test.example.com.", "resourceRecords": [ { "value": "192.0.1.1" }, { "value": "192.0.1.2" }, { "value": "192.0.1.3" }, { "value": "192.0.1.4" } ], "tTL": 300, "type": "A" } } ], "comment": "Adding subdomains" }, "hostedZoneId": "Z1PA6795UKMFR9" }, "responseElements": { "changeInfo": { "comment": "Adding subdomains", "id": "/change/C156SRE0X2ZB10", "status": "PENDING", "submittedAt": "Jan 16, 2018 12:41:43 AM" } }, "sourceIPAddress": "192.0.2.92", "userAgent": "Apache-HttpClient/4.3 (java 1.5)", "userIdentity": { "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "accountId": "111122223333", "arn": "arn:aws:iam::111122223333:user/smithj", "principalId": "A1B2C3D4E5F6G7EXAMPLE", "type": "IAMUser", "userName": "smithj" } }, { "apiVersion": "2013-04-01", "awsRegion": "us-east-1", "eventID": "0cb87544-ebee-40a9-9812-e9dda1962cb2", "eventName": "DeleteHostedZone", "eventSource": "route53.amazonaws.com", "eventTime": "2018-01-16T00:41:37Z", "eventType": "AwsApiCall", "eventVersion": "1.02", "recipientAccountId": "444455556666", "requestID": "6d5d149f-9d18-11e4-b752-f9c6311f3510", "requestParameters": { "id": "Z1PA6795UKMFR9" }, "responseElements": { "changeInfo": { "id": "/change/C1SIJYUYIKVJWP", "status": "PENDING", "submittedAt": "Jan 16, 2018 12:41:36 AM" } }, "sourceIPAddress": "192.0.2.92", "userAgent": "Apache-HttpClient/4.3 (java 1.5)", "userIdentity": { "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "accountId": "111122223333", "arn": "arn:aws:iam::111122223333:user/smithj", "principalId": "A1B2C3D4E5F6G7EXAMPLE", "type": "IAMUser", "userName": "smithj" } }, { "eventVersion": "1.05", "userIdentity": { "type": "IAMUser", "principalId": "A1B2C3D4E5F6G7EXAMPLE", "arn": "arn:aws:iam::111122223333:user/smithj", "accountId": "111122223333", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "userName": "smithj", "sessionContext": { "attributes": { "mfaAuthenticated": "false", "creationDate": "2018-11-01T19:43:59Z" } }, "invokedBy": "test" }, "eventTime": "2018-11-01T19:49:36Z", "eventSource": "route53domains.amazonaws.com", "eventName": "updateDomainContact", "awsRegion": "us-west-2", "sourceIPAddress": "192.0.2.92", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Firefox/52.0", "requestParameters": { "domainName": { "name": "example.com" } }, "responseElements": { "requestId": "034e222b-a3d5-4bec-8ff9-35877ff02187" }, "additionalEventData": "Personally-identifying contact information is not logged in the request", "requestID": "015b7313-bf3d-11e7-af12-cf75409087f6", "eventID": "f34f3338-aaf4-446f-bf0e-f72323bac94d", "eventType": "AwsApiCall", "recipientAccountId": "444455556666" }, { "eventVersion": "1.05", "userIdentity": { "type": "IAMUser", "principalId": "A1B2C3D4E5F6G7EXAMPLE", "arn": "arn:aws:iam::111122223333:user/smithj", "accountId": "111122223333", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "attributes": { "mfaAuthenticated": "false", "creationDate": "2018-11-01T14:33:09Z" }, "sessionIssuer": { "type": "Role", "principalId": "AROAIUZEZLWWZOEXAMPLE", "arn": "arn:aws:iam::123456789012:role/Admin", "accountId": "123456789012", "userName": "Admin" } } }, "eventTime": "2018-11-01T14:37:19Z", "eventSource": "route53resolver.amazonaws.com", "eventName": "CreateResolverEndpoint", "awsRegion": "us-west-2", "sourceIPAddress": "192.0.2.176", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Firefox/52.0", "requestParameters": { "creatorRequestId": "123456789012", "name": "OutboundEndpointDemo", "securityGroupIds": [ "sg-05618b249example" ], "direction": "OUTBOUND", "ipAddresses": [ { "subnetId": "subnet-01cb0c4676example" }, { "subnetId": "subnet-0534819b32example" } ], "tags": [] }, "responseElements": { "resolverEndpoint": { "id": "rslvr-out-1f4031f1f5example", "creatorRequestId": "123456789012", "arn": "arn:aws:route53resolver:us-west-2:123456789012:resolver-endpoint/rslvr-out-1f4031f1f5example", "name": "OutboundEndpointDemo", "securityGroupIds": [ "sg-05618b249example" ], "direction": "OUTBOUND", "ipAddressCount": 2, "hostVPCId": "vpc-0de29124example", "status": "CREATING", "statusMessage": "[Trace id: 1-5bd1d51e-f2f3032eb75649f71example] Creating the Resolver Endpoint", "creationTime": "2018-11-01T14:37:19.045Z", "modificationTime": "2018-11-01T14:37:19.045Z" } }, "requestID": "3f066d98-773f-4628-9cba-4ba6eexample", "eventID": "cb05b4f9-9411-4507-813b-33cb0example", "eventType": "AwsApiCall", "recipientAccountId": "123456789012" } ] }