EC2 / Client / associate_kms_key_id

associate_kms_key_id

EC2.Client.associate_kms_key_id(**kwargs)

Associates an additional KMS key with an encrypted Amazon EBS snapshot. With the associated key, you have a second, independent way to access the snapshot’s data, in addition to the key the snapshot is already encrypted under. Associating a key doesn’t re-encrypt the snapshot or grant access to its original key.

For more information, see Associated KMS keys in the Amazon EBS User Guide.

See also: AWS API Documentation

Request Syntax

response = client.associate_kms_key_id(
    SnapshotId='string',
    KmsKeyId='string',
    DryRun=True|False
)
Parameters:
  • SnapshotId (string) – The ID of the Amazon EBS snapshot.

  • KmsKeyId (string) –

    [REQUIRED]

    The ID, alias, or ARN of the KMS key to associate with the snapshot. You can specify a key ID, key alias, key ARN, or alias ARN.

  • DryRun (boolean) – Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Return type:

dict

Returns:

Response Syntax

{
    'Return': True|False
}

Response Structure

  • (dict) –

    • Return (boolean) –

      Returns true if the request succeeds; otherwise, it returns an error.