Skip to main content

No project description provided

Project description

ddb_exporter

ddb_exporter は、AWS DynamoDBのテーブル操作およびデータエクスポートを簡単に行うためのコマンドラインツールです。

インストール

ddb_exporter をインストールするには、以下のコマンドを実行してください:

pip install click boto3

次に、スクリプトファイルを実行可能にして、適切なディレクトリに配置します。

使い方

ddb_exporter コマンドは、AWSのDynamoDBサービスにアクセスして操作を行うためのサブコマンドを提供します。以下に各サブコマンドの詳細を示します。

共通オプション

  • --aws-profile (オプション): 使用するAWSプロファイル名。指定がない場合、デフォルトプロファイルまたは環境変数で設定された認証情報が使用されます。

サブコマンド

list-tables

指定したリージョンのDynamoDBテーブルを一覧表示します。

ddb_exporter list-tables --region <region> [--detail]
  • --region (オプション): AWSリージョン。デフォルトは us-east-1 です。
  • --detail (オプション): テーブルのスキーマ情報も含めて表示します。

export-table

指定したDynamoDBテーブルのデータをJSONファイルにエクスポートします。

ddb_exporter export-table --region <region> --table <table_name> [--output <output_file>] [--overwrite] [--partition-key <key>] [--sort-key <key>] [--sort-key-range <start,end>] [--index-name <index_name>] [--index-partition-key <key>] [--index-sort-key <key>]
  • --region (オプション): AWSリージョン。デフォルトは us-east-1 です。
  • --table (必須): エクスポートするDynamoDBテーブル名。
  • --output (オプション): 出力先のJSONファイルパス。指定がない場合は テーブル名_タイムスタンプ.json 形式で生成されます。
  • --overwrite (オプション): 出力ファイルが既に存在する場合に上書きします。
  • --partition-key (オプション): パーティションキーでデータをフィルタリングします。
  • --sort-key (オプション): ソートキーでデータをフィルタリングします。
  • --sort-key-range (オプション): ソートキーの範囲条件でデータをフィルタリングします(フォーマット: start,end)。
  • --index-name (オプション): セカンダリインデックス名。
  • --index-partition-key (オプション): セカンダリインデックスのパーティションキーでデータをフィルタリングします。
  • --index-sort-key (オプション): セカンダリインデックスのソートキーでデータをフィルタリングします。

認証情報の設定

AWSの認証情報は、以下の方法で設定できます:

  1. AWS CLIでプロファイルを設定する。
    aws configure --profile <profile_name>
    
  2. 環境変数を設定する。
    export AWS_ACCESS_KEY_ID=<your_access_key_id>
    export AWS_SECRET_ACCESS_KEY=<your_secret_access_key>
    export AWS_SESSION_TOKEN=<your_session_token>  # 必要な場合
    

エラー処理

認証情報が見つからない場合や認証に失敗した場合、以下のエラーメッセージが表示されます:

AWS credentials not found. Please configure your credentials or specify a profile.

また、DynamoDB操作に失敗した場合、適切なエラーメッセージが表示されます。

ライセンス

このプロジェクトはMITライセンスの下で公開されています。詳細については LICENSE ファイルを参照してください。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ddb_exporter-0.1.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ddb_exporter-0.1.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file ddb_exporter-0.1.0.tar.gz.

File metadata

  • Download URL: ddb_exporter-0.1.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.1 Windows/10

File hashes

Hashes for ddb_exporter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 63d36dd7ccdf4e97c15da39c101b249335ee7493e5fda9b01495ba8338c928da
MD5 ce3fd3ae321f9d53dd131833c38215bf
BLAKE2b-256 00a4ac8b561ea9108e5135edc2e8f4c60877c8d7e760285238852e62b7ff559f

See more details on using hashes here.

File details

Details for the file ddb_exporter-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ddb_exporter-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.1 Windows/10

File hashes

Hashes for ddb_exporter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 21ef94d057cfbb4bcb65b44ed6d9133dc08e292aac57c54f006bdc72ee28472c
MD5 c844352867d412fc4330bc71e5c69b89
BLAKE2b-256 6a7fa2fa2bdc27514ea602874763c506454123ffe9403856ad79b5e51d22a090

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page