簡體   English   中英

在 CloudFormation 中創建多個 QueueConfiguration

[英]Creating Multiple QueueConfigurations in CloudFormation

我目前正在嘗試將多個 QueueConfigurations 寫入我的 CloudFormation 模板。 每個都是一個 SQS 隊列,當 object 創建到指定前綴時觸發。 這是我到目前為止所擁有的:

{
    "Resources": {
      "S3Bucket": {
        "Type" : "AWS::S3::Bucket",
        "Properties" : 
          "BucketName" : { "Ref" : "paramBucketName" },
          "LoggingConfiguration" : {
            "DestinationBucketName" : "test-bucket",
            "LogFilePrefix" : { "Fn::Join": [ "", [ { "Ref": "paramBucketName" }, "/" ] ] }
          },
          "NotificationConfiguration" : {
              "QueueConfigurations" : [{
                "Id" : "1",
                "Event" : "s3:ObjectCreated:*",
                "Filter" : { 
                  "S3Key" : {
                    "Rules" : {
                      "Name" : "prefix",
                      "Value" : "folder1/"
                    }
                  }
                },
                "Queue" : "arn:aws:sqs:us-east-1:958262988361:interstate-cdc_feeder_prod_hvr_dev"
              }],   
              "QueueConfigurations" : [{
                "Id" : "2",
                "Event" : "s3:ObjectCreated:*",
                "Filter" : { 
                  "S3Key" : {
                    "Rules" : {
                      "Name" : "prefix",
                      "Value" : "folder2/"
                    }
                  }
                },
                "Queue" : "arn:aws:sqs:us-east-1:958262988361:interstate-latency_hvr_dev"
              }]
            }                               
          }          
        }
      }
    }
  }

我遇到了錯誤說Encountered unsupported property Id 我認為通過定義 ID,我將能夠避免Duplicate object key錯誤。

有誰知道如何在單個 CloudFormation 模板中創建多個觸發器? 我在這里先向您的幫助表示感謝。

它的結構應該如下所示,應該只有一個QueueConfigurations屬性,其中包含所有隊列配置。 此外, Id參數不是有效屬性。

{
    "Resources": {
      "S3Bucket": {
        "Type" : "AWS::S3::Bucket",
        "Properties" : 
          "BucketName" : { "Ref" : "paramBucketName" },
          "LoggingConfiguration" : {
            "DestinationBucketName" : "test-bucket",
            "LogFilePrefix" : { "Fn::Join": [ "", [ { "Ref": "paramBucketName" }, "/" ] ] }
          },
          "NotificationConfiguration" : {
              "QueueConfigurations" : [{
                "Event" : "s3:ObjectCreated:*",
                "Filter" : { 
                  "S3Key" : {
                    "Rules" : {
                      "Name" : "prefix",
                      "Value" : "folder1/"
                    }
                  }
                },
                "Queue" : "arn:aws:sqs:us-east-1:958262988361:interstate-cdc_feeder_prod_hvr_dev"
              },
              {
                "Event" : "s3:ObjectCreated:*",
                "Filter" : { 
                  "S3Key" : {
                    "Rules" : {
                      "Name" : "prefix",
                      "Value" : "folder2/"
                    }
                  }
                },
                "Queue" : "arn:aws:sqs:us-east-1:958262988361:interstate-latency_hvr_dev"
              }]
            }                               
          }          
        }
      }
    }
  }

文檔中有更多關於QueueConfiguration的信息。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM