Boto 3の勉強 その2

今日はこれ
処理としては…

  • SQSのキューを作成する。
  • 作成したキューの属性を表示する
import boto3

sqs = boto3.resource("sqs")

queue = sqs.create_queue(
    QueueName="test-queue-20220301", Attributes={"DelaySeconds": "5"}
)

print(queue.url)
print(queue.attributes.get("DelaySeconds"))

実行結果はこちら

% python sample-sqs.py
https://ap-northeast-1.queue.amazonaws.com/{AWSアカウントID}/test-queue-20220301
5

また、コード実行後には、マネジメントコンソールからも作成したキューが確認できる。

f:id:n_ak:20220301212019p:plain
SQS_キュー作成