gpt4 book ai didi

amazon-web-services - AWS IoT 1 Click 项目 SAM - 400 InvalidRequestException 错误

转载 作者:行者123 更新时间:2023-12-03 07:24:08 26 4
gpt4 key购买 nike

您好,我正在使用 AWS SAM 部署一个也依赖于 1Click 设备的无服务器应用程序,我的模板部署正常,但我必须排除此值:

CallbackOverrides:
onClickCallback:

这是模板文件

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: securitybutton
Globals:
Function:
Timeout: 10
Resources:
SecurityButtonFunction:
Type: AWS::Serverless::Function
Policies:
- AmazonSNSFullAccess
Properties:
CodeUri: src
Handler: index.lambdaHandler,
Runtime: nodejs12.x
MemorySize: 512
Events:
IoTRule:
Type: IoTRule
Properties:
Sql: SELECT * FROM 'iotbutton/*'
#TOPICS
BRSecurityButtonTopic:
Type: AWS::SNS::Topic

#IoT
#project
BRSecurityButtonProject:
Type: "AWS::IoT1Click::Project"
Properties:
ProjectName: "BRSecurityButton"
Description: "BRSecurityButton"
PlacementTemplate:
DefaultAttributes:
SNSTopic: Changeme
Location: Changeme
Theatre: Changeme
DeviceTemplates:
SecuityButtonTemplate:
DeviceType: "button"
CallbackOverrides:
onClickCallback: !GetAtt
- SecurityButtonFunction
- Arn
Outputs:
SecurityButtonFunction:
Description: "Security Button Lambda Function ARN"
Value: !GetAtt SecurityButtonFunction.Arn

这是生成的 cloudFormation 错误:

Lambda functionarn:aws:lambda:us-east-1:LALALALALALA:function:securitybutton-prod-SecurityButtonFunction-6OB47JEIU192cannot be invoked. (Service: AWSIoT1ClickProjects; Status Code: 400;Error Code: InvalidRequestException; Request ID:f0e94cd5-0310-4dcf-8d4a-a5ee8b102590; Proxy: null)

BRSecurityButtonProject 的逻辑 ID

如有任何帮助,我们将不胜感激

最佳答案

我发现该问题与 IAM 有关。将此添加到 SAM 模板,该模板为帐户中的任何 IoT 一键式项目授予访问权限以调用 Lambda 函数。

  SecurityButtonFunctionIoTPermission:
Type: AWS::Lambda::Permission
Properties:
FunctionName: !GetAtt SecurityButtonFunction.Arn
Action: lambda:InvokeFunction
Principal: iot1click.amazonaws.com
SourceAccount: !Ref "AWS::AccountId"

关于amazon-web-services - AWS IoT 1 Click 项目 SAM - 400 InvalidRequestException 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63291754/

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