0

このtutorialに続いて、S3へのアップロード時に呼び出され、DynamoDBに移入するAWSラムダ関数を設定しました。AWS SAM - リソース間の循環的なエラー

私はAWS SAMと同じことを達成しようとしています。そのためには、構成情報でtemplate.yamlファイルを定義する必要があります。私はCloudformationで展開する場合、このエラーを取得しておく -

Failed to create the changeset: Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state Status: FAILED. Reason: Circular dependency between resources: [LambdaPerm] 

私はデバッグに苦労してるので、私はこの上の多くの情報を見つけることができませんでした。このエラーの原因は何ですか?これをどのように解決できますか?ここに私のテンプレートの設定だ -

AWSTemplateFormatVersion: '2010-09-09' 
Transform: AWS::Serverless-2016-10-31 
Resources: 
    Gradebook: 
    Type: AWS::Serverless::Function 
    Properties: 
     FunctionName: LambdaGradebookServerless 
     Handler: serverless.LambdaGradebook 
     Runtime: java8 
     CodeUri: ./target/serverless-0.0.1-SNAPSHOT.jar 
     Role: arn:aws:iam::xxxxxxxxxxxx:role/lambda-s3-execution-role 
    LambdaPerm: 
    Type: AWS::Lambda::Permission 
    Properties: 
     Action: lambda:InvokeFunction 
     FunctionName: 
     Ref: Gradebook 
     Principal: s3.amazonaws.com 
     SourceAccount: 
     Ref: AWS::xxxxxxxxxxxx 
     SourceArn: 
     Fn::Join: 
     - ':' 
     - - arn 
      - aws 
      - s3 
      - '' 
      - '' 
      - Ref: gradebookBucket 
    gradebookBucket: 
    Type: AWS::S3::Bucket 
    Properties: 
     Bucket: gradebook-lambda 
     NotificationConfiguration: 
     LambdaConfigurations: 
     - Event: s3:ObjectCreated:* 
      Function: 
      Ref: Gradebook 
+1

BTW:アカウントIDをハードコードするのではなく、!Ref "AWS :: AccountId"を使用することができます。あなたの循環依存の原因ではありません。 –

答えて

1

その後、S3 notification configurationでスタックを更新し、独立してS3バケットとラムダ関数を作成し、この循環依存を避けるために。

0

循環依存性エラーが発生し、CloudFormationテンプレートのリソースから参照していたパラメータが欠落していることが判明しました。

関連する問題