View a markdown version of this page

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

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

使用 建立 Amazon SQS 佇列 CloudFormation

使用 CloudFormation 主控台搭配 JSON 或 YAML 範本來建立 Amazon SQS 佇列。如需詳細資訊,請參閱AWS CloudFormation 《 使用者指南AWS::SQS::Queue》中的使用 CloudFormation 範本和資源。

使用 CloudFormation 建立 Amazon SQS 佇列。
  1. 將下列 JSON 程式碼複製到名為 MyQueue.json 的檔案。若要建立標準佇列,請省略 FifoQueue 和 ContentBasedDeduplication 屬性。如需內容型重複資料刪除功能的相關資訊,請參閱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. 登入 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 (建立)。

    CloudFormation 開始建立MyQueue堆疊,並顯示 CREATE_IN_PROGRESS 狀態。程序完成後, CloudFormation 會顯示 CREATE_COMPLETE 狀態。

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