[英]How can I reference an existing VPC Endpoint in AWS CDK?
我如何在我的堆栈中查找和引用现有的 VPC 终端节点,以便我可以将它传递给私有 API 的 API Gateway RestApi()?
msshenke 的回答返回 Ivpc 我需要的是 vpc 端点引用。
这是我发现的
需要提供现有的 vpce id 和安全组。
const ivpc = Vpc.InterfaceVpcEndpoint.fromInterfaceVpcEndpointAttributes(this, "VPC", {
port: 443,
vpcEndpointId: "vpce-1234567890",
securityGroups: ["https-sg"] // or whatever you are using
});
https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-ec2.VpcAttributes.html
您至少需要拥有您的子网正在使用的 vpc id 和可用区。
const vpc = Vpc.fromVpcAttributes(this, "VPC", {
vpcId: "vpc-1234567890",
availabilityZones: ["us-east-1a", "us-east-1b"] // or whatever you are using
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.