Skip to content

Resource: awsRedshiftCluster

Provides a Redshift Cluster Resource.

\~> Note: All arguments including the username and password will be stored in the raw state as plain-text. Read more about sensitive data in state.

\~> NOTE: A Redshift cluster's default IAM role can be managed both by this resource's defaultIamRoleArn argument and the awsRedshiftClusterIamRoles resource's defaultIamRoleArn argument. Do not configure different values for both arguments. Doing so will cause a conflict of default IAM roles.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.redshiftCluster.RedshiftCluster(this, "example", {
  clusterIdentifier: "tf-redshift-cluster",
  clusterType: "single-node",
  databaseName: "mydb",
  masterPassword: "Mustbe8characters",
  masterUsername: "exampleuser",
  nodeType: "dc1.large",
});

Argument Reference

For more detailed documentation about each argument, refer to the AWS official documentation.

The following arguments are supported:

  • clusterIdentifier - (Required) The Cluster Identifier. Must be a lower case string.
  • databaseName - (Optional) The name of the first database to be created when the cluster is created. If you do not provide a name, Amazon Redshift will create a default database called dev.
  • defaultIamRoleArn - (Optional) The Amazon Resource Name (ARN) for the IAM role that was set as default for the cluster when the cluster was created.
  • nodeType - (Required) The node type to be provisioned for the cluster.
  • clusterType - (Optional) The cluster type to use. Either singleNode or multiNode.
  • masterPassword - (Required unless a snapshotIdentifier is provided) Password for the master DB user. Note that this may show up in logs, and it will be stored in the state file. Password must contain at least 8 chars and contain at least one uppercase letter, one lowercase letter, and one number.
  • masterUsername - (Required unless a snapshotIdentifier is provided) Username for the master DB user.
  • clusterSecurityGroups - (Optional) A list of security groups to be associated with this cluster.
  • vpcSecurityGroupIds - (Optional) A list of Virtual Private Cloud (VPC) security groups to be associated with the cluster.
  • clusterSubnetGroupName - (Optional) The name of a cluster subnet group to be associated with this cluster. If this parameter is not provided the resulting cluster will be deployed outside virtual private cloud (VPC).
  • availabilityZone - (Optional) The EC2 Availability Zone (AZ) in which you want Amazon Redshift to provision the cluster. For example, if you have several EC2 instances running in a specific Availability Zone, then you might want the cluster to be provisioned in the same zone in order to decrease network latency. Can only be changed if availabilityZoneRelocationEnabled is true.
  • availabilityZoneRelocationEnabled - (Optional) If true, the cluster can be relocated to another availabity zone, either automatically by AWS or when requested. Default is false. Available for use on clusters from the RA3 instance family.
  • preferredMaintenanceWindow - (Optional) The weekly time range (in UTC) during which automated cluster maintenance can occur. Format: ddd:hh24:mi-ddd:hh24:mi
  • clusterParameterGroupName - (Optional) The name of the parameter group to be associated with this cluster.
  • automatedSnapshotRetentionPeriod - (Optional) The number of days that automated snapshots are retained. If the value is 0, automated snapshots are disabled. Even if automated snapshots are disabled, you can still create manual snapshots when you want with create-cluster-snapshot. Default is 1.
  • port - (Optional) The port number on which the cluster accepts incoming connections. Valid values are between 1115 and 65535. The cluster is accessible only via the JDBC and ODBC connection strings. Part of the connection string requires the port on which the cluster will listen for incoming connections. Default port is 5439.
  • clusterVersion - (Optional) The version of the Amazon Redshift engine software that you want to deploy on the cluster. The version selected runs on all the nodes in the cluster.
  • allowVersionUpgrade - (Optional) If true , major version upgrades can be applied during the maintenance window to the Amazon Redshift engine that is running on the cluster. Default is true.
  • applyImmediately - (Optional) Specifies whether any cluster modifications are applied immediately, or during the next maintenance window. Default is false.
  • aquaConfigurationStatus - (Optional) The value represents how the cluster is configured to use AQUA (Advanced Query Accelerator) after the cluster is restored. Possible values are enabled, disabled, and auto. Requires Cluster reboot.
  • numberOfNodes - (Optional) The number of compute nodes in the cluster. This parameter is required when the ClusterType parameter is specified as multi-node. Default is 1.
  • publiclyAccessible - (Optional) If true, the cluster can be accessed from a public network. Default is true.
  • encrypted - (Optional) If true , the data in the cluster is encrypted at rest.
  • enhancedVpcRouting - (Optional) If true , enhanced VPC routing is enabled.
  • kmsKeyId - (Optional) The ARN for the KMS encryption key. When specifying kmsKeyId, encrypted needs to be set to true.
  • elasticIp - (Optional) The Elastic IP (EIP) address for the cluster.
  • skipFinalSnapshot - (Optional) Determines whether a final snapshot of the cluster is created before Amazon Redshift deletes the cluster. If true , a final cluster snapshot is not created. If false , a final cluster snapshot is created before the cluster is deleted. Default is false.
  • finalSnapshotIdentifier - (Optional) The identifier of the final snapshot that is to be created immediately before deleting the cluster. If this parameter is provided, skipFinalSnapshot must be false.
  • snapshotIdentifier - (Optional) The name of the snapshot from which to create the new cluster.
  • snapshotClusterIdentifier - (Optional) The name of the cluster the source snapshot was created from.
  • ownerAccount - (Optional) The AWS customer account used to create or copy the snapshot. Required if you are restoring a snapshot you do not own, optional if you own the snapshot.
  • iamRoles - (Optional) A list of IAM Role ARNs to associate with the cluster. A Maximum of 10 can be associated to the cluster at any time.
  • logging - (Optional) Logging, documented below.
  • maintenanceTrackName - (Optional) The name of the maintenance track for the restored cluster. When you take a snapshot, the snapshot inherits the MaintenanceTrack value from the cluster. The snapshot might be on a different track than the cluster that was the source for the snapshot. For example, suppose that you take a snapshot of a cluster that is on the current track and then change the cluster to be on the trailing track. In this case, the snapshot and the source cluster are on different tracks. Default value is current.
  • manualSnapshotRetentionPeriod - (Optional) The default number of days to retain a manual snapshot. If the value is -1, the snapshot is retained indefinitely. This setting doesn't change the retention period of existing snapshots. Valid values are between 1 and 3653. Default value is 1.
  • snapshotCopy - (Optional) Configuration of automatic copy of snapshots from one region to another. Documented below.
  • tags - (Optional) A map of tags to assign to the resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Nested Blocks

logging

  • enable - (Required) Enables logging information such as queries and connection attempts, for the specified Amazon Redshift cluster.
  • bucketName - (Optional, required when enable is true and logDestinationType is s3) The name of an existing S3 bucket where the log files are to be stored. Must be in the same region as the cluster and the cluster must have read bucket and put object permissions. For more information on the permissions required for the bucket, please read the AWS documentation
  • s3KeyPrefix - (Optional) The prefix applied to the log file names.
  • logDestinationType - (Optional) The log destination type. An enum with possible values of s3 and cloudwatch.
  • logExports - (Optional) The collection of exported log types. Log types include the connection log, user log and user activity log. Required when logDestinationType is cloudwatch. Valid log types are connectionlog, userlog, and useractivitylog.

snapshotCopy

  • destinationRegion - (Required) The destination region that you want to copy snapshots to.
  • retentionPeriod - (Optional) The number of days to retain automated snapshots in the destination region after they are copied from the source region. Defaults to 7.
  • grantName - (Optional) The name of the snapshot copy grant to use when snapshots of an AWS KMS-encrypted cluster are copied to the destination region.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • arn - Amazon Resource Name (ARN) of cluster
  • id - The Redshift Cluster ID.
  • clusterIdentifier - The Cluster Identifier
  • clusterType - The cluster type
  • nodeType - The type of nodes in the cluster
  • databaseName - The name of the default database in the Cluster
  • availabilityZone - The availability zone of the Cluster
  • automatedSnapshotRetentionPeriod - The backup retention period
  • preferredMaintenanceWindow - The backup window
  • endpoint - The connection endpoint
  • encrypted - Whether the data in the cluster is encrypted
  • clusterSecurityGroups - The security groups associated with the cluster
  • vpcSecurityGroupIds - The VPC security group Ids associated with the cluster
  • dnsName - The DNS name of the cluster
  • port - The Port the cluster responds on
  • clusterVersion - The version of Redshift engine software
  • clusterParameterGroupName - The name of the parameter group to be associated with this cluster
  • clusterSubnetGroupName - The name of a cluster subnet group to be associated with this cluster
  • clusterPublicKey - The public key for the cluster
  • clusterRevisionNumber - The specific revision number of the database in the cluster
  • clusterNodes - The nodes in the cluster. Cluster node blocks are documented below
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.

Cluster nodes (for clusterNodes) support the following attributes:

  • nodeRole - Whether the node is a leader node or a compute node
  • privateIpAddress - The private IP address of a node within a cluster
  • publicIpAddress - The public IP address of a node within a cluster

Timeouts

Configuration options:

  • create - (Default 75M)
  • update - (Default 75M)
  • delete - (Default 40M)

Import

Redshift Clusters can be imported using the clusterIdentifier, e.g.,

$ terraform import aws_redshift_cluster.myprodcluster tf-redshift-cluster-12345