Skip to content

Commit f7e8452

Browse files
committed
revert: fix(ec2): fixing vpc endpoint pattern for ecr and ecr docker (#31496)
Reverts #31434 to resolve #31492
1 parent d77a1b2 commit f7e8452

File tree

2 files changed

+1
-46
lines changed

2 files changed

+1
-46
lines changed

packages/aws-cdk-lib/aws-ec2/lib/vpc-endpoint.ts

+1-15
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { ISubnet, IVpc, SubnetSelection } from './vpc';
99
import * as iam from '../../aws-iam';
1010
import * as cxschema from '../../cloud-assembly-schema';
1111
import { Aws, ContextProvider, IResource, Lazy, Resource, Stack, Token } from '../../core';
12-
import { PARTITION_MAP } from '../../region-info/build-tools/fact-tables';
1312

1413
/**
1514
* A VPC endpoint.
@@ -667,21 +666,8 @@ export class InterfaceVpcEndpointAwsService implements IInterfaceVpcEndpointServ
667666
'redshift', 'redshift-data', 's3', 'sagemaker.api', 'sagemaker.featurestore-runtime', 'sagemaker.runtime', 'securityhub',
668667
'servicecatalog', 'sms', 'sqs', 'states', 'sts', 'sync-states', 'synthetics', 'transcribe', 'transcribestreaming', 'transfer',
669668
'workspaces', 'xray'],
670-
'us-isof-': ['ecr.api', 'ecr.dkr'],
671-
'eu-isoe-': ['ecr.api', 'ecr.dkr'],
672669
};
673-
674-
const regionPartition = region.split('-').slice(0, 2).join('-');
675-
const partitionDetails = PARTITION_MAP[`${regionPartition}-`];
676-
677-
// Check for specific service name under isolated region prefix
678-
const serviceInExceptions = VPC_ENDPOINT_SERVICE_EXCEPTIONS[`${regionPartition}-`]?.includes(name);
679-
680-
if (serviceInExceptions) {
681-
// Endpoints generated in reverse of domain suffix for the services mentioned in map
682-
const reverseString = partitionDetails.domainSuffix.split('.').reverse().join('.');
683-
return reverseString;
684-
} else if (VPC_ENDPOINT_SERVICE_EXCEPTIONS[region]?.includes(name)) {
670+
if (VPC_ENDPOINT_SERVICE_EXCEPTIONS[region]?.includes(name)) {
685671
return 'cn.com.amazonaws';
686672
} else {
687673
return 'com.amazonaws';

packages/aws-cdk-lib/aws-ec2/test/vpc-endpoint.test.ts

-31
Original file line numberDiff line numberDiff line change
@@ -694,37 +694,6 @@ describe('vpc endpoint', () => {
694694
});
695695

696696
});
697-
698-
test.each([
699-
['us-isof-test-1', 'gov.ic.hci.csp'],
700-
['eu-isoe-test-1', 'uk.adc-e.cloud'],
701-
['us-east-1', 'com.amazonaws'],
702-
['us-gov-west-1', 'com.amazonaws'],
703-
['cn-northwest-1', 'cn.com.amazonaws'],
704-
['cn-north-1', 'cn.com.amazonaws'],
705-
])('test vpc interface endpoint for ECR can be created correctly in all regions', (region : string, domain: string) => {
706-
//GIVEN
707-
const stack = new Stack(undefined, 'TestStack', { env: { account: '123456789012', region: region } });
708-
const vpc = new Vpc(stack, 'VPC');
709-
710-
//WHEN
711-
vpc.addInterfaceEndpoint('ECR Endpoint', {
712-
service: InterfaceVpcEndpointAwsService.ECR,
713-
});
714-
715-
vpc.addInterfaceEndpoint('ECR Docker Endpoint', {
716-
service: InterfaceVpcEndpointAwsService.ECR_DOCKER,
717-
});
718-
719-
//THEN
720-
Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPCEndpoint', {
721-
ServiceName: `${domain}.${region}.ecr.api`,
722-
});
723-
Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPCEndpoint', {
724-
ServiceName: `${domain}.${region}.ecr.dkr`,
725-
});
726-
});
727-
728697
test.each([
729698
['transcribe', InterfaceVpcEndpointAwsService.TRANSCRIBE],
730699
])('test vpc interface endpoint with .cn suffix for %s can be created correctly in China regions', (name: string, given: InterfaceVpcEndpointAwsService) => {

0 commit comments

Comments
 (0)