Welcome to the AWS Code Examples Repository. This repo contains code examples used in the AWS documentation, AWS SDK Developer Guides, and more. For more information, see the Readme.md file below.
|
|
<?php
|
||
|
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||
|
|
// SPDX-License-Identifier: Apache-2.0
|
||
|
|
|
||
|
|
// snippet-start:[php.example_code.kms.basics.helloService]
|
||
|
|
include "vendor/autoload.php";
|
||
|
|
|
||
|
|
use Aws\Kms\KmsClient;
|
||
|
|
|
||
|
|
echo "This file shows how to connect to the KmsClient, uses a paginator to get the keys for the account, and lists the KeyIds for up to 10 keys.\n";
|
||
|
|
|
||
|
|
$client = new KmsClient([]);
|
||
|
|
|
||
|
|
$pageLength = 10; // Change this value to change the number of records shown, or to break up the result into pages.
|
||
|
|
|
||
|
|
$keys = [];
|
||
|
|
$keysPaginator = $client->getPaginator("ListKeys", ['Limit' => $pageLength]);
|
||
|
|
foreach($keysPaginator as $page){
|
||
|
|
foreach($page['Keys'] as $index => $key){
|
||
|
|
echo "The $index index Key's ID is: {$key['KeyId']}\n";
|
||
|
|
}
|
||
|
|
echo "End of page one of results. Alter the \$pageLength variable to see more results.\n";
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
|
||
|
|
// snippet-end:[php.example_code.kms.basics.helloService]
|