aws_elasticache_cluster_node Resource
Use the aws_elasticache_cluster_node
InSpec audit resource to test the properties of a single AWS ElastiCache cluster node.
Installation
This resource is available in the Chef InSpec AWS resource pack.
See the Chef InSpec documentation on cloud platforms for information on configuring your AWS environment for InSpec and creating an InSpec profile that uses the InSpec AWS resource pack.
Syntax
An aws_elasticache_cluster_node
resource block declares the tests for a single AWS ElastiCache cluster node by cache_cluster_id
and node_id
.
describe aws_elasticache_cluster_node(cache_cluster_id: 'my-cluster-123', node_id: '0001') do
it { should exist }
end
Parameters
The ElastiCache cluster ID and node ID must be provided.
cache_cluster_id
(required)-
The ID of the ElastiCache cluster:
- contains between 1 and 50 alphanumeric characters or hyphens,
- should start with a letter,
- cannot end with a hyphen or contain two consecutive hyphens.
-
It can be passed either as a string or as a
cache_cluster_id: 'value'
key-value entry in a hash. node_id
(required)-
The ID of the node must be a string containing 4 digits. It can be passed as a
node_id: 'value'
key-value entry in a hash.
Properties
id
- The cache node identifier, e.g.
0001
. port
- The port number that the cache engine is listening on.
address
- The DNS hostname of the cache node.
status
- The current state of the cache node. One of the following values:
available
,creating
,rebooting
, ordeleting
. create_time
- The date and time when the cache node was created.
There are also additional properties available. For a comprehensive list, see the API reference documentation.
Examples
Test that an ElastiCache cluster node is available.
describe aws_elasticache_cluster_node(cache_cluster_id: "my-cluster-123", node_id: "0001") do
its("status") { should eq 'available' }
end
Test that an Elasticache cluster engine is listening on port 11211
.
describe aws_elasticache_cluster_node(cache_cluster_id: "my-cluster-123", node_id: "0001") do
its("port") { should cmp 11211 }
end
Test that an Elasticache cluster node’s customer availability zone is us-east-2b
.
describe aws_elasticache_cluster_node(cache_cluster_id: "my-cluster-123", node_id: "0001") do
its("customer_availability_zone") { should cmp "us-east-2b" }
end
Matchers
This InSpec audit resource has the following special matchers. For a full list of available matchers, please visit our Universal Matchers page.
exist
describe aws_elasticache_cluster_node(cache_cluster_id: "my-cluster-123", node_id: "0001") do
it { should exist }
end
AWS Permissions
Your Principal will need the ElastiCache:Client:CacheClusterMessage
action with Effect
set to Allow
.
You can find detailed documentation at Actions, Resources, and Condition Keys for Amazon ElastiCache, and Actions, Resources, and Condition Keys for Identity And Access Management.
Was this page helpful?