Last active
March 14, 2022 16:32
-
-
Save frankwese/e5bf762297b24f269c56646d1b53cdaf to your computer and use it in GitHub Desktop.
Creating weighted DNS Records with CDK
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Stack, StackProps } from 'aws-cdk-lib'; | |
import { Construct } from 'constructs'; | |
// import * as sqs from 'aws-cdk-lib/aws-sqs'; | |
import * as r53 from 'aws-cdk-lib/aws-route53'; | |
export class DnsTestStack extends Stack { | |
constructor(scope: Construct, id: string, props?: StackProps) { | |
super(scope, id, props); | |
const theZone = r53.HostedZone.fromLookup(this, 'AE-ZONE', { | |
domainName: 'everestate.ae', | |
}); | |
const record1 = new r53.ARecord(this, 'BumsAERecord1', { | |
zone: theZone , | |
target: r53.RecordTarget.fromIpAddresses('1.2.3.4', '1.2.3.5'), | |
recordName: 'bums.everestate.ae', | |
}); | |
const recordSet1 = (record1.node.defaultChild as r53.CfnRecordSet); | |
recordSet1.weight = 100; | |
recordSet1.setIdentifier = "one"; | |
const record2 = new r53.ARecord(this, 'BumsAERecord2', { | |
zone: theZone , | |
target: r53.RecordTarget.fromIpAddresses('2.3.4.5', '2.3.4.6'), | |
recordName: 'bums.everestate.ae', | |
}); | |
const recordSet2 = (record2.node.defaultChild as r53.CfnRecordSet); | |
recordSet2.weight = 100; | |
recordSet2.setIdentifier = "two"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment