This section features examples that show you how to use the AWS DynamoDB Encryption Client. We demonstrate how to use the encryption and decryption APIs and how to set up some common configuration patterns.
The AWS DynamoDB Encryption Client provides four high-level APIs: EncryptedClient, EncryptedItem, EncryptedResource, and EncryptedTable.
You can find examples that demonstrate these APIs in the examples/src/dynamodb_encryption_sdk_examples directory. Each of these examples uses AWS KMS as the materials provider.
- How to use the EncryptedClient API
- How to use the EncryptedItem API
- How to use the EncryptedResource API
- How to use the EncryptedTable API
To use the encryption and decryption APIs, you need to describe how you want the library to protect your data keys. You can do this by configuring material providers. AWS KMS is the most common material provider used with the AWS DynamoDB Encryption SDK, and each of the API examples above uses AWS KMS. This section describes the other providers that come bundled with this library.
- How to use the CachingMostRecentProvider
- How to use raw symmetric wrapping keys
- How to use raw asymmetric wrapping keys
For more details on the different type of material providers, see How to choose a cryptographic materials provider.
In order to run these examples, these things must be configured:
- Ensure that AWS credentials are available in one of the automatically discoverable credential locations.
- The
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID
environment variable must be set to a valid AWS KMS CMK ARN that can be used by the available credentials. - The
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID
andAWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID_2
environment variables must be set to two related AWS KMS Multi-Region key ids in different regions. - The
DDB_ENCRYPTION_CLIENT_TEST_TABLE_NAME
environment variable must be set to a valid DynamoDB table name, in the default region, to which the discoverable credentials have read, write, and describe permissions.