describe_cache_clusters ( $opt )

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

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • CacheClusterId - string - Optional - The user-supplied cluster identifier. If this parameter is specified, only information about that specific Cache Cluster is returned. This parameter isn’t case sensitive.
  • MaxRecords - integer - Optional - The maximum number of records to include in the response. If more records exist than the specified MaxRecords value, a marker is included in the response so that the remaining results may be retrieved. Default: 100 Constraints: minimum 20, maximum 100
  • Marker - string - Optional - An optional marker provided in the previous DescribeCacheClusters request. If this parameter is specified, the response includes only records beyond the marker, up to the value specified by MaxRecords.
  • ShowCacheNodeInfo - boolean - Optional - An optional flag that can be included in the DescribeCacheCluster request to retrieve Cache Nodes information.
  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

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

public function describe_cache_clusters($opt = null)
{
    if (!$opt) $opt = array();
            
    return $this->authenticate('DescribeCacheClusters', $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback