Skip to content

Commit dbb6541

Browse files
committed
migration examples for client
1 parent 4da7006 commit dbb6541

File tree

16 files changed

+63
-43
lines changed

16 files changed

+63
-43
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
"""Stub to allow relative imports of examples from tests."""

Examples/runtimes/python/Migration/src/ddbec_to_awsdbe/awsdbe/common.py renamed to Examples/runtimes/python/Migration/src/ddbec_to_awsdbe/awsdbe/client/common.py

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,11 @@
2626

2727
def setup_pure_awsdbe_client(kms_key_id: str, ddb_table_name: str):
2828
"""
29-
Set up a pure AWS Database Encryption SDK client without legacy override.
30-
31-
Args:
32-
kms_key_id: The ARN of the KMS key to use for encryption
33-
ddb_table_name: The name of the DynamoDB table
34-
35-
Returns:
36-
Encrypted table client for DynamoDB
29+
Set up a pure AWS Database Encryption SDK EncryptedClient without legacy override.
3730
31+
:param kms_key_id: The ARN of the KMS key to use for encryption
32+
:param ddb_table_name: The name of the DynamoDB table
33+
:returns EncryptedClient for DynamoDB
3834
"""
3935
# 1. Create a Keyring. This Keyring will be responsible for protecting the data keys that protect your data.
4036
# For this example, we will create a AWS KMS Keyring with the AWS KMS Key we want to use.
@@ -122,15 +118,12 @@ def setup_pure_awsdbe_client(kms_key_id: str, ddb_table_name: str):
122118

123119
def setup_awsdbe_client_with_legacy_override(kms_key_id: str, ddb_table_name: str, policy: str):
124120
"""
125-
Set up an AWS Database Encryption SDK client with legacy override.
126-
127-
Args:
128-
kms_key_id: The ARN of the KMS key to use for encryption
129-
ddb_table_name: The name of the DynamoDB table
130-
policy: The policy required for the Legacy Override configuration
121+
Set up an AWS Database Encryption SDK EncryptedClient with legacy override.
131122
132-
Returns:
133-
Encrypted table client for DynamoDB
123+
:param kms_key_id: The ARN of the KMS key to use for encryption
124+
:param ddb_table_name: The name of the DynamoDB table
125+
:param policy: The policy required for the Legacy Override configuration
126+
:returns EncryptedClient for DynamoDB
134127
135128
"""
136129
# 0. Create AWS SDK DynamoDB Client

Examples/runtimes/python/Migration/src/ddbec_to_awsdbe/awsdbe/migration_step_1.py renamed to Examples/runtimes/python/Migration/src/ddbec_to_awsdbe/awsdbe/client/migration_step_1.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
77
This is an example demonstrating how to start using the
88
AWS Database Encryption SDK with a pre-existing table used with DynamoDB Encryption Client.
9-
In this example, you configure a DynamoDb Encryption Interceptor to do the following:
9+
In this example, you configure a EncryptedClient to do the following:
1010
- Read items encrypted in the old format
1111
- Continue to encrypt items in the old format on write
1212
- Read items encrypted in the new format
@@ -31,10 +31,9 @@ def migration_step_1(kms_key_id: str, ddb_table_name: str, sort_read_value: int
3131
"""
3232
Migration Step 1: Using the AWS Database Encryption SDK with Legacy Override.
3333
34-
Args:
35-
kms_key_id: The ARN of the KMS key to use for encryption
36-
ddb_table_name: The name of the DynamoDB table
37-
sort_read_value: The sort key value to read
34+
:param kms_key_id: The ARN of the KMS key to use for encryption
35+
:param ddb_table_name: The name of the DynamoDB table
36+
:param sort_read_value: The sort key value to read
3837
3938
"""
4039
# 1. Create a DynamoDB Encryption SDK client with legacy override.

Examples/runtimes/python/Migration/src/ddbec_to_awsdbe/awsdbe/migration_step_2.py renamed to Examples/runtimes/python/Migration/src/ddbec_to_awsdbe/awsdbe/client/migration_step_2.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,9 @@ def migration_step_2(kms_key_id: str, ddb_table_name: str, sort_read_value: int
3131
"""
3232
Migration Step 2: Using pure AWS DBESDK and legacy override together.
3333
34-
Args:
35-
kms_key_id: The ARN of the KMS key to use for encryption
36-
ddb_table_name: The name of the DynamoDB table
37-
sort_read_value: The sort key value to read
34+
:param kms_key_id: The ARN of the KMS key to use for encryption
35+
:param ddb_table_name: The name of the DynamoDB table
36+
:param sort_read_value: The sort key value to read
3837
3938
"""
4039
# 1. Create a DynamoDB Encryption SDK client with legacy override.

Examples/runtimes/python/Migration/src/ddbec_to_awsdbe/awsdbe/migration_step_3.py renamed to Examples/runtimes/python/Migration/src/ddbec_to_awsdbe/awsdbe/client/migration_step_3.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,9 @@ def migration_step_3(kms_key_id: str, ddb_table_name: str, sort_read_value: int
2727
"""
2828
Migration Step 3: Using only pure AWS DBESDK (no legacy override).
2929
30-
Args:
31-
kms_key_id: The ARN of the KMS key to use for encryption
32-
ddb_table_name: The name of the DynamoDB table
33-
sort_read_value: The sort key value to read
34-
30+
:param kms_key_id: The ARN of the KMS key to use for encryption
31+
:param ddb_table_name: The name of the DynamoDB table
32+
:param sort_read_value: The sort key value to read
3533
"""
3634
# 1. Create the DynamoDb Encryption Interceptor with the above configuration.
3735
# Do not configure any legacy behavior.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
"""Stub to allow relative imports of examples from tests."""
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Step 0
2+
3+
In Step 0, your system is in the starting state using the legacy DynamoDB Encryption Client:
4+
5+
- reads items in the old format using the DynamoDB Encryption Client
6+
- writes items in the old format using the DynamoDB Encryption Client
7+
- cannot read items in the new AWS Database Encryption SDK format
8+
9+
This represents the baseline configuration before beginning the migration process.
10+
Your dataset consists only of data written in the old format.
11+
12+
When operating in this state, your system is fully dependent on the legacy DynamoDB Encryption Client library
13+
and its associated encryption format.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
"""Stub to allow relative imports of examples from tests."""

Examples/runtimes/python/Migration/src/ddbec_to_awsdbe/ddbec/migration_step_0.py renamed to Examples/runtimes/python/Migration/src/ddbec_to_awsdbe/ddbec/client/migration_step_0.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
77
This is an example demonstrating use with the DynamoDb Encryption Client.
88
and is the starting state for our migration to the AWS Database Encryption SDK for DynamoDb.
9-
In this example we configure a DynamoDBMapper configured to encrypt and decrypt
9+
In this example we configure an AWS SDK Client configured to encrypt and decrypt
1010
items. The encryption and decryption of data is configured to use a KMS Key as the root of trust.
1111
1212
Running this example requires access to the DDB Table whose name
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
"""Stub to allow relative imports of examples from tests."""

0 commit comments

Comments
 (0)