如何查找并引用堆栈中的现有 VPC 终端节点,以便将其传递给 API Gateway RestApi() 以获取私有 API?
msshenke 的答案返回 Ivpc 我需要的是 vpc 端点引用。
这就是我发现的
https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-ec2.InterfaceVpcEndpoint.html#static-from-wbr-interface-wbr-vpc-wbr-endpoint-wbr-attributesscope -id-属性 https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-ec2.InterfaceVpcEndpoint.html#static-from-wbr-interface-wbr-vpc-wbr-endpoint-wbr-attributesscope-id-attrs
需要提供现有的 vpce id 和安全组。
CDK v1
const ivpc = Vpc.InterfaceVpcEndpoint.fromInterfaceVpcEndpointAttributes(this, "VPC", {
port: 443,
vpcEndpointId: "vpce-1234567890",
securityGroups: ["https-sg"] // or whatever you are using
});
CDK v2
securityGroups
属性可选
const ivpc = ec2.InterfaceVpcEndpoint.fromInterfaceVpcEndpointAttributes(this, `vpceLookup`, {
vpcEndpointId : `vpce-abcdefgh123456789`,
port : 443
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)