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_identifier
db_names
- The name of the database associated with each Redshift cluster.
Field:
db_name
node_types
- The Redshift instance type.
Field:
node_type
cluster_create_time
- The create time of Redshift clusters.
Field:
cluster_create_time
cluster_subnet_group_names
- The cluster name of Redshift clusters.
Field:
cluster_subnet_group_name
cluster_status
- The current status of each cluster.
Field:
cluster_status
cluster_availability_status
- The current status of cluster.
Field:
cluster_availability_status
modify_status
- The current status of cluster.
Field:
modify_status
availability_zones
- A list of availability zones of the Redshift clusters returned.
Field:
availability_zones
allow_version_upgrade
- Returns
true
orfalse
depending on whether version upgrade is allowed or not. Field:
allow_version_upgrade
encrypted
- Returns
true
orfalse
depending on whether Redshift clusters are encrypted or not. Field:
encrypted
cluster_subnet_group_names
- Cluster subnet group name for Redshift clusters returned.
Field:
cluster_subnet_group_name
iam_roles
- The IAM roles that are used in the cluster.
Field:
iam_roles
vpc_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.