Returns information about all provisioned Cache Clusters if no Cache Cluster identifier is specified, or about a specific Cache Cluster if a Cache Cluster identifier is supplied.
Cluster information will be returned by default. An optional ShowDetails flag can be used to retrieve detailed information about the Cache Nodes associated with the Cache Cluster. Details include the DNS address and port for the Cache Node endpoint.
If the cluster is in the CREATING state, only cluster level information will be displayed until all of the nodes are successfully provisioned.
If the cluster is in the DELETING state, only cluster level information will be displayed.
While adding Cache Nodes, node endpoint information and creation time for the additional nodes will not be displayed until they are completely provisioned. The cluster lifecycle tells the customer when new nodes are AVAILABLE.
While removing existing Cache Nodes from an cluster, endpoint information for the removed nodes will not be displayed.
DescribeCacheClusters supports pagination.
Access
public
Parameters
Parameter |
Type |
Required |
Description |
---|---|---|---|
|
Optional |
An associative array of parameters that can have the following keys:
|
Returns
Type |
Description |
---|---|
A |
Examples
End-to-end flow of setting up a new cluster, retrieving data, and shutting it all down.
$elasticache = new AmazonElastiCache(); // Create a new security group $elasticache->batch()->create_cache_security_group( 'my-security-group', 'This is a memcached security group.' ); // Create a new parameter group $elasticache->batch()->create_cache_parameter_group( 'my-param-group', 'memcached1.4', 'This is a memcached parameter group.' ); // Send requests $responses = $elasticache->batch()->send(true); if (!$responses->areOK()) { die('Either the security or parameter groups failed to be created.'); } $response = $elasticache->create_cache_cluster( 'my-cluster', # cluster node 2, # number of nodes 'cache.m1.large', # instance type 'memcached', # cache engine 'my-secgroup', # security group array( 'CacheParameterGroupName' => 'my-paramgroup', 'AutoMinorVersionUpgrade' => 'true' ) ); if (!$response->isOK()) { print_r($response); die('Failed to create new cache cluster.'); } do { sleep(20); $response = $elasticache->describe_cache_clusters(array( 'CacheClusterId' => 'my-cluster' )); $status = (string) $response->body ->DescribeCacheClustersResult ->CacheClusters ->CacheCluster ->CacheClusterStatus; } while ($status !== 'available'); // Display parameter group echo (string) $response->body ->DescribeCacheClustersResult ->CacheClusters ->CacheCluster ->CacheParameterGroup ->CacheParameterGroupName . PHP_EOL; // Display security group echo (string) $response->body ->DescribeCacheClustersResult ->CacheClusters ->CacheCluster ->CacheSecurityGroups ->CacheSecurityGroup ->CacheSecurityGroupName . PHP_EOL; // Clean-up $response = $elasticache->delete_cache_cluster('my-cluster'); if (!$response->isOK()) { print_r($response); die('Cluster deletion was unsuccessful.'); } else { // Wait until the cluster responds with a 404 error do { sleep(20); $response = $elasticache->describe_cache_clusters(array( 'CacheClusterId' => 'my-cluster' )); } while ($response->status !== 404); // Delete the security and parameter groups $elasticache->batch()->delete_cache_security_group('my-security-group'); $elasticache->batch()->delete_cache_parameter_group('my-param-group'); $responses = $elasticache->batch()->send(true); if (!$responses->areOK()) { print_r($responses); die('Group deletions were unsuccessful.'); } }
Source
Method defined in services/elasticache.class.php | Toggle source view (6 lines) | View on GitHub