简体   繁体   English

无法使用云形成创建lambda function

[英]Unable to create lambda function using cloud formation

Error: Properties validation failed for resource autoTaggingLambda with message: #/Role: expected type: String, found: JSONArray错误:资源 autoTaggingLambda 的属性验证失败,消息为:#/Role:预期类型:String,找到:JSONArray

Code below:代码如下:

Resources:
autoTaggingLambda:
    
    Properties:
      Code:
        ZipFile: 
            "import json
             import boto3
             import logging
             import time
             from datetime import date" 

You can attach in-line multiline python script in your CloudFormation template using the |您可以使用 | 在 CloudFormation 模板中附加内嵌多行python脚本| Operator操作员

  autoTaggingLambda:
    Type: AWS::Lambda::Function
    Properties:
      .
      .
      .
      Code:
        ZipFile: !Sub |
          import boto3
          import json
          ec2 = boto3.client('ec2')
          def get_instance_ids():
          .
          .
          .

You can check the official docs for a sample implementation https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html您可以查看官方文档以获取示例实现https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用云形成模板将新环境变量添加到 Lambda - Add new environment variables to Lambda using Cloud Formation Template 使用 Babelfish 创建 Aurora 集群启用 Cloud Formation - Create Aurora Cluster with Babelfish enables using Cloud Formation 在 AWS Cloud Formation 模板中创建嵌套 If else - Create Nested If else in AWS Cloud Formation Template 通过云形成创建 SQS 策略失败 - SQS policy failed to create via cloud formation 无法删除 Cloud Formation 创建的 Lambda@Edge - Cannot delete Lambda@Edge created by Cloud Formation 从云形成中创建给定 EC2 的 AMI - Create AMI of a given EC2 from cloud formation Terraform 云应用 lambda function 失败并出现 ValidationException,AWS CLI lambda 具有相同参数的创建函数成功 - Terraform Cloud apply lambda function fails with ValidationException, AWS CLI lambda create-function with same parameters succeeds 根据请求计数使用云形成自动缩放 - Auto scaling using cloud formation according to Request count 如何为使用云形成创建的 SNS 主题获取 ARN? - How to get ARN for SNS Topic created using cloud formation? 如何在 AWS Lambda 触发器云形成模板中提供多个 SQS 队列名称 - how to provide multiple SQS queue name in AWS Lambda trigger cloud formation template
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM