UNPKG

28.3 kBJavaScriptView Raw
1"use strict";
2var _a;
3Object.defineProperty(exports, "__esModule", { value: true });
4exports.VpcEndpointServiceDomainName = void 0;
5const jsiiDeprecationWarnings = require("../.warnings.jsii.js");
6const JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti");
7const crypto = require("crypto");
8const core_1 = require("@aws-cdk/core");
9const custom_resources_1 = require("@aws-cdk/custom-resources");
10const lib_1 = require("../lib");
11// v2 - keep this import as a separate section to reduce merge conflict when forward merging with the v2 branch.
12// eslint-disable-next-line
13const core_2 = require("@aws-cdk/core");
14/**
15 * A Private DNS configuration for a VPC endpoint service.
16 */
17class VpcEndpointServiceDomainName extends core_2.Construct {
18 // The way this class works is by using three custom resources and a TxtRecord in conjunction
19 // The first custom resource tells the VPC endpoint service to use the given DNS name
20 // The VPC endpoint service will then say:
21 // "ok, create a TXT record using these two values to prove you own the domain"
22 // The second custom resource retrieves these two values from the service
23 // The TxtRecord is created from these two values
24 // The third custom resource tells the VPC Endpoint Service to verify the domain ownership
25 constructor(scope, id, props) {
26 super(scope, id);
27 try {
28 jsiiDeprecationWarnings._aws_cdk_aws_route53_VpcEndpointServiceDomainNameProps(props);
29 }
30 catch (error) {
31 if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
32 Error.captureStackTrace(error, VpcEndpointServiceDomainName);
33 }
34 throw error;
35 }
36 const serviceUniqueId = core_1.Names.nodeUniqueId(props.endpointService.node);
37 const serviceId = props.endpointService.vpcEndpointServiceId;
38 this.domainName = props.domainName;
39 // Make sure a user doesn't accidentally add multiple domains
40 this.validateProps(props);
41 VpcEndpointServiceDomainName.endpointServicesMap[serviceUniqueId] = this.domainName;
42 VpcEndpointServiceDomainName.endpointServices.push(props.endpointService);
43 // Enable Private DNS on the endpoint service and retrieve the AWS-generated configuration
44 const privateDnsConfiguration = this.getPrivateDnsConfiguration(serviceUniqueId, serviceId, this.domainName);
45 // Tell AWS to verify that this account owns the domain attached to the service
46 this.verifyPrivateDnsConfiguration(privateDnsConfiguration, props.publicHostedZone);
47 // Finally, don't do any of the above before the endpoint service is created
48 this.node.addDependency(props.endpointService);
49 }
50 validateProps(props) {
51 const serviceUniqueId = core_1.Names.nodeUniqueId(props.endpointService.node);
52 if (serviceUniqueId in VpcEndpointServiceDomainName.endpointServicesMap) {
53 const endpoint = VpcEndpointServiceDomainName.endpointServicesMap[serviceUniqueId];
54 throw new Error(`Cannot create a VpcEndpointServiceDomainName for service ${serviceUniqueId}, another VpcEndpointServiceDomainName (${endpoint}) is already associated with it`);
55 }
56 }
57 /**
58 * Sets up Custom Resources to make AWS calls to set up Private DNS on an endpoint service,
59 * returning the values to use in a TxtRecord, which AWS uses to verify domain ownership.
60 */
61 getPrivateDnsConfiguration(serviceUniqueId, serviceId, privateDnsName) {
62 // The custom resource which tells AWS to enable Private DNS on the given service, using the given domain name
63 // AWS will generate a name/value pair for use in a TxtRecord, which is used to verify domain ownership.
64 const enablePrivateDnsAction = {
65 service: 'EC2',
66 action: 'modifyVpcEndpointServiceConfiguration',
67 parameters: {
68 ServiceId: serviceId,
69 PrivateDnsName: privateDnsName,
70 },
71 physicalResourceId: custom_resources_1.PhysicalResourceId.of(serviceUniqueId),
72 };
73 const removePrivateDnsAction = {
74 service: 'EC2',
75 action: 'modifyVpcEndpointServiceConfiguration',
76 parameters: {
77 ServiceId: serviceId,
78 RemovePrivateDnsName: true,
79 },
80 };
81 const enable = new custom_resources_1.AwsCustomResource(this, 'EnableDns', {
82 onCreate: enablePrivateDnsAction,
83 onUpdate: enablePrivateDnsAction,
84 onDelete: removePrivateDnsAction,
85 policy: custom_resources_1.AwsCustomResourcePolicy.fromSdkCalls({
86 resources: [
87 core_1.Fn.join(':', [
88 'arn',
89 core_1.Stack.of(this).partition,
90 'ec2',
91 core_1.Stack.of(this).region,
92 core_1.Stack.of(this).account,
93 core_1.Fn.join('/', [
94 'vpc-endpoint-service',
95 serviceId,
96 ]),
97 ]),
98 ],
99 }),
100 });
101 // Look up the name/value pair if the domain changes, or the service changes,
102 // which would cause the values to be different. If the unique ID changes,
103 // the resource may be entirely recreated, so we will need to look it up again.
104 const lookup = hashcode(core_1.Names.uniqueId(this) + serviceUniqueId + privateDnsName);
105 // Create the custom resource to look up the name/value pair generated by AWS
106 // after the previous API call
107 const retrieveNameValuePairAction = {
108 service: 'EC2',
109 action: 'describeVpcEndpointServiceConfigurations',
110 parameters: {
111 ServiceIds: [serviceId],
112 },
113 physicalResourceId: custom_resources_1.PhysicalResourceId.of(lookup),
114 };
115 const getNames = new custom_resources_1.AwsCustomResource(this, 'GetNames', {
116 onCreate: retrieveNameValuePairAction,
117 onUpdate: retrieveNameValuePairAction,
118 // describeVpcEndpointServiceConfigurations can't take an ARN for granular permissions
119 policy: custom_resources_1.AwsCustomResourcePolicy.fromSdkCalls({
120 resources: custom_resources_1.AwsCustomResourcePolicy.ANY_RESOURCE,
121 }),
122 });
123 // We only want to call and get the name/value pair after we've told AWS to enable Private DNS
124 // If we call before then, we'll get an empty pair of values.
125 getNames.node.addDependency(enable);
126 // Get the references to the name/value pair associated with the endpoint service
127 const name = getNames.getResponseField('ServiceConfigurations.0.PrivateDnsNameConfiguration.Name');
128 const value = getNames.getResponseField('ServiceConfigurations.0.PrivateDnsNameConfiguration.Value');
129 return { name, value, serviceId };
130 }
131 /**
132 * Creates a Route53 entry and a Custom Resource which explicitly tells AWS to verify ownership
133 * of the domain name attached to an endpoint service.
134 */
135 verifyPrivateDnsConfiguration(config, publicHostedZone) {
136 // Create the TXT record in the provided hosted zone
137 const verificationRecord = new lib_1.TxtRecord(this, 'DnsVerificationRecord', {
138 recordName: config.name,
139 values: [config.value],
140 zone: publicHostedZone,
141 });
142 // Tell the endpoint service to verify the domain ownership
143 const startVerificationAction = {
144 service: 'EC2',
145 action: 'startVpcEndpointServicePrivateDnsVerification',
146 parameters: {
147 ServiceId: config.serviceId,
148 },
149 physicalResourceId: custom_resources_1.PhysicalResourceId.of(core_1.Fn.join(':', [config.name, config.value])),
150 };
151 const startVerification = new custom_resources_1.AwsCustomResource(this, 'StartVerification', {
152 onCreate: startVerificationAction,
153 onUpdate: startVerificationAction,
154 policy: custom_resources_1.AwsCustomResourcePolicy.fromSdkCalls({
155 resources: [
156 core_1.Fn.join(':', [
157 'arn',
158 core_1.Stack.of(this).partition,
159 'ec2',
160 core_1.Stack.of(this).region,
161 core_1.Stack.of(this).account,
162 core_1.Fn.join('/', [
163 'vpc-endpoint-service',
164 config.serviceId,
165 ]),
166 ]),
167 ],
168 }),
169 });
170 // Only verify after the record has been created
171 startVerification.node.addDependency(verificationRecord);
172 }
173}
174exports.VpcEndpointServiceDomainName = VpcEndpointServiceDomainName;
175_a = JSII_RTTI_SYMBOL_1;
176VpcEndpointServiceDomainName[_a] = { fqn: "@aws-cdk/aws-route53.VpcEndpointServiceDomainName", version: "1.204.0" };
177// Track all domain names created, so someone doesn't accidentally associate two domains with a single service
178VpcEndpointServiceDomainName.endpointServices = [];
179// Track all domain names created, so someone doesn't accidentally associate two domains with a single service
180VpcEndpointServiceDomainName.endpointServicesMap = {};
181/**
182 * Hash a string
183 */
184function hashcode(s) {
185 const hash = crypto.createHash('md5');
186 hash.update(s);
187 return hash.digest('hex');
188}
189;
190//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidnBjLWVuZHBvaW50LXNlcnZpY2UtZG9tYWluLW5hbWUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJ2cGMtZW5kcG9pbnQtc2VydmljZS1kb21haW4tbmFtZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQSxpQ0FBaUM7QUFFakMsd0NBQWlEO0FBQ2pELGdFQUEyRztBQUUzRyxnQ0FBc0Q7QUFFdEQsZ0hBQWdIO0FBQ2hILDJCQUEyQjtBQUMzQix3Q0FBMkQ7QUE0QjNEOztHQUVHO0FBQ0gsTUFBYSw0QkFBNkIsU0FBUSxnQkFBYTtJQWE3RCw2RkFB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XX0=
\No newline at end of file