diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.latency-based-routing.js.snapshot/Route53LatencyBasedRoutingIntegDefaultTestDeployAssert0B7B9B14.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.latency-based-routing.js.snapshot/Route53LatencyBasedRoutingIntegDefaultTestDeployAssert0B7B9B14.assets.json deleted file mode 100644 index 5e6fa13156374..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.latency-based-routing.js.snapshot/Route53LatencyBasedRoutingIntegDefaultTestDeployAssert0B7B9B14.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "36.0.0", - "files": { - "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { - "source": { - "path": "Route53LatencyBasedRoutingIntegDefaultTestDeployAssert0B7B9B14.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.latency-based-routing.js.snapshot/Route53LatencyBasedRoutingIntegDefaultTestDeployAssert0B7B9B14.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.latency-based-routing.js.snapshot/Route53LatencyBasedRoutingIntegDefaultTestDeployAssert0B7B9B14.template.json deleted file mode 100644 index ad9d0fb73d1dd..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.latency-based-routing.js.snapshot/Route53LatencyBasedRoutingIntegDefaultTestDeployAssert0B7B9B14.template.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "Parameters": { - "BootstrapVersion": { - "Type": "AWS::SSM::Parameter::Value", - "Default": "/cdk-bootstrap/hnb659fds/version", - "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" - } - }, - "Rules": { - "CheckBootstrapVersion": { - "Assertions": [ - { - "Assert": { - "Fn::Not": [ - { - "Fn::Contains": [ - [ - "1", - "2", - "3", - "4", - "5" - ], - { - "Ref": "BootstrapVersion" - } - ] - } - ] - }, - "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." - } - ] - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.latency-based-routing.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.latency-based-routing.js.snapshot/cdk.out deleted file mode 100644 index 1f0068d32659a..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.latency-based-routing.js.snapshot/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"36.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.latency-based-routing.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.latency-based-routing.js.snapshot/integ.json deleted file mode 100644 index d4846f2169088..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.latency-based-routing.js.snapshot/integ.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "36.0.0", - "testCases": { - "Route53LatencyBasedRoutingInteg/DefaultTest": { - "stacks": [ - "latency-based-routing" - ], - "assertionStack": "Route53LatencyBasedRoutingInteg/DefaultTest/DeployAssert", - "assertionStackName": "Route53LatencyBasedRoutingIntegDefaultTestDeployAssert0B7B9B14" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.latency-based-routing.js.snapshot/latency-based-routing.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.latency-based-routing.js.snapshot/latency-based-routing.assets.json deleted file mode 100644 index 65a0b9089f9bb..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.latency-based-routing.js.snapshot/latency-based-routing.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "36.0.0", - "files": { - "a80ec20b957f0b1134ee759f20e89c04b7bc876c73408565ff5613e6632e3b1f": { - "source": { - "path": "latency-based-routing.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "a80ec20b957f0b1134ee759f20e89c04b7bc876c73408565ff5613e6632e3b1f.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.latency-based-routing.js.snapshot/latency-based-routing.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.latency-based-routing.js.snapshot/latency-based-routing.template.json deleted file mode 100644 index 7a46513e08aa4..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.latency-based-routing.js.snapshot/latency-based-routing.template.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "Resources": { - "HostedZoneDB99F866": { - "Type": "AWS::Route53::HostedZone", - "Properties": { - "Name": "cdk.dev." - } - }, - "LatencyBasedRouting0C1664EAC": { - "Type": "AWS::Route53::RecordSet", - "Properties": { - "HostedZoneId": { - "Ref": "HostedZoneDB99F866" - }, - "Name": "www.cdk.dev.", - "Region": "us-east-1", - "ResourceRecords": [ - "1.2.3.4" - ], - "SetIdentifier": "REGION_us-east-1_ID_latencybasedroutintencyBasedRouting09258C5CC", - "TTL": "1800", - "Type": "A" - } - }, - "LatencyBasedRouting1D10EA109": { - "Type": "AWS::Route53::RecordSet", - "Properties": { - "HostedZoneId": { - "Ref": "HostedZoneDB99F866" - }, - "Name": "www.cdk.dev.", - "Region": "ap-northeast-1", - "ResourceRecords": [ - "2.3.4.5" - ], - "SetIdentifier": "REGION_ap-northeast-1_ID_latencybasedroucyBasedRouting193C4855F", - "TTL": "1800", - "Type": "A" - } - }, - "LatencyBasedRouting26C32588A": { - "Type": "AWS::Route53::RecordSet", - "Properties": { - "HostedZoneId": { - "Ref": "HostedZoneDB99F866" - }, - "Name": "www.cdk.dev.", - "Region": "eu-west-1", - "ResourceRecords": [ - "3.4.5.6" - ], - "SetIdentifier": "REGION_eu-west-1_ID_latencybasedroutintencyBasedRouting25966E4AD", - "TTL": "1800", - "Type": "A" - } - } - }, - "Parameters": { - "BootstrapVersion": { - "Type": "AWS::SSM::Parameter::Value", - "Default": "/cdk-bootstrap/hnb659fds/version", - "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" - } - }, - "Rules": { - "CheckBootstrapVersion": { - "Assertions": [ - { - "Assert": { - "Fn::Not": [ - { - "Fn::Contains": [ - [ - "1", - "2", - "3", - "4", - "5" - ], - { - "Ref": "BootstrapVersion" - } - ] - } - ] - }, - "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." - } - ] - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.latency-based-routing.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.latency-based-routing.js.snapshot/manifest.json deleted file mode 100644 index b8eba09d53899..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.latency-based-routing.js.snapshot/manifest.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - "version": "36.0.0", - "artifacts": { - "latency-based-routing.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "latency-based-routing.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "latency-based-routing": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "latency-based-routing.template.json", - "terminationProtection": false, - "validateOnSynth": false, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/a80ec20b957f0b1134ee759f20e89c04b7bc876c73408565ff5613e6632e3b1f.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "latency-based-routing.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "dependencies": [ - "latency-based-routing.assets" - ], - "metadata": { - "/latency-based-routing/HostedZone/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "HostedZoneDB99F866" - } - ], - "/latency-based-routing/LatencyBasedRouting0/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "LatencyBasedRouting0C1664EAC" - } - ], - "/latency-based-routing/LatencyBasedRouting1/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "LatencyBasedRouting1D10EA109" - } - ], - "/latency-based-routing/LatencyBasedRouting2/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "LatencyBasedRouting26C32588A" - } - ], - "/latency-based-routing/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/latency-based-routing/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "latency-based-routing" - }, - "Route53LatencyBasedRoutingIntegDefaultTestDeployAssert0B7B9B14.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "Route53LatencyBasedRoutingIntegDefaultTestDeployAssert0B7B9B14.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "Route53LatencyBasedRoutingIntegDefaultTestDeployAssert0B7B9B14": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "Route53LatencyBasedRoutingIntegDefaultTestDeployAssert0B7B9B14.template.json", - "terminationProtection": false, - "validateOnSynth": false, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "Route53LatencyBasedRoutingIntegDefaultTestDeployAssert0B7B9B14.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "dependencies": [ - "Route53LatencyBasedRoutingIntegDefaultTestDeployAssert0B7B9B14.assets" - ], - "metadata": { - "/Route53LatencyBasedRoutingInteg/DefaultTest/DeployAssert/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/Route53LatencyBasedRoutingInteg/DefaultTest/DeployAssert/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "Route53LatencyBasedRoutingInteg/DefaultTest/DeployAssert" - }, - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.latency-based-routing.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.latency-based-routing.js.snapshot/tree.json deleted file mode 100644 index 75c178dd1b0a1..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.latency-based-routing.js.snapshot/tree.json +++ /dev/null @@ -1,227 +0,0 @@ -{ - "version": "tree-0.1", - "tree": { - "id": "App", - "path": "", - "children": { - "latency-based-routing": { - "id": "latency-based-routing", - "path": "latency-based-routing", - "children": { - "HostedZone": { - "id": "HostedZone", - "path": "latency-based-routing/HostedZone", - "children": { - "Resource": { - "id": "Resource", - "path": "latency-based-routing/HostedZone/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Route53::HostedZone", - "aws:cdk:cloudformation:props": { - "name": "cdk.dev." - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_route53.CfnHostedZone", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_route53.PublicHostedZone", - "version": "0.0.0" - } - }, - "LatencyBasedRouting0": { - "id": "LatencyBasedRouting0", - "path": "latency-based-routing/LatencyBasedRouting0", - "children": { - "Resource": { - "id": "Resource", - "path": "latency-based-routing/LatencyBasedRouting0/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Route53::RecordSet", - "aws:cdk:cloudformation:props": { - "hostedZoneId": { - "Ref": "HostedZoneDB99F866" - }, - "name": "www.cdk.dev.", - "region": "us-east-1", - "resourceRecords": [ - "1.2.3.4" - ], - "setIdentifier": "REGION_us-east-1_ID_latencybasedroutintencyBasedRouting09258C5CC", - "ttl": "1800", - "type": "A" - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_route53.CfnRecordSet", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_route53.ARecord", - "version": "0.0.0" - } - }, - "LatencyBasedRouting1": { - "id": "LatencyBasedRouting1", - "path": "latency-based-routing/LatencyBasedRouting1", - "children": { - "Resource": { - "id": "Resource", - "path": "latency-based-routing/LatencyBasedRouting1/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Route53::RecordSet", - "aws:cdk:cloudformation:props": { - "hostedZoneId": { - "Ref": "HostedZoneDB99F866" - }, - "name": "www.cdk.dev.", - "region": "ap-northeast-1", - "resourceRecords": [ - "2.3.4.5" - ], - "setIdentifier": "REGION_ap-northeast-1_ID_latencybasedroucyBasedRouting193C4855F", - "ttl": "1800", - "type": "A" - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_route53.CfnRecordSet", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_route53.ARecord", - "version": "0.0.0" - } - }, - "LatencyBasedRouting2": { - "id": "LatencyBasedRouting2", - "path": "latency-based-routing/LatencyBasedRouting2", - "children": { - "Resource": { - "id": "Resource", - "path": "latency-based-routing/LatencyBasedRouting2/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Route53::RecordSet", - "aws:cdk:cloudformation:props": { - "hostedZoneId": { - "Ref": "HostedZoneDB99F866" - }, - "name": "www.cdk.dev.", - "region": "eu-west-1", - "resourceRecords": [ - "3.4.5.6" - ], - "setIdentifier": "REGION_eu-west-1_ID_latencybasedroutintencyBasedRouting25966E4AD", - "ttl": "1800", - "type": "A" - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_route53.CfnRecordSet", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_route53.ARecord", - "version": "0.0.0" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "latency-based-routing/BootstrapVersion", - "constructInfo": { - "fqn": "aws-cdk-lib.CfnParameter", - "version": "0.0.0" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "latency-based-routing/CheckBootstrapVersion", - "constructInfo": { - "fqn": "aws-cdk-lib.CfnRule", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.Stack", - "version": "0.0.0" - } - }, - "Route53LatencyBasedRoutingInteg": { - "id": "Route53LatencyBasedRoutingInteg", - "path": "Route53LatencyBasedRoutingInteg", - "children": { - "DefaultTest": { - "id": "DefaultTest", - "path": "Route53LatencyBasedRoutingInteg/DefaultTest", - "children": { - "Default": { - "id": "Default", - "path": "Route53LatencyBasedRoutingInteg/DefaultTest/Default", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" - } - }, - "DeployAssert": { - "id": "DeployAssert", - "path": "Route53LatencyBasedRoutingInteg/DefaultTest/DeployAssert", - "children": { - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "Route53LatencyBasedRoutingInteg/DefaultTest/DeployAssert/BootstrapVersion", - "constructInfo": { - "fqn": "aws-cdk-lib.CfnParameter", - "version": "0.0.0" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "Route53LatencyBasedRoutingInteg/DefaultTest/DeployAssert/CheckBootstrapVersion", - "constructInfo": { - "fqn": "aws-cdk-lib.CfnRule", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.Stack", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "0.0.0" - } - }, - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.App", - "version": "0.0.0" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.latency-based-routing.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.latency-based-routing.ts index fc83fb1630db3..d8067b3195ad2 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.latency-based-routing.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.latency-based-routing.ts @@ -12,9 +12,9 @@ class TestStack extends Stack { }); [ - { target: '1.2.3.4', region: 'us-east-1' }, - { target: '2.3.4.5', region: 'ap-northeast-1' }, - { target: '3.4.5.6', region: 'eu-west-1' }, + { target: '1.2.3.4', region: route53.LatencyBasedRoutingRegion.US_EAST_1 }, + { target: '2.3.4.5', region: route53.LatencyBasedRoutingRegion.AP_NORTHEAST_1 }, + { target: '3.4.5.6', region: route53.LatencyBasedRoutingRegion.EU_WEST_1 }, ].forEach((data, index) => { new route53.ARecord(this, `LatencyBasedRouting${index}`, { zone: hostedZone, diff --git a/packages/aws-cdk-lib/aws-route53/README.md b/packages/aws-cdk-lib/aws-route53/README.md index 34727074040a4..f3ee2e3f1ab7f 100644 --- a/packages/aws-cdk-lib/aws-route53/README.md +++ b/packages/aws-cdk-lib/aws-route53/README.md @@ -171,7 +171,7 @@ declare const myZone: route53.HostedZone; new route53.ARecord(this, 'ARecordLatency1', { zone: myZone, target: route53.RecordTarget.fromIpAddresses('1.2.3.4'), - region: 'us-east-1', + region: route53.LatencyBasedRoutingRegion.US_EAST_1, }); ``` diff --git a/packages/aws-cdk-lib/aws-route53/lib/record-set.ts b/packages/aws-cdk-lib/aws-route53/lib/record-set.ts index 8564aedae843a..e9509c5abd56a 100644 --- a/packages/aws-cdk-lib/aws-route53/lib/record-set.ts +++ b/packages/aws-cdk-lib/aws-route53/lib/record-set.ts @@ -128,6 +128,138 @@ export enum RecordType { TXT = 'TXT' } +/** + * Regions available for latency-based routing + * + * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-route53-recordset.html#cfn-route53-recordset-region + */ +export enum LatencyBasedRoutingRegion { + /** + * US East (Virginia) + */ + US_EAST_1 = 'us-east-1', + /** + * US East (Ohio) + */ + US_EAST_2 = 'us-east-2', + /** + * US West (N. California) + */ + US_WEST_1 = 'us-west-1', + /** + * US West (Oregon) + */ + US_WEST_2 = 'us-west-2', + /** + * Africa (Cape Town) + */ + AF_SOUTH_1 = 'af-south-1', + /** + * Asia Pacific (Hong Kong) + */ + AP_EAST_1 = 'ap-east-1', + /** + * Asia Pacific (Singapore) + */ + AP_SOUTHEAST_1 = 'ap-southeast-1', + /** + * Asia Pacific (Sydney) + */ + AP_SOUTHEAST_2 = 'ap-southeast-2', + /** + * Asia Pacific (Jakarta) + */ + AP_SOUTHEAST_3 = 'ap-southeast-3', + /** + * Asia Pacific (Melbourne) + */ + AP_SOUTHEAST_4 = 'ap-southeast-4', + /** + * Asia Pacific (Tokyo) + */ + AP_NORTHEAST_1 = 'ap-northeast-1', + /** + * Asia Pacific (Seoul) + */ + AP_NORTHEAST_2 = 'ap-northeast-2', + /** + * Asia Pacific (Osaka) + */ + AP_NORTHEAST_3 = 'ap-northeast-3', + /** + * Asia Pacific (Mumbai) + */ + AP_SOUTH_1 = 'ap-south-1', + /** + * Asia Pacific (Hyderabad) + */ + AP_SOUTH_2 = 'ap-south-2', + /** + * Europe (Ireland) + */ + EU_WEST_1 = 'eu-west-1', + /** + * Europe (London) + */ + EU_WEST_2 = 'eu-west-2', + /** + * Europe (Paris) + */ + EU_WEST_3 = 'eu-west-3', + /** + * Europe (Frankfurt) + */ + EU_CENTRAL_1 = 'eu-central-1', + /** + * Europe (Zurich) + */ + EU_CENTRAL_2 = 'eu-central-2', + /** + * Europe (Stockholm) + */ + EU_NORTH_1 = 'eu-north-1', + /** + * Europe (Milan) + */ + EU_SOUTH_1 = 'eu-south-1', + /** + * Europe (Spain) + */ + EU_SOUTH_2 = 'eu-south-2', + /** + * South America (São Paulo) + */ + SA_EAST_1 = 'sa-east-1', + /** + * China (Beijing) + */ + CN_NORTH_1 = 'cn-north-1', + /** + * China (Ningxia) + */ + CN_NORTHWEST_1 = 'cn-northwest-1', + /** + * Middle East (Bahrain) + */ + ME_SOUTH_1 = 'me-south-1', + /** + * Middle East (UAE) + */ + ME_CENTRAL_1 = 'me-central-1', + /** + * Israel (Tel Aviv) + */ + IL_CENTRAL_1 = 'il-central-1', + /** + * Canada West (Calgary) + */ + CA_WEST_1 = 'ca-west-1', + /** + * Canada (Central) + */ + CA_CENTRAL_1 = 'ca-central-1', +} + /** * Options for a RecordSet. */ @@ -213,7 +345,7 @@ export interface RecordSetOptions { * * @default - Do not set latency based routing */ - readonly region?: string; + readonly region?: LatencyBasedRoutingRegion; /** * A string used to distinguish between different records with the same combination of DNS name and type. diff --git a/packages/aws-cdk-lib/aws-route53/test/record-set.test.ts b/packages/aws-cdk-lib/aws-route53/test/record-set.test.ts index 7f6c990af4955..a2264f14d58d8 100644 --- a/packages/aws-cdk-lib/aws-route53/test/record-set.test.ts +++ b/packages/aws-cdk-lib/aws-route53/test/record-set.test.ts @@ -1168,9 +1168,9 @@ describe('record set', () => { test.each([ { weight: 20, geoLocation: route53.GeoLocation.continent(route53.Continent.EUROPE) }, - { weight: 20, region: 'us-east-1' }, - { geoLocation: route53.GeoLocation.continent(route53.Continent.EUROPE), region: 'us-east-1' }, - { weight: 20, geoLocation: route53.GeoLocation.continent(route53.Continent.EUROPE), region: 'us-east-1' }, + { weight: 20, region: route53.LatencyBasedRoutingRegion.US_EAST_1 }, + { geoLocation: route53.GeoLocation.continent(route53.Continent.EUROPE), region: route53.LatencyBasedRoutingRegion.US_EAST_1 }, + { weight: 20, geoLocation: route53.GeoLocation.continent(route53.Continent.EUROPE), region: route53.LatencyBasedRoutingRegion.US_EAST_1 }, ])('throw error for the simultaneous definition of weight, geoLocation and region', (props) => { // GIVEN const stack = new Stack();