Registry / aws / dynamodb-encryption-sdk

dynamodb-encryption-sdk

JSON →
library3.3.0pypypi✓ verified 88d ago

Client-side encryption library for Amazon DynamoDB that encrypts attribute values before storing them. Current version 3.3.0 (Aug 2024), Python 3.8+ required. Released by AWS, follows semantic versioning.

pip install dynamodb-encryption-sdk
INSTALL
IMPORT
SIG · DYNAMODB-ENCRYPTIO
D
dynamodb-encryption-sdk
awspythonv3.3.0
Install
4.6s avg
Import
—
Disk
68MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v3.3.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 68.8MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 4.6s · import 0.000s · 69MB
68MB installed
● package 68MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

EncryptedTable
✓ from dynamodb_encryption_sdk import EncryptedTable
✗ from dynamodb_encryption_sdk import CryptoConfig
EncryptedClient
✓ from dynamodb_encryption_sdk import EncryptedClient
EncryptedResource
✓ from dynamodb_encryption_sdk import EncryptedResource

Demonstrates encrypting and decrypting an item using AWS KMS CMP.

import boto3 from dynamodb_encryption_sdk import CryptoConfig, CryptoActions from dynamodb_encryption_sdk.material_providers.aws_kms import AwsKmsCryptographicMaterialsProvider from dynamodb_encryption_sdk.structures import TableInfo kms_cmk_id = 'arn:aws:kms:us-east-1:123456789012:key/abc123' key_provider = AwsKmsCryptographicMaterialsProvider(key_id=kms_cmk_id) table_info = TableInfo(name='my_table') config = CryptoConfig(materials_provider=key_provider, crypto_actions=CryptoActions.DO_NOTHING) client = boto3.client('dynamodb') # Encrypt an item before put_item plaintext_item = {'pk': {'S': 'test'}, 'data': {'S': 'secret'}} encrypted_item = config.encrypt_item(plaintext_item) client.put_item(TableName='my_table', Item=encrypted_item) # Decrypt on get response = client.get_item(TableName='my_table', Key={'pk': {'S': 'test'}}) decrypted_item = config.decrypt_item(response['Item']) print(decrypted_item['data']['S'])
Debug
Known issues
breakingVersion 3.x drops Python 2, 3.4, 3.5, 3.6, and 3.7. Only Python 3.8+ supported. Use Python 3.8 or later.
fix
Upgrade Python to 3.8+ and use dynamodb-encryption-sdk>=3.0.0.
affects: 3.0.0+
breakingMostRecentProvider removed in v2.0.0. Replaced by CachingMostRecentProvider in v1.3.0, then removed entirely.
fix
Use CachingMostRecentProvider from dynamodb_encryption_sdk.material_providers.caching.
affects: 2.0.0+
deprecatedPython 3.7 support deprecated in v3.3.0 and may be removed in future.
fix
Upgrade Python to 3.8+.
affects: 3.3.0+
gotchaAwsKmsCryptographicMaterialsProvider uses boto3 sessions; reusing a custom session can cause client conflicts if the same session is modified elsewhere.
fix
Pass a fresh botocore session or use the default session. Avoid sharing the same session across multiple material providers.
affects: all
gotchaDo not reuse encryption config across different table structures. TableInfo includes table schema metadata that must match the actual table.
fix
Create a new TableInfo and CryptoConfig per table, or use the table's schema from DynamoDB.
affects: all
Upgrade
Version history
3.3.0latest on PyPI · released Aug 7, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
19 hits · last 30 days
node
17
OpenAI (training)
1
Resources
dynamodb-encryption-sdk — pip install dynamodb-encryption-sdk · libregistry