[アップデート] Amazon S3 Tables で 1 テーブルバケットあたり 10,000 テーブル/ネームスペースを作成できるようになりました

[アップデート] Amazon S3 Tables で 1 テーブルバケットあたり 10,000 テーブル/ネームスペースを作成できるようになりました

Amazon S3 Tables で 1 テーブルバケットあたり 10,000 テーブル/ネームスペースを作成できるようになりました。 と言うことは、 10,001 個目を作るしかありませんね!
Clock Icon2025.02.05

こんにちは!クラウド事業本部コンサルティング部のたかくに(@takakuni_)です。

Amazon S3 Tables で 1 テーブルバケットあたり 10,000 テーブル/ネームスペースを作成できるようになりました。嬉しいですね。

https://aws.amazon.com/jp/about-aws/whats-new/2025/01/amazon-s3-tables-10000-tables-bucket/

今まで

今まで S3 Tables は以下のクォーター制限がありました。

  1. リージョンあたりに作成可能なテーブルバケット数:10
  2. 1 テーブルバケットあたりに作成可能なネームスペースの数:100
  3. 1 テーブルバケットあたりに作成可能なテーブルの数:100

今回、次のように更新があり 10 テーブルバケットにまたがって最大 100,000 テーブルを作成できるようになりました。作成可能なネームスペースの数にもクォーターの引き上げが発生していますね。

  1. リージョンあたりに作成可能なテーブルバケット数:10
  2. 1 テーブルバケットあたりに作成可能なネームスペースの数:10,000
  3. 1 テーブルバケットあたりに作成可能なテーブルの数:10,000

https://docs.aws.amazon.com/ja_jp/AmazonS3/latest/userguide/s3-tables-regions-quotas.html#s3-tables-quotas

やってみた

それではネームスペース、テーブルを 10,000 個ずつ作成し、10,001 個目の挙動を確認してみましょう。今回は HashiCorp Terraform を利用しました。

ネームスペース

まずは count を利用して 10,000 個ネームスペースを作成します。

main.tf
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "5.85.0"
    }
  }
}

provider "aws" {
  region = "ap-northeast-1"
}

##################################################
# テーブルバケットの作成
##################################################
resource "aws_s3tables_table_bucket" "this" {
  name = "supports-ten-thousands-tables-per-tables-bucket"
}

##################################################
# テーブルバケットの作成
##################################################
resource "aws_s3tables_namespace" "this" {
  count            = 10000
  namespace        = "support_ten_thousands_ns_per_tables_bucket_${count.index}"
  table_bucket_arn = aws_s3tables_table_bucket.this.arn
}

せっかくなので time コマンドで作成時間を測ってみました。

time terraform apply --auto-approve

動いているのか確認したい場合は、都度 AWS CLI で確認しましょう。

~ $ aws s3tables list-namespaces   --table-bucket-arn arn:aws:s3tables:ap-northeast-1:123456789012:bucket/supports-ten-thousands-tables-per-tables-bucket --query=namespaces[*].namespace[0] | wc -l
5027

記録、 38 分でした!

Apply complete! Resources: 10001 added, 0 changed, 0 destroyed.
terraform apply --auto-approve  1117.94s user 78.19s system 51% cpu 38:46.96 total

ちなみに --parallelism=10000 でやると X 秒でした。

time terraform apply --auto-approve --parallelism=10000

10,001 個目を作成してみる

お待ちかねの 10,001 個目を作成してみます。

main.tf
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "5.85.0"
    }
  }
}

provider "aws" {
  region = "ap-northeast-1"
}

##################################################
# テーブルバケットの作成
##################################################
resource "aws_s3tables_table_bucket" "this" {
  name = "supports-ten-thousands-tables-per-tables-bucket"
}

##################################################
# テーブルバケットの作成
##################################################
resource "aws_s3tables_namespace" "this" {
+  count            = 10001
-  count            = 10000
  namespace        = "support_ten_thousands_ns_per_tables_bucket_${count.index}"
  table_bucket_arn = aws_s3tables_table_bucket.this.arn
}

BadRequestException: You have attempted to create more namespaces than are allowed for a bucket. が登場しました!クォーターの通り 10,000 より大きい場合は怒られましたね!

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # aws_s3tables_namespace.this[10000] will be created
  + resource "aws_s3tables_namespace" "this" {
      + created_at       = (known after apply)
      + created_by       = (known after apply)
      + namespace        = "support_ten_thousands_ns_per_tables_bucket_10000"
      + owner_account_id = (known after apply)
      + table_bucket_arn = "arn:aws:s3tables:ap-northeast-1:123456789012:bucket/supports-ten-thousands-tables-per-tables-bucket"
    }

Plan: 1 to add, 0 to change, 0 to destroy.
aws_s3tables_namespace.this[10000]: Creating...
╷
│ Error: creating Amazon S3 Tables Namespace ("support_ten_thousands_ns_per_tables_bucket_10000"): operation error S3Tables: CreateNamespace, https response error StatusCode: 400, RequestID: 56aa549a-3152-4a48-a624-990820e7ce9f, BadRequestException: You have attempted to create more namespaces than are allowed for a bucket.
│
│   with aws_s3tables_namespace.this[10000],
│   on main.tf line 21, in resource "aws_s3tables_namespace" "this":21: resource "aws_s3tables_namespace" "this" {
│
│ operation error S3Tables: CreateNamespace, https response error StatusCode: 400, RequestID: 56aa549a-3152-4a48-a624-990820e7ce9f, BadRequestException: You have
│ attempted to create more namespaces than are allowed for a bucket.

テーブル

続いて S3 Table の作成に移ります。キーや実行時間の関係でネームスペースは共通のものを利用しました。

main.tf
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "5.85.0"
    }
  }
}

provider "aws" {
  region = "ap-northeast-1"
}

##################################################
# テーブルバケットの作成
##################################################
resource "aws_s3tables_table_bucket" "this" {
  name = "supports-ten-thousands-tables-per-tables-bucket"
}

##################################################
# ネームスペースの作成
##################################################
resource "aws_s3tables_namespace" "this" {
  namespace        = "supports_ten_thousands_tables_per_tables_bucket"
  table_bucket_arn = aws_s3tables_table_bucket.this.arn
}

##################################################
# テーブルの作成
##################################################
resource "aws_s3tables_table" "this" {
  count = 10000

  name             = "supports_ten_thousands_tables_per_tables_bucket_${count.index}"
  namespace        = aws_s3tables_namespace.this.namespace
  table_bucket_arn = aws_s3tables_namespace.this.table_bucket_arn
  format           = "ICEBERG"
}

こちらも記録を計ってみます。

time terraform apply --auto-approve

記録、 でした!(一瞬スリープモードにしてしまったため 2 つ重複していました。)

│ Error: creating Amazon S3 Tables Table ("support_ten_thousands_table_7974"): operation error S3Tables: CreateTable, https response error StatusCode: 409, RequestID: 2eb58176-92ca-488d-8428-b2df04fd75bf, ConflictException: A table with an identical name already exists in the namespace.
│
│   with aws_s3tables_table.this[7974],
│   on main.tf line 32, in resource "aws_s3tables_table" "this":32: resource "aws_s3tables_table" "this" {
│
│ operation error S3Tables: CreateTable, https response error StatusCode: 409, RequestID: 2eb58176-92ca-488d-8428-b2df04fd75bf,
│ ConflictException: A table with an identical name already exists in the namespace.
╵
╷
│ Error: creating Amazon S3 Tables Table ("support_ten_thousands_table_6734"): operation error S3Tables: CreateTable, https response error StatusCode: 409, RequestID: 7d99fc3f-f1cd-44c8-8944-222134376bbc, ConflictException: A table with an identical name already exists in the namespace.
│
│   with aws_s3tables_table.this[6734],
│   on main.tf line 32, in resource "aws_s3tables_table" "this":32: resource "aws_s3tables_table" "this" {
│
│ operation error S3Tables: CreateTable, https response error StatusCode: 409, RequestID: 7d99fc3f-f1cd-44c8-8944-222134376bbc,
│ ConflictException: A table with an identical name already exists in the namespace.
╵
terraform apply --auto-approve  2137.44s user 109.86s system 78% cpu 47:34.57 total

AWS CLI で確認するとピッタリ 10,000 テーブル作成できていました。

~ $ aws s3tables list-tables --table-bucket-arn arn:aws:s3tables:ap-northeast-1:123456789012:bucket/hoge-bucket --namespace support_ten_thousands_ns_per_tables_bucket_01 --query 'length(tables[*].name)'
10000

10,001 個目を作成してみる

Terraform でズレが起こってしまったため。AWS CLI に変更します。こちらのブログを元に 10,001 個目の S3 Table を作成します。

https://dev.classmethod.jp/articles/amazon-s3-tables-table-management-cmd/#table%25E3%2581%25AE%25E4%25BD%259C%25E6%2588%2590

aws s3tables create-table \
   --table-bucket-arn arn:aws:s3tables:ap-northeast-1:123456789012:bucket/hoge-bucket \
   --namespace support_ten_thousands_ns_per_tables_bucket_01 \
   --name support_ten_thousands_ns_per_tables_bucket_01_10001 \
   --format ICEBERG

想定通り BadRequestException の when calling the CreateTable operation: You have attempted to create more tables than are allowed for a bucket. が発生しました!

~ $ aws s3tables create-table \
>    --table-bucket-arn arn:aws:s3tables:ap-northeast-1:123456789012:bucket/hoge-bucket \
>    --namespace support_ten_thousands_ns_per_tables_bucket_01 \
>    --name support_ten_thousands_ns_per_tables_bucket_01_10001 \
>    --format ICEBERG
An error occurred (BadRequestException) when calling the CreateTable operation: You have attempted to create more tables than are allowed for a bucket.
~ $

まとめ

以上、「Amazon S3 Tables で 1 テーブルバケットあたり 10,000 テーブル/ネームスペース作成できるようになりました」でした。

比較的新しい機能なので 10,000 テーブル使っている方はなかなか少ないですが、サチる前にこのような制限の引き上げがあるのは、とてもありがたいですね。

このブログがどなたかの参考になれば幸いです。クラウド事業本部コンサルティング部のたかくに(@takakuni_)でした!

Share this article

facebook logohatena logotwitter logo

© Classmethod, Inc. All rights reserved.