Copyright | (c) 2013-2021 Brendan Hay |
---|---|
License | Mozilla Public License, v. 2.0. |
Maintainer | Brendan Hay <brendan.g.hay+amazonka@gmail.com> |
Stability | auto-generated |
Portability | non-portable (GHC extensions) |
Safe Haskell | None |
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 symmetric from asymmetric KMS keys.
It also provides information that is particularly important to
asymmetric keys, such as the key usage (encryption or signing) and the
encryption algorithms or signing algorithms that the KMS key supports.
For KMS keys in custom key stores, it includes information about the
custom key store, such as the key store ID and the CloudHSM cluster ID.
For multi-Region keys, it displays the primary key and all related
replica keys.
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 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.
If you call the DescribeKey
operation on a /predefined Amazon Web
Services alias/, that is, an Amazon Web Services alias with no key ID,
KMS creates an
Amazon Web Services managed key.
Then, it associates the alias with the new KMS key, and returns the
KeyId
and Arn
of the new KMS key in the response.
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
- data DescribeKey = DescribeKey' {
- grantTokens :: Maybe [Text]
- keyId :: Text
- newDescribeKey :: Text -> DescribeKey
- describeKey_grantTokens :: Lens' DescribeKey (Maybe [Text])
- describeKey_keyId :: Lens' DescribeKey Text
- data DescribeKeyResponse = DescribeKeyResponse' {}
- newDescribeKeyResponse :: Int -> DescribeKeyResponse
- describeKeyResponse_keyMetadata :: Lens' DescribeKeyResponse (Maybe KeyMetadata)
- describeKeyResponse_httpStatus :: Lens' DescribeKeyResponse Int
Creating a Request
data DescribeKey Source #
See: newDescribeKey
smart constructor.
DescribeKey' | |
|
Instances
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.
$sel:keyId: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.
DescribeKeyResponse' | |
|
Instances
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
describeKeyResponse_keyMetadata :: Lens' DescribeKeyResponse (Maybe KeyMetadata) Source #
Metadata associated with the key.
describeKeyResponse_httpStatus :: Lens' DescribeKeyResponse Int Source #
The response's http status code.