Skip to content

Commit 51613af

Browse files
committed
Revert "docs: clarify KMSMasterKeyProvider credentials configuration (aws#251)"
This reverts commit 6136620.
1 parent 255b365 commit 51613af

File tree

2 files changed

+14
-47
lines changed

2 files changed

+14
-47
lines changed

README.rst

+3
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ to your use-case in order to obtain peak performance.
112112
.. _GitHub: https://github.com/aws/aws-encryption-sdk-python/
113113
.. _AWS KMS: https://docs.aws.amazon.com/kms/latest/developerguide/overview.html
114114
.. _KMS customer master key (CMK): https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#master_keys
115+
.. _boto3 SDK: https://boto3.readthedocs.io/en/latest/
116+
.. _standard means by which boto3 locates credentials: https://boto3.readthedocs.io/en/latest/guide/configuration.html
117+
.. _final message: https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/message-format.html
115118
.. _encryption context: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#encrypt_context
116119
.. _examples: https://github.com/aws/aws-encryption-sdk-python/tree/master/examples
117120
.. _Security issue notifications: https://github.com/aws/aws-encryption-sdk-python/tree/master/CONTRIBUTING.md#security-issue-notifications

src/aws_encryption_sdk/key_providers/kms.py

+11-47
Original file line numberDiff line numberDiff line change
@@ -82,58 +82,22 @@ class KMSMasterKeyProvider(MasterKeyProvider):
8282
Master key providers are deprecated.
8383
Use :class:`aws_encryption_sdk.keyrings.aws_kms.AwsKmsKeyring` instead.
8484
85-
To encrypt data, you must configure :class:`KMSMasterKeyProvider` with at least one CMK.
86-
If you configure :class:`KMSMasterKeyProvider` with multiple CMKs,
87-
it generates the data key using the first CMK and encrypts that data key using the rest,
88-
so that the `encrypted message`_ includes a copy of the data key encrypted under each configured CMK.
89-
90-
.. _encrypted message: https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/message-format.html
91-
92-
>>> from aws_encryption_sdk.key_providers.kms import KMSMasterKeyProvider
93-
>>> kms_key_provider = KMSMasterKeyProvider(key_ids=[
94-
... "arn:aws:kms:us-east-1:2222222222222:key/22222222-2222-2222-2222-222222222222",
95-
... "arn:aws:kms:us-east-1:3333333333333:key/33333333-3333-3333-3333-333333333333",
96-
... ])
97-
98-
You can also configure :class:`KMSMasterKeyProvider` with CMKs in multiple regions:
99-
100-
>>> from aws_encryption_sdk.key_providers.kms import KMSMasterKeyProvider
101-
>>> kms_key_provider = KMSMasterKeyProvider(key_ids=[
102-
... "arn:aws:kms:us-east-1:2222222222222:key/22222222-2222-2222-2222-222222222222",
103-
... "arn:aws:kms:us-west-2:3333333333333:key/33333333-3333-3333-3333-333333333333",
104-
... "arn:aws:kms:ap-northeast-1:4444444444444:key/44444444-4444-4444-4444-444444444444",
85+
>>> import aws_encryption_sdk
86+
>>> kms_key_provider = aws_encryption_sdk.KMSMasterKeyProvider(key_ids=[
87+
... 'arn:aws:kms:us-east-1:2222222222222:key/22222222-2222-2222-2222-222222222222',
88+
... 'arn:aws:kms:us-east-1:3333333333333:key/33333333-3333-3333-3333-333333333333'
10589
... ])
90+
>>> kms_key_provider.add_master_key('arn:aws:kms:ap-northeast-1:4444444444444:alias/another-key')
10691
107-
:class:`KMSMasterKeyProvider` needs AWS credentials in order to interact with `AWS KMS`_.
108-
There are two ways that you can provide these credentials:
109-
110-
.. _AWS KMS: https://docs.aws.amazon.com/kms/latest/developerguide/overview.html
111-
112-
1. Provide your AWS credentials in one of the standard `AWS credential discovery locations`_
113-
and the :class:`KMSMasterKeyProvider` instance automatically discovers those credentials.
114-
115-
.. _AWS credential discovery locations:
116-
https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html#configuring-credentials
117-
118-
>>> from aws_encryption_sdk.key_providers.kms import KMSMasterKeyProvider
119-
>>> import botocore.session
120-
>>> kms_key_provider = KMSMasterKeyProvider()
92+
.. note::
93+
If no botocore_session is provided, the default botocore session will be used.
12194
122-
2. Provide an existing botocore session to :class:`KMSMasterKeyProvider`.
123-
This option can be useful if you want to use specific credentials
124-
or if you want to reuse an existing botocore session instance to decrease startup costs.
95+
.. note::
96+
If multiple AWS Identities are needed, one of two options are available:
12597
126-
>>> from aws_encryption_sdk.key_providers.kms import KMSMasterKeyProvider
127-
>>> import botocore.session
128-
>>> existing_botocore_session = botocore.session.Session(profile="custom")
129-
>>> kms_key_provider = KMSMasterKeyProvider(botocore_session=existing_botocore_session)
98+
* Additional KMSMasterKeyProvider instances may be added to the primary MasterKeyProvider.
13099
131-
If you need different credentials to use different CMKs,
132-
you can combine multiple :class:`KMSMasterKeyProvider` or :class:`KMSMasterKey` instances,
133-
each with their own credentials.
134-
However, we recommend that you use
135-
:class:`aws_encryption_sdk.keyrings.aws_kms.AwsKmsKeyring` and client suppliers
136-
for a simpler user experience.
100+
* KMSMasterKey instances may be manually created and added to this KMSMasterKeyProvider.
137101
138102
:param config: Configuration object (optional)
139103
:type config: aws_encryption_sdk.key_providers.kms.KMSMasterKeyProviderConfig

0 commit comments

Comments
 (0)