# RecordSet

A record set.

Extends: Construct › Resource › RecordSet
Implements: IResource, IRecordSet, IEnvironmentAware, IRecordSetRef, IConstruct, IDependable
Superclass of: ARecord, AaaaRecord, CaaAmazonRecord, CaaRecord, CnameRecord, DsRecord, HttpsRecord, MxRecord, NsRecord, SrvRecord, SvcbRecord, TxtRecord, ZoneDelegationRecord

- CloudFormation: [`AWS::Route53::RecordSet`](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-route53-recordset.html)
- L1 type: [`CfnRecordSet`](/cdk/api/v2/docs/aws-cdk-lib.aws_route53.CfnRecordSet.html)
- Source: [`aws-route53/lib/record-set.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-route53/lib/record-set.ts#L382)
- Type last changed: v2.234.0 · 8 Jan 2026

## Example

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_route53 as route53 } from 'aws-cdk-lib';

declare const cidrRoutingConfig: route53.CidrRoutingConfig;
declare const geoLocation: route53.GeoLocation;
declare const healthCheck: route53.HealthCheck;
declare const hostedZone: route53.HostedZone;
declare const recordTarget: route53.RecordTarget;
const recordSet = new route53.RecordSet(this, 'MyRecordSet', {
  recordType: route53.RecordType.A,
  target: recordTarget,
  zone: hostedZone,

  // the properties below are optional
  cidrRoutingConfig: cidrRoutingConfig,
  comment: 'comment',
  deleteExisting: false,
  failover: route53.Failover.PRIMARY,
  geoLocation: geoLocation,
  healthCheck: healthCheck,
  multiValueAnswer: false,
  recordName: 'recordName',
  region: 'region',
  setIdentifier: 'setIdentifier',
  ttl: cdk.Duration.minutes(30),
  weight: 123,
});
```

## Initializer

```ts
new RecordSet(scope: Construct, id: string, props: RecordSetProps)
```

## Construct Props

- `cidrRoutingConfig`: [CidrRoutingConfig](/cdk/api/v2/docs/aws-cdk-lib.aws_route53.CidrRoutingConfig.html) — The object that is specified in resource record set object when you are linking a resource record set to a CIDR location.

  **Default:** No CIDR routing configured

  A LocationName with an asterisk “*” can be used to create a default CIDR record. CollectionId is still required for default record.

- `comment`: string — A comment to add on the record.

  **Default:** no comment

- `deleteExisting`: boolean = false — This property is dangerous and can lead to unintended record deletion in case of deployment failure.

  This allows you to deploy a new record set while minimizing the downtime because the
  new record set will be created immediately after the existing one is deleted. It
  also avoids "manual" actions to delete existing record sets.

  > **N.B.:** this feature is dangerous, use with caution! It can only be used safely when
  > `deleteExisting` is set to `true` as soon as the resource is added to the stack. Changing
  > an existing Record Set's `deleteExisting` property from `false -> true` after deployment
  > will delete the record!

- `failover`: [Failover](/cdk/api/v2/docs/aws-cdk-lib.aws_route53.Failover.html) — Failover configuration for the record set.

  **Default:** No failover configuration

  To configure failover, you add the Failover element to two resource record sets.
  For one resource record set, you specify PRIMARY as the value for Failover;
  for the other resource record set, you specify SECONDARY.

  You must also include the HealthCheckId element for PRIMARY configurations.

- `geoLocation`: [GeoLocation](/cdk/api/v2/docs/aws-cdk-lib.aws_route53.GeoLocation.html) — The geographical origin for this record to return DNS records based on the user's location.

- `healthCheck`: [IHealthCheck](/cdk/api/v2/docs/aws-cdk-lib.aws_route53.IHealthCheck.html) — The health check to associate with the record set.

  **Default:** No health check configured

  Route53 will return this record set in response to DNS queries only if the health check is passing.

- `multiValueAnswer`: boolean = false — Whether to return multiple values, such as IP addresses for your web servers, in response to DNS queries.

- `recordName`: string — The subdomain name for this record. This should be relative to the zone root name.

  **Default:** zone root

  For example, if you want to create a record for acme.example.com, specify
  "acme".

  You can also specify the fully qualified domain name which terminates with a
  ".". For example, "acme.example.com.".

- `recordType`: [RecordType](/cdk/api/v2/docs/aws-cdk-lib.aws_route53.RecordType.html) (required) — The record type.

- `region`: string — The Amazon EC2 Region where you created the resource that this resource record set refers to.

  **Default:** Do not set latency based routing

  The resource typically is an AWS resource, such as an EC2 instance or an ELB load balancer,
  and is referred to by an IP address or a DNS domain name, depending on the record type.

  When Amazon Route 53 receives a DNS query for a domain name and type for which you have created latency resource record sets,
  Route 53 selects the latency resource record set that has the lowest latency between the end user and the associated Amazon EC2 Region.
  Route 53 then returns the value that is associated with the selected resource record set.

- `setIdentifier`: string — A string used to distinguish between different records with the same combination of DNS name and type.

  **Default:** Auto generated string

  It can only be set when either weight or geoLocation is defined.

  This parameter must be between 1 and 128 characters in length.

- `target`: [RecordTarget](/cdk/api/v2/docs/aws-cdk-lib.aws_route53.RecordTarget.html) (required) — The target for this record, either `RecordTarget.fromValues()` or `RecordTarget.fromAlias()`.

- `ttl`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = Duration.minutes(30) — The resource record cache time to live (TTL).

- `weight`: number — Among resource record sets that have the same combination of DNS name and type, a value that determines the proportion of DNS queries that Amazon Route 53 responds to using the current resource record set.

  **Default:** Do not set weighted routing

  Route 53 calculates the sum of the weights for the resource record sets that have the same combination of DNS name and type.
  Route 53 then responds to queries based on the ratio of a resource's weight to the total.

  This value can be a number between 0 and 255.

- `zone`: [IHostedZone](/cdk/api/v2/docs/aws-cdk-lib.aws_route53.IHostedZone.html) (required) — The hosted zone in which to define the new record.

## Properties

- `domainName`: string — The domain name of the record.

- `env`: [ResourceEnvironment](/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html) — The environment this resource belongs to.

  For resources that are created and managed in a Stack (those created by
  creating new class instances like `new Role()`, `new Bucket()`, etc.), this
  is always the same as the environment of the stack they belong to.

  For referenced resources (those obtained from referencing methods like
  `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
  different than the stack they were imported into.

- `node`: [Node](/cdk/api/v2/docs/constructs.Node.html) — The tree node.

- `PROPERTY_INJECTION_ID`: string (static) — Uniquely identifies this class.

- `recordSetRef`: [RecordSetReference](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_route53.RecordSetReference.html) — A reference to a RecordSet resource.

- `stack`: [Stack](/cdk/api/v2/docs/aws-cdk-lib.Stack.html) — The stack in which this resource is defined.

## Methods

- `applyCrossStackReferenceStrength(strength: ReferenceStrength): void` — Override the cross-stack reference strength for this resource.

  When set, any cross-stack reference to this resource will use the specified
  mechanism instead of the global default determined by the
  `@aws-cdk/core:defaultCrossStackReferences` context key. This is useful for
  selectively weakening specific references to avoid the "deadly embrace" problem
  without changing the app-wide default.

  **Parameters**

  - `strength` — - The reference strength to use for this resource.

- `applyRemovalPolicy(policy: RemovalPolicy): void` — Apply the given removal policy to this resource.

  The Removal Policy controls what happens to this resource when it stops
  being managed by CloudFormation, either because you've removed it from the
  CDK application or because you've made a change that requires the resource
  to be replaced.

  The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
  account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).

- `isConstruct(x: any): boolean` (static) — Checks if `x` is a construct.

  Use this method instead of `instanceof` to properly detect `Construct`
  instances, even when the construct library is symlinked.

  Explanation: in JavaScript, multiple copies of the `constructs` library on
  disk are seen as independent, completely different libraries. As a
  consequence, the class `Construct` in each copy of the `constructs` library
  is seen as a different class, and an instance of one class will not test as
  `instanceof` the other class. `npm install` will not create installations
  like this, but users may manually symlink construct libraries together or
  use a monorepo tool: in those cases, multiple copies of the `constructs`
  library can be accidentally installed, and `instanceof` will behave
  unpredictably. It is safest to avoid using `instanceof`, and using
  this type-testing method instead.

  **Parameters**

  - `x` — Any object.

  **Returns:** true if `x` is an object created from a class which extends `Construct`.

- `isOwnedResource(construct: IConstruct): boolean` (static) — Returns true if the construct was created by CDK, and false otherwise.

- `isResource(construct: IConstruct): boolean` (static) — Check whether the given construct is a Resource.

- `toString(): string` — Returns a string representation of this construct.

- `with(...mixins: IMixin[]): IConstruct` — Applies one or more mixins to this construct.

  Mixins are applied in order. The list of constructs is captured at the
  start of the call, so constructs added by a mixin will not be visited.
  Use multiple `with()` calls if subsequent mixins should apply to added
  constructs.
