Skip to content
v2.275.0

RecordTarget Class ​

Type union for a record that accepts multiple types of target.

Example ​

ts
declare const instance: ec2.Instance;

const elasticIp = new ec2.CfnEIP(this, 'EIP', {
  domain: 'vpc',
  instanceId: instance.instanceId,
});

declare const myZone: route53.HostedZone;
new route53.ARecord(this, 'ARecord', {
  zone: myZone,
  target: route53.RecordTarget.fromIpAddresses(elasticIp.ref),
});

Properties ​

aliasTargetmay be undefinedIAliasRecordTargetalias_targetmay be undefinedIAliasRecordTargetaliasTargetmay be undefinedIAliasRecordTargetAliasTargetmay be undefinedIAliasRecordTargetAliasTargetmay be undefinedIAliasRecordTarget#
alias for targets such as CloudFront distribution to route traffic to.
valuesmay be undefinedstring[]valuesmay be undefinedtyping.List[str]valuesmay be undefinedList<String>Valuesmay be undefinedstring[]Valuesmay be undefined*[]*string#
correspond with the chosen record type (e.g. for 'A' Type, specify one or more IP addresses).

Methods ​

fromAlias(aliasTarget: IAliasRecordTarget): RecordTarget // chainable@staticmethod def from_alias(alias_target: IAliasRecordTarget) -> RecordTargetpublic static RecordTarget fromAlias(IAliasRecordTarget aliasTarget)public static RecordTarget FromAlias(IAliasRecordTarget aliasTarget)func FromAlias(AliasTarget IAliasRecordTarget) RecordTargetstatic#
Use an alias as target.
fromIpAddresses(...ipAddresses: string[]): RecordTarget // chainable@staticmethod def from_ip_addresses(ip_addresses: str) -> RecordTargetpublic static RecordTarget fromIpAddresses(String ipAddresses)public static RecordTarget FromIpAddresses(string ipAddresses)func FromIpAddresses(IpAddresses *string) RecordTargetstatic#
Use ip addresses as target.
fromValues(...values: string[]): RecordTarget // chainable@staticmethod def from_values(values: str) -> RecordTargetpublic static RecordTarget fromValues(String values)public static RecordTarget FromValues(string values)func FromValues(Values *string) RecordTargetstatic#
Use string values as target.