aws_redshift_clusters Resource
Use the aws_redshift_clusters InSpec audit resource to test properties of a collection of Amazon Redshift clusters.
Redshift gives you access to the capabilities of a MySQL, MariaDB, PostgreSQL, Microsoft SQL Server, Oracle, or Amazon Aurora database server.
Install
This resource is available in the Chef InSpec AWS resource pack.
For information on configuring your AWS environment for Chef InSpec and creating an InSpec profile that uses the InSpec AWS resource pack, see the Chef InSpec documentation on the AWS cloud platform.
Syntax
Ensure you have exactly 3 clusters
describe aws_redshift_clusters do
its('cluster_identifiers.count') { should cmp 3 }
end
Parameters
This resource does not require any parameters.
Properties
cluster_identifiers- The unique IDs of the Redshift clusters returned.
Field:
cluster_identifierdb_names- The name of the database associated with each Redshift cluster.
Field:
db_namenode_types- The Redshift instance type.
Field:
node_typecluster_create_time- The create time of Redshift clusters.
Field:
cluster_create_timecluster_subnet_group_names- The cluster name of Redshift clusters.
Field:
cluster_subnet_group_namecluster_status- The current status of each cluster.
Field:
cluster_statuscluster_availability_status- The current status of cluster.
Field:
cluster_availability_statusmodify_status- The current status of cluster.
Field:
modify_statusavailability_zones- A list of availability zones of the Redshift clusters returned.
Field:
availability_zonesallow_version_upgrade- Returns
trueorfalsedepending on whether version upgrade is allowed or not. Field:
allow_version_upgradeencrypted- Returns
trueorfalsedepending on whether Redshift clusters are encrypted or not. Field:
encryptedcluster_subnet_group_names- Cluster subnet group name for Redshift clusters returned.
Field:
cluster_subnet_group_nameiam_roles- The IAM roles that are used in the cluster.
Field:
iam_rolesvpc_ids- The VPC ID of the Redshift clusters.
Field:
vpc_id
For a comprehensive list of properties available to test on an Redshift cluster see the AWS Response Object.
Examples
Ensure a specific cluster exists.
describe aws_redshift_clusters do
its('cluster_identifier') { should include 'cluster-12345678' }
end
Request the IDs of all Redshift clusters, then test in-depth using aws_redshift_cluster to ensure all clusters are encrypted.
aws_redshift_clusters.cluster_identifier.each do |cluster_identifier|
describe aws_redshift_cluster(cluster_identifier) do
it { should have_encrypted }
end
end
Matchers
For a full list of available matchers, see our Universal Matchers page.This resource has the following special matchers.
exist
The control will pass if the describe returns at least one result.
Use should to test entity exists.
describe aws_redshift_clusters do
it { should exist }
end
Use should_not to test the entity should not exist.
describe aws_redshift_clusters do
it { should_not exist }
end
AWS Permissions
Your Principal will need the Redshift:Client:ClustersMessage action with Effect set to Allow.
You can find detailed documentation at Actions, Resources, and Condition Keys for Amazon EC2, and Actions, Resources, and Condition Keys for Identity And Access Management.