amazonka-kms-2.0: Amazon Key Management Service SDK.
Copyright(c) 2013-2023 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellSafe-Inferred
LanguageHaskell2010

Amazonka.KMS.DescribeKey

Description

Provides detailed information about a KMS key. You can run DescribeKey on a customer managed key or an Amazon Web Services managed key.

This detailed information includes the key ARN, creation date (and deletion date, if applicable), the key state, and the origin and expiration date (if any) of the key material. It includes fields, like KeySpec, that help you distinguish different types of KMS keys. It also displays the key usage (encryption, signing, or generating and verifying MACs) and the algorithms that the KMS key supports.

For multi-Region keys, DescribeKey displays the primary key and all related replica keys. For KMS keys in CloudHSM key stores, it includes information about the key store, such as the key store ID and the CloudHSM cluster ID. For KMS keys in external key stores, it includes the custom key store ID and the ID of the external key.

DescribeKey does not return the following information:

  • Aliases associated with the KMS key. To get this information, use ListAliases.
  • Whether automatic key rotation is enabled on the KMS key. To get this information, use GetKeyRotationStatus. Also, some key states prevent a KMS key from being automatically rotated. For details, see How Automatic Key Rotation Works in the Key Management Service Developer Guide.
  • Tags on the KMS key. To get this information, use ListResourceTags.
  • Key policies and grants on the KMS key. To get this information, use GetKeyPolicy and ListGrants.

In general, DescribeKey is a non-mutating operation. It returns data about KMS keys, but doesn't change them. However, Amazon Web Services services use DescribeKey to create Amazon Web Services managed keys from a predefined Amazon Web Services alias with no key ID.

Cross-account use: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify the key ARN or alias ARN in the value of the KeyId parameter.

Required permissions: kms:DescribeKey (key policy)

Related operations:

  • GetKeyPolicy
  • GetKeyRotationStatus
  • ListAliases
  • ListGrants
  • ListKeys
  • ListResourceTags
  • ListRetirableGrants
Synopsis

Creating a Request

data DescribeKey Source #

See: newDescribeKey smart constructor.

Constructors

DescribeKey' 

Fields

  • grantTokens :: Maybe [Text]

    A list of grant tokens.

    Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the Key Management Service Developer Guide.

  • keyId :: Text

    Describes the specified KMS key.

    If you specify a predefined Amazon Web Services alias (an Amazon Web Services alias with no key ID), KMS associates the alias with an Amazon Web Services managed key and returns its KeyId and Arn in the response.

    To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with "alias/". To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

    For example:

    • Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
    • Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
    • Alias name: alias/ExampleAlias
    • Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias

    To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases.

Instances

Instances details
ToJSON DescribeKey Source # 
Instance details

Defined in Amazonka.KMS.DescribeKey

ToHeaders DescribeKey Source # 
Instance details

Defined in Amazonka.KMS.DescribeKey

Methods

toHeaders :: DescribeKey -> [Header] #

ToPath DescribeKey Source # 
Instance details

Defined in Amazonka.KMS.DescribeKey

ToQuery DescribeKey Source # 
Instance details

Defined in Amazonka.KMS.DescribeKey

AWSRequest DescribeKey Source # 
Instance details

Defined in Amazonka.KMS.DescribeKey

Associated Types

type AWSResponse DescribeKey #

Generic DescribeKey Source # 
Instance details

Defined in Amazonka.KMS.DescribeKey

Associated Types

type Rep DescribeKey :: Type -> Type #

Read DescribeKey Source # 
Instance details

Defined in Amazonka.KMS.DescribeKey

Show DescribeKey Source # 
Instance details

Defined in Amazonka.KMS.DescribeKey

NFData DescribeKey Source # 
Instance details

Defined in Amazonka.KMS.DescribeKey

Methods

rnf :: DescribeKey -> () #

Eq DescribeKey Source # 
Instance details

Defined in Amazonka.KMS.DescribeKey

Hashable DescribeKey Source # 
Instance details

Defined in Amazonka.KMS.DescribeKey

type AWSResponse DescribeKey Source # 
Instance details

Defined in Amazonka.KMS.DescribeKey

type Rep DescribeKey Source # 
Instance details

Defined in Amazonka.KMS.DescribeKey

type Rep DescribeKey = D1 ('MetaData "DescribeKey" "Amazonka.KMS.DescribeKey" "amazonka-kms-2.0-6YhT3Ymbf9Z5PoaGoz7tbG" 'False) (C1 ('MetaCons "DescribeKey'" 'PrefixI 'True) (S1 ('MetaSel ('Just "grantTokens") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [Text])) :*: S1 ('MetaSel ('Just "keyId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)))

newDescribeKey Source #

Create a value of DescribeKey with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:grantTokens:DescribeKey', describeKey_grantTokens - A list of grant tokens.

Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the Key Management Service Developer Guide.

DescribeKey, describeKey_keyId - Describes the specified KMS key.

If you specify a predefined Amazon Web Services alias (an Amazon Web Services alias with no key ID), KMS associates the alias with an Amazon Web Services managed key and returns its KeyId and Arn in the response.

To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with "alias/". To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

For example:

  • Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  • Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  • Alias name: alias/ExampleAlias
  • Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases.

Request Lenses

describeKey_grantTokens :: Lens' DescribeKey (Maybe [Text]) Source #

A list of grant tokens.

Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the Key Management Service Developer Guide.

describeKey_keyId :: Lens' DescribeKey Text Source #

Describes the specified KMS key.

If you specify a predefined Amazon Web Services alias (an Amazon Web Services alias with no key ID), KMS associates the alias with an Amazon Web Services managed key and returns its KeyId and Arn in the response.

To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with "alias/". To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

For example:

  • Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  • Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  • Alias name: alias/ExampleAlias
  • Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases.

Destructuring the Response

data DescribeKeyResponse Source #

See: newDescribeKeyResponse smart constructor.

Constructors

DescribeKeyResponse' 

Fields

Instances

Instances details
Generic DescribeKeyResponse Source # 
Instance details

Defined in Amazonka.KMS.DescribeKey

Associated Types

type Rep DescribeKeyResponse :: Type -> Type #

Read DescribeKeyResponse Source # 
Instance details

Defined in Amazonka.KMS.DescribeKey

Show DescribeKeyResponse Source # 
Instance details

Defined in Amazonka.KMS.DescribeKey

NFData DescribeKeyResponse Source # 
Instance details

Defined in Amazonka.KMS.DescribeKey

Methods

rnf :: DescribeKeyResponse -> () #

Eq DescribeKeyResponse Source # 
Instance details

Defined in Amazonka.KMS.DescribeKey

type Rep DescribeKeyResponse Source # 
Instance details

Defined in Amazonka.KMS.DescribeKey

type Rep DescribeKeyResponse = D1 ('MetaData "DescribeKeyResponse" "Amazonka.KMS.DescribeKey" "amazonka-kms-2.0-6YhT3Ymbf9Z5PoaGoz7tbG" 'False) (C1 ('MetaCons "DescribeKeyResponse'" 'PrefixI 'True) (S1 ('MetaSel ('Just "keyMetadata") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe KeyMetadata)) :*: S1 ('MetaSel ('Just "httpStatus") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)))

newDescribeKeyResponse Source #

Create a value of DescribeKeyResponse with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:keyMetadata:DescribeKeyResponse', describeKeyResponse_keyMetadata - Metadata associated with the key.

$sel:httpStatus:DescribeKeyResponse', describeKeyResponse_httpStatus - The response's http status code.

Response Lenses