amazon-web-services - Cloudformation 中的 VPC 端点 - 端点类型(网关)与可用服务类型不匹配([接口])
问题描述
我正在尝试在 Cloudformation 中为 API Gateway 创建 VPC 端点,但出现此错误:
Endpoint type (Gateway) does not match available service types ([Interface]).
下面的模板放置在资源部分中:
executeApiEndpoint:
Type: AWS::EC2::VPCEndpoint
Properties:
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal: "*"
Action:
- "execute-api:Invoke"
- "execute-api:ManageConnections"
Resource:
- "arn:aws:execute-api:*:*:*"
RouteTableIds:
- !Ref privateRouteTable
ServiceName: !Sub com.amazonaws.${AWS::Region}.execute-api
VpcId: !Ref pubPrivateVPC
这个也不起作用:
executeApiEndpoint:
Type: AWS::EC2::VPCEndpoint
Properties:
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal: "*"
Action:
- "execute-api:*"
Resource:
- "*"
RouteTableIds:
- !Ref privateRouteTable
ServiceName: !Sub com.amazonaws.${AWS::Region}.execute-api
VpcId: !Ref pubPrivateVPC
但是,这个块(来自模板)能够在没有任何错误的情况下执行:
s3Endpoint:
Type: AWS::EC2::VPCEndpoint
Properties:
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal: "*"
Action:
- "s3:*"
Resource:
- "*"
RouteTableIds:
- !Ref privateRouteTable
ServiceName: !Sub com.amazonaws.${AWS::Region}.s3
VpcId: !Ref pubPrivateVPC
这里出了什么问题?
解决方案
您还必须在资源上指定VpcEndpointType 属性AWS::EC2::VPCEndpoint
才能Interface
使接口类型的 VPC 终端节点正常工作。默认值为“网关”,仅适用于 S3 和 DynamoDB VPC 终端节点。
您的解决方案使用 S3 作为端点的原因是因为该VpcEndpointType
属性具有“网关”作为默认值(适用于 S3)。
推荐阅读
- reactjs - 在反应状态数组中保存最新的字符串值
- unit-testing - UT 的 Angular 更新 10 问题
- c# - 如何水平显示数据
- java - Java Stream:如何避免在 Collectors.toList() 中添加空值?
- amazon-web-services - 在 Terraform 中为每个 AWS 可用区自动创建一个子网
- java - 如何正确地将这个“奇怪的”单元格值转换为 Date 对象,使用 Apache POI 检索解析 Excel?
- r - 换行并在第二行添加
- java - Java:保存具有多对多关联的实体
- .htaccess - htaccess RewriteRule 内
使用 HTTP_HOST 的语句 - javascript - Javascript:“Mouseover”和“mouseout”事件处理程序可以工作,但是当“mouseover”被“click”替换时“mouseout”不能正常工作