使用建立 Amazon SQS 佇列 AWS CloudFormation - Amazon Simple Queue Service

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

使用建立 Amazon SQS 佇列 AWS CloudFormation

您可以使用 AWS CloudFormation 主控台和 JSON (或 YAML) 範本建立 Amazon SQS 佇列。若要取得更多資訊,請參閱《使用指南》中的〈AWS CloudFormation 使用 AWS CloudFormation 範本與AWS::SQS::Queue資源

用於 AWS CloudFormation 建立 Amazon SQS 佇列。
  1. 將下列 JSON 程式碼複製到名為 MyQueue.json 的檔案。若要建立標準佇列,請省略 FifoQueueContentBasedDeduplication 屬性。如需內容型重複資料刪除功能的相關資訊,請參閱在 Amazon 中實際處理一次 SQS

    注意

    FIFO 佇列名稱結尾必須是 .fifo 尾碼。

    { "AWSTemplateFormatVersion": "2010-09-09", "Resources": { "MyQueue": { "Properties": { "QueueName": "MyQueue.fifo", "FifoQueue": true, "ContentBasedDeduplication": true }, "Type": "AWS::SQS::Queue" } }, "Outputs": { "QueueName": { "Description": "The name of the queue", "Value": { "Fn::GetAtt": [ "MyQueue", "QueueName" ] } }, "QueueURL": { "Description": "The URL of the queue", "Value": { "Ref": "MyQueue" } }, "QueueARN": { "Description": "The ARN of the queue", "Value": { "Fn::GetAtt": [ "MyQueue", "Arn" ] } } } }
  2. 登入 AWS CloudFormation 主控台,然後選擇 Create Stack (建立堆疊)

  3. Specify Template (指定範本) 面板中,選擇 Upload a template file (上傳範本檔案)​、選擇您的 MyQueue.json 檔案,然後選擇 Next (下一步)

  4. Specify Details (指定詳細資訊) 頁面,為 MyQueueStack Name (堆疊名稱) 輸入 ,然後選擇 Next (下一步)。

  5. Options (選項) 頁面上,選擇 Next (下一步)。

  6. Review (檢閱) 頁面上,選擇 Create (建立)。

    AWS CloudFormation 開始建立MyQueue堆疊並顯示「建立中 _ 進度」狀態。程序完成後, AWS CloudFormation 會顯示 CREATE_COMPLETE 狀態。

    顯示「建立 _ 完成」狀態的 AWS CloudFormation 控制台。
  7. (選用) 如果要顯示佇列的名稱、URL 和 ARN,請選擇堆疊的名稱,然後在下一頁展開 Outputs (輸出) 部分。