【问题标题】:Invalid resource configuration error while creating AWS IoT Certificate using serverless framework使用无服务器框架创建 AWS IoT 证书时出现无效资源配置错误
【发布时间】:2020-12-09 14:11:33
【问题描述】:

我正在尝试使用无服务器框架创建 AWS IoT 事物。以下是我的 YAML 文件。

我收到“操作‘无效的证书资源配置’时发生错误..”。

任何线索可能是什么问题?


service: winds-delivery-infra

provider:
  name: aws
  runtime: nodejs12.x
  stage: dev
  region: ap-south-1

functions:
  hello:
    handler: handler.hello

resources:
  Resources:
    IoTThing:
      Type: AWS::IoT::Thing
    IoTPolicy:
      Type: AWS::IoT::Policy
      Properties: 
        PolicyDocument:
          Version: "2012-10-17"
          Statement:
            - Effect: Allow
              Action: ["iot:Connect"]
              Resource: "*"
            - Effect: "Allow"
              Action: ["iot:Publish","iot:Subscribe","iot:Receive"]
              Resource: "*"
    IoTCertificate:
      Type: AWS::IoT::Certificate
      Properties:
        Status: "ACTIVE"
    PolicyPrincipalAttachmentCert:
      Type: AWS::IoT::PolicyPrincipalAttachment
      Properties:
        PolicyName:
          Ref: IoTPolicy
        Principal: { Fn::GetAtt: [IoTCertificate, Arn] }

【问题讨论】:

  • 该错误消息中是否还有更多字词?如果是这样,他们可能会很有帮助
  • 没有有用的错误信息。这就是我被卡住的原因。

标签: amazon-cloudformation serverless-framework aws-iot


【解决方案1】:

如果您希望 AWS CloudFormation 为您颁发 IoT 证书,您需要告诉它您自己的 CSR(证书签名请求)。例如,您可以使用openssl 为您生成 CSR:

openssl req -newkey rsa:2048 -keyout PRIVATEKEY.key -out MYCSR.csr

获得 CSR 后,您可以使用它更新 CloudFormation,如下所示,它将起作用:

    IoTCertificate:
      Type: AWS::IoT::Certificate
      Properties:
        Status: "ACTIVE"
        CertificateSigningRequest: "-----BEGIN CERTIFICATE REQUEST-----\nMIIE0DCCArgCAQAwg......uOQIKNqgCxzmqy\n-----END CERTIFICATE REQUEST-----\n"

【讨论】:

    猜你喜欢
    • 2019-02-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-05
    • 2017-09-30
    • 2022-08-07
    • 2021-01-19
    • 2021-05-12
    相关资源
    最近更新 更多