AWS Key Management Service

2016/05/05 - AWS Key Management Service - 2 updated api methods

CreateKey (updated) Link ¶
Changes (request)
{'BypassPolicyLockoutSafetyCheck': 'boolean'}

Creates a customer master key (CMK).

You can use a CMK to encrypt small amounts of data (4 KiB or less) directly, but CMKs are more commonly used to encrypt data encryption keys (DEKs), which are used to encrypt raw data. For more information about DEKs and the difference between CMKs and DEKs, see the following:

Request Syntax

client.create_key(
    Policy='string',
    Description='string',
    KeyUsage='ENCRYPT_DECRYPT',
    BypassPolicyLockoutSafetyCheck=True|False
)
type Policy

string

param Policy

The key policy to attach to the CMK.

If you specify a key policy, it must meet the following criteria:

  • It must allow the principal making the CreateKey request to make a subsequent PutKeyPolicy request on the CMK. This reduces the likelihood that the CMK becomes unmanageable. For more information, refer to the scenario in the Default Key Policy section in the AWS Key Management Service Developer Guide .

  • The principal(s) specified in the key policy must exist and be visible to AWS KMS. When you create a new AWS principal (for example, an IAM user or role), you might need to enforce a delay before specifying the new principal in a key policy because the new principal might not immediately be visible to AWS KMS. For more information, see Changes that I make are not always immediately visible in the IAM User Guide .

If you do not specify a policy, AWS KMS attaches a default key policy to the CMK. For more information, see Default Key Policy in the AWS Key Management Service Developer Guide .

The policy size limit is 32 KiB (32768 bytes).

type Description

string

param Description

A description of the CMK.

Use a description that helps you decide whether the CMK is appropriate for a task.

type KeyUsage

string

param KeyUsage

The intended use of the CMK.

You can use CMKs only for symmetric encryption and decryption.

type BypassPolicyLockoutSafetyCheck

boolean

param BypassPolicyLockoutSafetyCheck

A flag to indicate whether to bypass the key policy lockout safety check.

Warning

Setting this value to true increases the likelihood that the CMK becomes unmanageable. Do not set this value to true indiscriminately.

For more information, refer to the scenario in the Default Key Policy section in the AWS Key Management Service Developer Guide .

Use this parameter only when you include a policy in the request and you intend to prevent the principal making the request from making a subsequent PutKeyPolicy request on the CMK.

The default value is false.

rtype

dict

returns

Response Syntax

{
    'KeyMetadata': {
        'AWSAccountId': 'string',
        'KeyId': 'string',
        'Arn': 'string',
        'CreationDate': datetime(2015, 1, 1),
        'Enabled': True|False,
        'Description': 'string',
        'KeyUsage': 'ENCRYPT_DECRYPT',
        'KeyState': 'Enabled'|'Disabled'|'PendingDeletion',
        'DeletionDate': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • KeyMetadata (dict) --

      Metadata associated with the CMK.

      • AWSAccountId (string) --

        The twelve-digit account ID of the AWS account that owns the key.

      • KeyId (string) --

        The globally unique identifier for the key.

      • Arn (string) --

        The Amazon Resource Name (ARN) of the key. For examples, see AWS Key Management Service (AWS KMS) in the Example ARNs section of the AWS General Reference .

      • CreationDate (datetime) --

        The date and time when the key was created.

      • Enabled (boolean) --

        Specifies whether the key is enabled. When KeyState is Enabled this value is true, otherwise it is false.

      • Description (string) --

        The friendly description of the key.

      • KeyUsage (string) --

        The cryptographic operations for which you can use the key. Currently the only allowed value is ENCRYPT_DECRYPT , which means you can use the key for the Encrypt and Decrypt operations.

      • KeyState (string) --

        The state of the customer master key (CMK).

        For more information about how key state affects the use of a CMK, see How Key State Affects the Use of a Customer Master Key in the AWS Key Management Service Developer Guide .

      • DeletionDate (datetime) --

        The date and time after which AWS KMS deletes the customer master key (CMK). This value is present only when KeyState is PendingDeletion , otherwise this value is null.

PutKeyPolicy (updated) Link ¶
Changes (request)
{'BypassPolicyLockoutSafetyCheck': 'boolean'}

Attaches a key policy to the specified customer master key (CMK).

For more information about key policies, see Key Policies in the AWS Key Management Service Developer Guide .

Request Syntax

client.put_key_policy(
    KeyId='string',
    PolicyName='string',
    Policy='string',
    BypassPolicyLockoutSafetyCheck=True|False
)
type KeyId

string

param KeyId

[REQUIRED]

A unique identifier for the CMK.

Use the CMK's unique identifier or its Amazon Resource Name (ARN). For example:

  • Unique ID: 1234abcd-12ab-34cd-56ef-1234567890ab

  • ARN: arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab

type PolicyName

string

param PolicyName

[REQUIRED]

The name of the key policy.

This value must be default .

type Policy

string

param Policy

[REQUIRED]

The key policy to attach to the CMK.

The key policy must meet the following criteria:

  • It must allow the principal making the PutKeyPolicy request to make a subsequent PutKeyPolicy request on the CMK. This reduces the likelihood that the CMK becomes unmanageable. For more information, refer to the scenario in the Default Key Policy section in the AWS Key Management Service Developer Guide .

  • The principal(s) specified in the key policy must exist and be visible to AWS KMS. When you create a new AWS principal (for example, an IAM user or role), you might need to enforce a delay before specifying the new principal in a key policy because the new principal might not immediately be visible to AWS KMS. For more information, see Changes that I make are not always immediately visible in the IAM User Guide .

The policy size limit is 32 KiB (32768 bytes).

type BypassPolicyLockoutSafetyCheck

boolean

param BypassPolicyLockoutSafetyCheck

A flag to indicate whether to bypass the key policy lockout safety check.

Warning

Setting this value to true increases the likelihood that the CMK becomes unmanageable. Do not set this value to true indiscriminately.

For more information, refer to the scenario in the Default Key Policy section in the AWS Key Management Service Developer Guide .

Use this parameter only when you intend to prevent the principal making the request from making a subsequent PutKeyPolicy request on the CMK.

The default value is false.

returns

None