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 calleddev
.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. EithersingleNode
ormultiNode
.masterPassword
- (Required unless asnapshotIdentifier
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 asnapshotIdentifier
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 ifavailabilityZoneRelocationEnabled
istrue
.availabilityZoneRelocationEnabled
- (Optional) If true, the cluster can be relocated to another availabity zone, either automatically by AWS or when requested. Default isfalse
. 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:miclusterParameterGroupName
- (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 between1115
and65535
. 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 is5439
.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 istrue
.applyImmediately
- (Optional) Specifies whether any cluster modifications are applied immediately, or during the next maintenance window. Default isfalse
.aquaConfigurationStatus
- (Optional) The value represents how the cluster is configured to use AQUA (Advanced Query Accelerator) after the cluster is restored. Possible values areenabled
,disabled
, andauto
. 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 istrue
.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 specifyingkmsKeyId
,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 iscurrent
.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 between1
and3653
. Default value is1
.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 providerdefaultTags
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 whenenable
istrue
andlogDestinationType
iss3
) 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 documentations3KeyPrefix
- (Optional) The prefix applied to the log file names.logDestinationType
- (Optional) The log destination type. An enum with possible values ofs3
andcloudwatch
.logExports
- (Optional) The collection of exported log types. Log types include the connection log, user log and user activity log. Required whenlogDestinationType
iscloudwatch
. Valid log types areconnectionlog
,userlog
, anduseractivitylog
.
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 to7
.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 clusterid
- The Redshift Cluster ID.clusterIdentifier
- The Cluster IdentifierclusterType
- The cluster typenodeType
- The type of nodes in the clusterdatabaseName
- The name of the default database in the ClusteravailabilityZone
- The availability zone of the ClusterautomatedSnapshotRetentionPeriod
- The backup retention periodpreferredMaintenanceWindow
- The backup windowendpoint
- The connection endpointencrypted
- Whether the data in the cluster is encryptedclusterSecurityGroups
- The security groups associated with the clustervpcSecurityGroupIds
- The VPC security group Ids associated with the clusterdnsName
- The DNS name of the clusterport
- The Port the cluster responds onclusterVersion
- The version of Redshift engine softwareclusterParameterGroupName
- The name of the parameter group to be associated with this clusterclusterSubnetGroupName
- The name of a cluster subnet group to be associated with this clusterclusterPublicKey
- The public key for the clusterclusterRevisionNumber
- The specific revision number of the database in the clusterclusterNodes
- The nodes in the cluster. Cluster node blocks are documented belowtagsAll
- A map of tags assigned to the resource, including those inherited from the providerdefaultTags
configuration block.
Cluster nodes (for clusterNodes
) support the following attributes:
nodeRole
- Whether the node is a leader node or a compute nodeprivateIpAddress
- The private IP address of a node within a clusterpublicIpAddress
- The public IP address of a node within a cluster
Timeouts
create
- (Default75M
)update
- (Default75M
)delete
- (Default40M
)
Import
Redshift Clusters can be imported using the clusterIdentifier
, e.g.,