gpt4 book ai didi

aws-cloudformation - CloudFormation - SAM 模板的结构无效。 'Resources' 部分是必需的

转载 作者:行者123 更新时间:2023-12-03 07:16:58 25 4
gpt4 key购买 nike

我尝试使用代码管道部署 lambda 并使用 sam yml 进行代码部署,但失败并出现以下错误:

FAILED - 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.
'Resources' section is required

sam.yml 是:

AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: Lambda1
Resources:
callDetails:
Type: 'AWS::Serverless::Function'
Properties:
Handler: lambda_function.lambda_handler
Runtime: python3.6
CodeUri: .
Description: 'Lambda Function'
MemorySize: 128
Timeout: 30
Role: 'arn:aws:iam::XXXXXX:role/YYYYYYYYY'
Environment:
Variables:
REGION: ap-southeast-2

buildspec.yml 具有以下命令

aws cloudformation package \
--template-file samTemplate.yaml \
--s3-bucket XXXX \
--output-template-file outputSamTemplate.yaml

输出SamTemplate:

AWSTemplateFormatVersion: '2010-09-09'
Description: Lambda Function
Resources:
callDetails:
Properties:
CodeUri: s3://TTTTTTTTTTTTT/CCCCCCCCC
Description: callDetails Lambda Function
Environment:
Variables:
REGION: ap-southeast-2
Handler: lambda_function.lambda_handler
MemorySize: 128
Role: arn:aws:iam::XXXXX:role/validationsLambdas
Runtime: python3.6
Timeout: 30
Type: AWS::Serverless::Function
Transform: AWS::Serverless-2016-10-31

最佳答案

就我而言,我有一些 yml 文件,其中的资源 block 为空,删除这些文件解决了问题。

关于aws-cloudformation - CloudFormation - SAM 模板的结构无效。 'Resources' 部分是必需的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51401403/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com