@@ -94,9 +94,10 @@ export class InterfaceEndpoint extends cdk.Construct {
9494
9595 this . _hostedZone . addDependsOn ( endpoint ) ;
9696
97+ const recordSetName = recordSetNameForRegionAndEndpointName ( vpcRegion , serviceName ) ;
9798 const recordSet = new route53 . CfnRecordSet ( this , 'RecordSet' , {
9899 type : 'A' ,
99- name : hostedZoneName ,
100+ name : recordSetName ,
100101 hostedZoneId : this . _hostedZone . ref ,
101102 aliasTarget : aliasTargetForServiceNameAndEndpoint ( serviceName , endpoint ) ,
102103 } ) ;
@@ -121,13 +122,18 @@ function interfaceVpcEndpointForRegionAndEndpointName(region: string, name: stri
121122 if ( name === 'notebook' ) {
122123 return `aws.sagemaker.${ region } .${ name } ` ;
123124 }
125+
124126 return `com.amazonaws.${ region } .${ name } ` ;
125127}
126128
127129function zoneNameForRegionAndEndpointName ( region : string , name : string ) {
128130 if ( name === 'notebook' ) {
129131 return `notebook.${ region } .sagemaker.aws.` ;
130132 }
133+ if ( name . indexOf ( '.' ) > 0 ) {
134+ const tmp = name . split ( '.' ) . reverse ( ) . join ( '.' ) ;
135+ return `${ tmp } .${ region } .amazonaws.com.` ;
136+ }
131137 return `${ name } .${ region } .amazonaws.com.` ;
132138}
133139
@@ -139,3 +145,13 @@ function getZoneAliasTargetIndex(name: string): number {
139145 }
140146 return 0 ;
141147}
148+
149+ function recordSetNameForRegionAndEndpointName ( region : string , name : string ) {
150+ const hostedZoneName = zoneNameForRegionAndEndpointName ( region , name ) ;
151+
152+ if ( name === 'ecr.dkr' ) {
153+ return `*.${ hostedZoneName } ` ;
154+ }
155+
156+ return hostedZoneName ;
157+ }
0 commit comments