Class CfnRecordSet

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, IEnvironmentAware, IRecordSetRef, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.133.0 (build 0f43e37)", date="2026-06-04T12:52:20.165Z") @Stability(Stable) public class CfnRecordSet extends CfnResource implements IInspectable, IRecordSetRef
Information about the record that you want to create.

The AWS::Route53::RecordSet type can be used as a standalone resource or as an embedded property in the AWS::Route53::RecordSetGroup type. Note that some AWS::Route53::RecordSet properties are valid only when used within AWS::Route53::RecordSetGroup .

For more information, see ChangeResourceRecordSets in the Amazon Route 53 API Reference .

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.route53.*;
 CfnRecordSet cfnRecordSet = CfnRecordSet.Builder.create(this, "MyCfnRecordSet")
         .name("name")
         .type("type")
         // the properties below are optional
         .aliasTarget(AliasTargetProperty.builder()
                 .dnsName("dnsName")
                 .hostedZoneId("hostedZoneId")
                 // the properties below are optional
                 .evaluateTargetHealth(false)
                 .build())
         .cidrRoutingConfig(CidrRoutingConfigProperty.builder()
                 .collectionId("collectionId")
                 .locationName("locationName")
                 .build())
         .comment("comment")
         .failover("failover")
         .geoLocation(GeoLocationProperty.builder()
                 .continentCode("continentCode")
                 .countryCode("countryCode")
                 .subdivisionCode("subdivisionCode")
                 .build())
         .geoProximityLocation(GeoProximityLocationProperty.builder()
                 .awsRegion("awsRegion")
                 .bias(123)
                 .coordinates(CoordinatesProperty.builder()
                         .latitude("latitude")
                         .longitude("longitude")
                         .build())
                 .localZoneGroup("localZoneGroup")
                 .build())
         .healthCheckId("healthCheckId")
         .hostedZoneId("hostedZoneId")
         .hostedZoneName("hostedZoneName")
         .multiValueAnswer(false)
         .region("region")
         .resourceRecords(List.of("resourceRecords"))
         .setIdentifier("setIdentifier")
         .ttl("ttl")
         .weight(123)
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnRecordSet

      protected CfnRecordSet(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnRecordSet

      protected CfnRecordSet(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnRecordSet

      @Stability(Stable) public CfnRecordSet(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnRecordSetProps props)
      Create a new AWS::Route53::RecordSet.

      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties. This parameter is required.
  • Method Details

    • isCfnRecordSet

      @Stability(Stable) @NotNull public static Boolean isCfnRecordSet(@NotNull Object x)
      Checks whether the given object is a CfnRecordSet.

      Parameters:
      x - This parameter is required.
    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector - tree inspector to collect and process attributes. This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrId

      @Stability(Stable) @NotNull public String getAttrId()
      This element contains an ID that you use when performing a GetChange action to get detailed information about the change.
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getCfnPropertyNames

      @Stability(Stable) @NotNull protected Map<String,String> getCfnPropertyNames()
      Overrides:
      getCfnPropertyNames in class CfnResource
    • getRecordSetRef

      @Stability(Stable) @NotNull public RecordSetReference getRecordSetRef()
      A reference to a RecordSet resource.
      Specified by:
      getRecordSetRef in interface IRecordSetRef
    • getName

      @Stability(Stable) @NotNull public String getName()
      The name of the record that you want to create, update, or delete.
    • setName

      @Stability(Stable) public void setName(@NotNull String value)
      The name of the record that you want to create, update, or delete.
    • getType

      @Stability(Stable) @NotNull public String getType()
      The DNS record type.
    • setType

      @Stability(Stable) public void setType(@NotNull String value)
      The DNS record type.
    • getAliasTarget

      @Stability(Stable) @Nullable public Object getAliasTarget()
      Alias resource record sets only: Information about the AWS resource, such as a CloudFront distribution or an Amazon S3 bucket, that you want to route traffic to.

      Returns union: either IResolvable or CfnRecordSet.AliasTargetProperty

    • setAliasTarget

      @Stability(Stable) public void setAliasTarget(@Nullable IResolvable value)
      Alias resource record sets only: Information about the AWS resource, such as a CloudFront distribution or an Amazon S3 bucket, that you want to route traffic to.
    • setAliasTarget

      @Stability(Stable) public void setAliasTarget(@Nullable CfnRecordSet.AliasTargetProperty value)
      Alias resource record sets only: Information about the AWS resource, such as a CloudFront distribution or an Amazon S3 bucket, that you want to route traffic to.
    • getCidrRoutingConfig

      @Stability(Stable) @Nullable public Object getCidrRoutingConfig()
      The object that is specified in resource record set object when you are linking a resource record set to a CIDR location.

      Returns union: either IResolvable or CfnRecordSet.CidrRoutingConfigProperty

    • setCidrRoutingConfig

      @Stability(Stable) public void setCidrRoutingConfig(@Nullable IResolvable value)
      The object that is specified in resource record set object when you are linking a resource record set to a CIDR location.
    • setCidrRoutingConfig

      @Stability(Stable) public void setCidrRoutingConfig(@Nullable CfnRecordSet.CidrRoutingConfigProperty value)
      The object that is specified in resource record set object when you are linking a resource record set to a CIDR location.
    • getComment

      @Stability(Stable) @Nullable public String getComment()
      Optional: Any comments you want to include about a change batch request.
    • setComment

      @Stability(Stable) public void setComment(@Nullable String value)
      Optional: Any comments you want to include about a change batch request.
    • getFailover

      @Stability(Stable) @Nullable public String getFailover()
      Failover resource record sets only: To configure failover, you add the Failover element to two resource record sets.
    • setFailover

      @Stability(Stable) public void setFailover(@Nullable String value)
      Failover resource record sets only: To configure failover, you add the Failover element to two resource record sets.
    • getGeoLocation

      @Stability(Stable) @Nullable public Object getGeoLocation()
      Geolocation resource record sets only: A complex type that lets you control how Amazon Route 53 responds to DNS queries based on the geographic origin of the query.

      Returns union: either IResolvable or CfnRecordSet.GeoLocationProperty

    • setGeoLocation

      @Stability(Stable) public void setGeoLocation(@Nullable IResolvable value)
      Geolocation resource record sets only: A complex type that lets you control how Amazon Route 53 responds to DNS queries based on the geographic origin of the query.
    • setGeoLocation

      @Stability(Stable) public void setGeoLocation(@Nullable CfnRecordSet.GeoLocationProperty value)
      Geolocation resource record sets only: A complex type that lets you control how Amazon Route 53 responds to DNS queries based on the geographic origin of the query.
    • getGeoProximityLocation

      @Stability(Stable) @Nullable public Object getGeoProximityLocation()
      GeoproximityLocation resource record sets only: A complex type that lets you control how Route 53 responds to DNS queries based on the geographic origin of the query and your resources.

      Returns union: either IResolvable or CfnRecordSet.GeoProximityLocationProperty

    • setGeoProximityLocation

      @Stability(Stable) public void setGeoProximityLocation(@Nullable IResolvable value)
      GeoproximityLocation resource record sets only: A complex type that lets you control how Route 53 responds to DNS queries based on the geographic origin of the query and your resources.
    • setGeoProximityLocation

      @Stability(Stable) public void setGeoProximityLocation(@Nullable CfnRecordSet.GeoProximityLocationProperty value)
      GeoproximityLocation resource record sets only: A complex type that lets you control how Route 53 responds to DNS queries based on the geographic origin of the query and your resources.
    • getHealthCheckId

      @Stability(Stable) @Nullable public String getHealthCheckId()
      If you want Amazon Route 53 to return this resource record set in response to a DNS query only when the status of a health check is healthy, include the HealthCheckId element and specify the ID of the applicable health check.
    • setHealthCheckId

      @Stability(Stable) public void setHealthCheckId(@Nullable String value)
      If you want Amazon Route 53 to return this resource record set in response to a DNS query only when the status of a health check is healthy, include the HealthCheckId element and specify the ID of the applicable health check.
    • getHostedZoneId

      @Stability(Stable) @Nullable public String getHostedZoneId()
      The ID of the hosted zone that you want to create records in.
    • setHostedZoneId

      @Stability(Stable) public void setHostedZoneId(@Nullable String value)
      The ID of the hosted zone that you want to create records in.
    • getHostedZoneName

      @Stability(Stable) @Nullable public String getHostedZoneName()
      The name of the hosted zone that you want to create records in.
    • setHostedZoneName

      @Stability(Stable) public void setHostedZoneName(@Nullable String value)
      The name of the hosted zone that you want to create records in.
    • getMultiValueAnswer

      @Stability(Stable) @Nullable public Object getMultiValueAnswer()
      Multivalue answer resource record sets only : To route traffic approximately randomly to multiple resources, such as web servers, create one multivalue answer record for each resource and specify true for MultiValueAnswer .

      Returns union: either Boolean or IResolvable

    • setMultiValueAnswer

      @Stability(Stable) public void setMultiValueAnswer(@Nullable Boolean value)
      Multivalue answer resource record sets only : To route traffic approximately randomly to multiple resources, such as web servers, create one multivalue answer record for each resource and specify true for MultiValueAnswer .
    • setMultiValueAnswer

      @Stability(Stable) public void setMultiValueAnswer(@Nullable IResolvable value)
      Multivalue answer resource record sets only : To route traffic approximately randomly to multiple resources, such as web servers, create one multivalue answer record for each resource and specify true for MultiValueAnswer .
    • getRegion

      @Stability(Stable) @Nullable public String getRegion()
      Latency-based resource record sets only: The Amazon EC2 Region where you created the resource that this resource record set refers to.
    • setRegion

      @Stability(Stable) public void setRegion(@Nullable String value)
      Latency-based resource record sets only: The Amazon EC2 Region where you created the resource that this resource record set refers to.
    • getResourceRecords

      @Stability(Stable) @Nullable public List<String> getResourceRecords()
      One or more values that correspond with the value that you specified for the Type property.
    • setResourceRecords

      @Stability(Stable) public void setResourceRecords(@Nullable List<String> value)
      One or more values that correspond with the value that you specified for the Type property.
    • getSetIdentifier

      @Stability(Stable) @Nullable public String getSetIdentifier()
      Resource record sets that have a routing policy other than simple: An identifier that differentiates among multiple resource record sets that have the same combination of name and type, such as multiple weighted resource record sets named acme.example.com that have a type of A. In a group of resource record sets that have the same name and type, the value of SetIdentifier must be unique for each resource record set.
    • setSetIdentifier

      @Stability(Stable) public void setSetIdentifier(@Nullable String value)
      Resource record sets that have a routing policy other than simple: An identifier that differentiates among multiple resource record sets that have the same combination of name and type, such as multiple weighted resource record sets named acme.example.com that have a type of A. In a group of resource record sets that have the same name and type, the value of SetIdentifier must be unique for each resource record set.
    • getTtl

      @Stability(Stable) @Nullable public String getTtl()
      The resource record cache time to live (TTL), in seconds.

      Note the following:.

    • setTtl

      @Stability(Stable) public void setTtl(@Nullable String value)
      The resource record cache time to live (TTL), in seconds.

      Note the following:.

    • getWeight

      @Stability(Stable) @Nullable public Number getWeight()
      Weighted resource record sets only: 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.
    • setWeight

      @Stability(Stable) public void setWeight(@Nullable Number value)
      Weighted resource record sets only: 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.