listKeys

inline suspend fun KmsClient.listKeys(crossinline block: ListKeysRequest.Builder.() -> Unit): ListKeysResponse

Gets a list of all KMS keys in the caller's Amazon Web Services account and Region.

Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

Required permissions: kms:ListKeys (IAM policy)

Related operations:

  • CreateKey

  • DescribeKey

  • ListAliases

  • ListResourceTags

Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency.

Samples


fun main() { 
   //sampleStart 
   // The following example lists KMS keys.
val resp = kmsClient.listKeys() 
   //sampleEnd
}