【问题标题】:I am getting error while executing aws cloudformation template,throwing error ROLLBACK_COMPLETE我在执行 aws cloudformation 模板时遇到错误,抛出错误 ROLLBACK_COMPLETE
【发布时间】:2020-02-06 18:08:33
【问题描述】:
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: "Template to set up Kinesis stream, Lambda functions, S3 bucket, DynamoDB table and related IAM roles for AWS Lambda Real-time Stream Processing Reference Architecture. PLEASE NOTE: The CloudFormation Stack Name must be all lowercase as it is used as part of the S3 bucket name. Otherwise the stack creation will fail."
Parameters: 
  LambdaS3Bucket: 
    Type: String
    Default: awslambda-reference-architectures
    Description: Name of S3 bucket where Lambda function packages are stored.
  LambdaDDBEventProcessorS3Key:
    Type : String
    Default : stream-processing/ddb_eventprocessor.zip
    Description : Name of S3 key for Zip with Stream Processing DynamoDB Event Processor Lambda function package.
  LambdaDDBEventProcessorHandler:
    Type : String
    Default : ddb_eventprocessor.handler
    Description : Name of handler for Stream Processing DynamoDB Event Processor Lambda function.
Resources:
  EventStream:
    Type: 'AWS::Kinesis::Stream'
    Properties:
      ShardCount: 1
  DDBEventProcessor:
    Type: 'AWS::Serverless::Function'
    Properties:
      Description: Stream Processing DDB Event Processor
      Handler: !Ref LambdaDDBEventProcessorHandler
      MemorySize: 128
      Role: !GetAtt 
        - EventProcessorExecutionRole
        - Arn
      Timeout: 10
      Runtime: nodejs6.10
      CodeUri:
        Bucket: !Ref LambdaS3Bucket
        Key: !Ref LambdaDDBEventProcessorS3Key
      Events:
        Stream:
          Type: Kinesis
          Properties:
            Stream: !GetAtt EventStream.Arn
            StartingPosition: TRIM_HORIZON
            BatchSize: 25
  EventDataTable:
    Type: 'AWS::DynamoDB::Table'
    Properties:
      AttributeDefinitions:
        - AttributeName: Username
          AttributeType: S
        - AttributeName: Id
          AttributeType: S
      KeySchema:
        - AttributeName: Username
          KeyType: HASH
        - AttributeName: Id
          KeyType: RANGE
      ProvisionedThroughput:
        ReadCapacityUnits: '1'
        WriteCapacityUnits: '1'
      TableName: !Join 
        - ''
        - - !Ref 'AWS::StackName'
          - '-EventData'
  EventProcessorExecutionRole:
    Type: 'AWS::IAM::Role'
    Properties:
      AssumeRolePolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Principal:
              Service:
                - lambda.amazonaws.com
            Action:
              - 'sts:AssumeRole'
      Path: /
      Policies:
        - PolicyName: EventProcessorExecutionPolicy
          PolicyDocument:
            Version: 2012-10-17
            Statement:
              - Effect: Allow
                Action:
                  - 'logs:*'
                Resource: 'arn:aws:logs:*:*:*'
              - Effect: Allow
                Action:
                  - 'dynamodb:BatchWriteItem'
                Resource: !Join 
                  - ''
                  - - 'arn:aws:dynamodb:'
                    - !Ref 'AWS::Region'
                    - ':'
                    - !Ref 'AWS::AccountId'
                    - ':table/'
                    - !Ref 'AWS::StackName'
                    - '-EventData'
      ManagedPolicyArns:
        - 'arn:aws:iam::aws:policy/service-role/AWSLambdaKinesisExecutionRole'
  streamprocessingclient:
    Type: 'AWS::IAM::User'
  ClientPolicy:
    Type: 'AWS::IAM::Policy'
    Properties:
      PolicyName: StreamProcessingClientPolicy
      PolicyDocument:
        Statement:
          - Effect: Allow
            Action:
              - 'kinesis:Put*'
            Resource: !Join 
              - ''
              - - 'arn:aws:kinesis:'
                - !Ref 'AWS::Region'
                - ':'
                - !Ref 'AWS::AccountId'
                - ':stream/'
                - !Ref EventStream
      Users:
        - !Ref streamprocessingclient
  ClientKeys:
    Type: 'AWS::IAM::AccessKey'
    Properties:
      UserName: !Ref streamprocessingclient
Outputs:
  AccessKeyId:
    Value: !Ref ClientKeys
    Description: AWS Access Key Id of stream processing client user
  SecretAccessKey:
    Value: !GetAtt 
      - ClientKeys
      - SecretAccessKey
    Description: AWS Secret Key of stream processing client user
  KinesisStream:
    Value: !Ref EventStream
    Description: The Kinesis stream used for ingestion.
  Region:
    Value: !Ref 'AWS::Region'
    Description: The region this template was launched in.

嗨,这是我的 cloudformation 模板,应该 创建 Kinesis Stream

创建一个名为 -EventData 的 DynamoDB 表

创建从 Kinesis 接收记录并将记录写入 DynamoDB 表的 Lambda 函数 1 (-DDBEventProcessor)

创建 IAM 角色和策略以允许事件处理 Lambda 函数从 Kinesis Stream 读取并写入 DynamoDB 表

创建一个 IAM 用户,该用户有权将事件与凭据一起放入 Kinesis 流中,供用户在 API 客户端中使用

但我收到错误,ROllBACK_COMPLETE,如果需要任何更改,请建议我。提前谢谢。

【问题讨论】:

  • 您的堆栈创建失败。看看这些事件,它会告诉你失败的原因以及(希望)为什么。
  • 请在此处添加Events 输出,以便我们查看实际原因。可以通过选择此堆栈在 AWS CloudFormation 控制台上找到它。
  • GetObject 发生错误。 S3 错误代码:NoSuchKey。 S3 错误消息:指定的密钥不存在。 (服务:AWSLambdaInternal;状态代码:400;错误代码:InvalidParameterValueException;请求 ID:4e5fcaff-df10-402c-a6c6-b1c69d1c19a7)。我的存储桶名称是流处理

标签: amazon-web-services aws-lambda amazon-dynamodb amazon-cloudformation amazon-kinesis


【解决方案1】:

cfn-lint 警告:

E2531: Deprecated runtime (nodejs6.10) specified. Updating disabled since 2019-06-30, please consider to update to nodejs10.x

【讨论】:

  • 您好,我在更改为 nodejs10.x 后也遇到了同样的错误
  • 你能在Events标签中找到第一个CREATE_FAILED/UPDATE_FAILED事件吗?
  • GetObject 发生错误。 S3 错误代码:NoSuchKey。 S3 错误消息:指定的密钥不存在。 (服务:AWSLambdaInternal;状态代码:400;错误代码:InvalidParameterValueException;请求 ID:4e5fcaff-df10-402c-a6c6-b1c69d1c19a7)
猜你喜欢
  • 1970-01-01
  • 2021-05-24
  • 1970-01-01
  • 2018-08-28
  • 2017-04-05
  • 1970-01-01
  • 2017-08-13
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多