Skip to content
GitHubXDiscord

ResolverQueryLoggingConfigAssociation

The ResolverQueryLoggingConfigAssociation resource allows you to associate a Resolver Query Logging Configuration with a specific resource in AWS Route 53 Resolver. This enables you to log DNS queries to the specified logging configuration. For more details, refer to the AWS Route53Resolver ResolverQueryLoggingConfigAssociations documentation.

Create a basic Resolver Query Logging Config Association by specifying the required properties.

import AWS from "alchemy/aws/control";
const queryLoggingConfigAssociation = await AWS.Route53Resolver.ResolverQueryLoggingConfigAssociation("basicConfigAssociation", {
ResourceId: "vpc-12345678", // VPC ID to associate
ResolverQueryLogConfigId: "rslvr-12345678", // Log configuration ID
adopt: false // Default is false; will fail if the resource already exists
});

Associate a logging configuration with additional properties, including adoption of existing resources.

const advancedConfigAssociation = await AWS.Route53Resolver.ResolverQueryLoggingConfigAssociation("advancedConfigAssociation", {
ResourceId: "vpc-87654321", // Another VPC ID
ResolverQueryLogConfigId: "rslvr-87654321", // Another log configuration ID
adopt: true // Set to true to adopt an existing resource instead of failing
});

Logging Configuration for Multiple Resources

Section titled “Logging Configuration for Multiple Resources”

You can create multiple associations for different resources, ensuring that all necessary components are logged.

const firstAssociation = await AWS.Route53Resolver.ResolverQueryLoggingConfigAssociation("firstAssociation", {
ResourceId: "vpc-11223344",
ResolverQueryLogConfigId: "rslvr-11223344"
});
const secondAssociation = await AWS.Route53Resolver.ResolverQueryLoggingConfigAssociation("secondAssociation", {
ResourceId: "vpc-44332211",
ResolverQueryLogConfigId: "rslvr-44332211",
adopt: true
});

This example demonstrates how to update an existing association, changing the logging configuration while keeping the same resource.

const updatedAssociation = await AWS.Route53Resolver.ResolverQueryLoggingConfigAssociation("updatedAssociation", {
ResourceId: "vpc-12345678",
ResolverQueryLogConfigId: "rslvr-newconfigid-12345678",
adopt: false // Default behavior
});