[英]Fail to create a custom domain name for websocket API gateway using AWS Cloudformation
[英]How to create AWS API Gateway Custom Domain using CloudFormation?
我正在嘗試為API網關創建自定義域,
我已經在ACM中導入了SSL。
我正在嘗試運行以下模板,
但是我遇到一個錯誤-
AWSTemplateFormatVersion: 2010-09-09
Transform: 'AWS::Serverless-2016-10-31'
Description: Test Custom Domain
Resources:
Type: AWS::ApiGateway::DomainName
Properties:
CertificateArn: !Sub 'arn:aws:acm:${AWS::Region}:${AWS::AccountId}:certificate/xxxx-xxx-xxx-xxxx-xxxx'
DomainName: 'test-api.example.com'
EndpointConfiguration:
Types:
- 'EDGE'
錯誤-
Transform AWS::Serverless-2016-10-31 failed with: Invalid Serverless Application Specification document. Number of errors found: 1. Structure of the SAM template is invalid. All 'Resources' must be Objects. If you're using YAML, this may be an indentation issue.. Rollback requested by user.
錯誤告訴您問題所在。 您正在使用YAML,但縮進不正確。
要解決您的問題,請修復“ Properties
屬性的縮進,使其比“ Type
和“ Properties
屬性縮進一個標簽。
問題是缺少邏輯標識,
每個要創建的資源都必須包含在logicalId中-
AWSTemplateFormatVersion: 2010-09-09
Transform: 'AWS::Serverless-2016-10-31'
Description: Test Custom Domain
Resources:
test:
Type: AWS::ApiGateway::DomainName
Properties:
CertificateArn: !Sub 'arn:aws:acm:${AWS::Region}:${AWS::AccountId}:certificate/xxxx-xxx-xxx-xxxx-xxxx'
DomainName: 'test-api.example.com'
EndpointConfiguration:
Types:
- 'EDGE'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.