amazon-web-services - 模板包含错误。 : Template format error: At least one Resources member must be defined

标签 amazon-web-services aws-cloudformation

我对 CloudFormation 还很陌生,在 S3 服务中创建堆栈时,我在“在设计器中创建模板”选项中收到此错误。

模板包含错误:模板格式错误:必须定义至少一个资源成员。

这是我的 template.yaml 文件

AWSTemplateFormatVersion: "2010-09-09"
Resources:
  HelloBucket:
    Type: AWS::S3::Bucket
Outputs:
  HelloBucketDomain:
    Description: Domain of the Bucket
    Value: !GetAtt HelloBucket.DomainName

任何帮助将不胜感激

最佳答案

当您尝试将其添加到设计器模式的组件窗口中时,您将收到上述错误。

相反,在设计器模式下选择模板并复制粘贴您的代码(左下),然后选择 JSON 或 YAML(在您的情况下为 YAML)

enter image description here

在组件模式下,粘贴代码并点击刷新后,您将不会看到设计器中添加的组件,即使组件选项卡中有代码,它也不会反射(reflect)设计器窗口,因此您会收到错误。

所以使用模板而不是组件。

关于amazon-web-services - 模板包含错误。 : Template format error: At least one Resources member must be defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73856244/

相关文章:

python - 在 AWS Lambda 中使用来自 S3 触发器的事件数据

grails - 生产iOS推送通知在本地发送,但不是从AWS Elastic beantalk发送

amazon-web-services - AWS API网关: User anonymous is not authorized to execute API

amazon-web-services - AWS Lambda 参数传递错误 | API网关

aws-cloudformation - 在 CloudFormation 中跨不同区域添加 VPC 对等互连

amazon-web-services - AWS Codepipeline 将 cloudformation 部署到开发帐户并使用输出堆栈在中央帐户中创建参数存储。可能吗?

amazon-web-services - 使用Mup部署和NGINX的 meteor 应用程序未出现在AWS上

amazon-web-services - Terraform没有将Lambda代码zip文件上传到AWS

amazon-web-services - CodePipeline、CodeBuild、CloudFormation、Lambda : build multiple lambdas in a single build and assign their code correctly

json - Cloudformation,模板验证错误: Invalid template property or properties