AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Creates a configuration for DNS query logging. After you create a query logging configuration, Amazon Route 53 begins to publish log data to an Amazon CloudWatch Logs log group.

DNS query logs contain information about the queries that Amazon Route 53 receives for a specified public hosted zone, such as the following:

Log Group and Resource Policy

Before you create a query logging configuration, perform the following operations.

If you create a query logging configuration using the Amazon Route 53 console, Amazon Route 53 performs these operations automatically.

  1. Create a CloudWatch Logs log group, and make note of the ARN, which you specify when you create a query logging configuration. Note the following:

    • You must create the log group in the us-east-1 region.

    • You must use the same AWS account to create the log group and the hosted zone that you want to configure query logging for.

    • When you create log groups for query logging, we recommend that you use a consistent prefix, for example:

      /aws/route53/hosted zone name

      In the next step, you'll create a resource policy, which controls access to one or more log groups and the associated AWS resources, such as Amazon Route 53 hosted zones. There's a limit on the number of resource policies that you can create, so we recommend that you use a consistent prefix so you can use the same resource policy for all the log groups that you create for query logging.

  2. Create a CloudWatch Logs resource policy, and give it the permissions that Amazon Route 53 needs to create log streams and to send query logs to log streams. For the value of Resource, specify the ARN for the log group that you created in the previous step. To use the same resource policy for all the CloudWatch Logs log groups that you created for query logging configurations, replace the hosted zone name with *, for example:


    You can't use the CloudWatch console to create or edit a resource policy. You must use the CloudWatch API, one of the AWS SDKs, or the AWS CLI.

Log Streams and Edge Locations

When Amazon Route 53 finishes creating the configuration for DNS query logging, it does the following:

  • Creates a log stream for an edge location the first time that the edge location responds to DNS queries for the specified hosted zone. That log stream is used to log all queries that Amazon Route 53 responds to for that edge location.

  • Begins to send query logs to the applicable log stream.

The name of each log stream is in the following format:

hosted zone ID/edge location code

The edge location code is a three-letter code and an arbitrarily assigned number, for example, DFW3. The three-letter code typically corresponds with the International Air Transport Association airport code for an airport near the edge location. (These abbreviations might change in the future.) For a list of edge locations, see "The Amazon Route 53 Global Network" on the Amazon Route 53 Product Details page.

Queries That Are Logged

Query logs contain only the queries that DNS resolvers forward to Amazon Route 53. If a DNS resolver has already cached the response to a query (such as the IP address for a load balancer for, the resolver will continue to return the cached response. It doesn't forward another query to Amazon Route 53 until the TTL for the corresponding resource record set expires. Depending on how many DNS queries are submitted for a resource record set, and depending on the TTL for that resource record set, query logs might contain information about only one query out of every several thousand queries that are submitted to DNS. For more information about how DNS works, see Routing Internet Traffic to Your Website or Web Application in the Amazon Route 53 Developer Guide.

Log File Format

For a list of the values in each query log and the format of each value, see Logging DNS Queries in the Amazon Route 53 Developer Guide.


For information about charges for query logs, see Amazon CloudWatch Pricing.

How to Stop Logging

If you want Amazon Route 53 to stop sending query logs to CloudWatch Logs, delete the query logging configuration. For more information, see DeleteQueryLoggingConfig.


For .NET Core and PCL this operation is only available in asynchronous form. Please refer to CreateQueryLoggingConfigAsync.

Namespace: Amazon.Route53
Assembly: AWSSDK.Route53.dll
Version: 3.x.y.z


public virtual CreateQueryLoggingConfigResponse CreateQueryLoggingConfig(
         CreateQueryLoggingConfigRequest request
Type: Amazon.Route53.Model.CreateQueryLoggingConfigRequest

Container for the necessary parameters to execute the CreateQueryLoggingConfig service method.

Return Value
The response from the CreateQueryLoggingConfig service method, as returned by Route53.


ConcurrentModificationException Another user submitted a request to create, update, or delete the object at the same time that you did. Retry the request.
InsufficientCloudWatchLogsResourcePolicyException Amazon Route 53 doesn't have the permissions required to create log streams and send query logs to log streams. Possible causes include the following: There is no resource policy that specifies the log group ARN in the value for Resource. The resource policy that includes the log group ARN in the value for Resource doesn't have the necessary permissions. The resource policy hasn't finished propagating yet.
InvalidInputException The input is not valid.
NoSuchCloudWatchLogsLogGroupException There is no CloudWatch Logs log group with the specified ARN.
NoSuchHostedZoneException No hosted zone exists with the ID that you specified.
QueryLoggingConfigAlreadyExistsException You can create only one query logging configuration for a hosted zone, and a query logging configuration already exists for this hosted zone.

Version Information

.NET Framework:
Supported in: 4.5, 4.0, 3.5

Portable Class Library:
Supported in: Windows Store Apps
Supported in: Windows Phone 8.1
Supported in: Xamarin Android
Supported in: Xamarin iOS (Unified)
Supported in: Xamarin.Forms

See Also