AWS Amazon Redshift Cluster
This page shows how to write Terraform and CloudFormation for Amazon Redshift Cluster and write them securely.
aws_redshift_cluster (Terraform)
The Cluster in Amazon Redshift can be configured in Terraform with the resource name aws_redshift_cluster. The following sections describe 5 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "aws_redshift_cluster" "redshift_cluster_disabling_logs" {
cluster_identifier = "redshift-cluster"
logging {
enable = false # Noncompliant {{Make sure that disabling logging is safe here.}}
}
}
resource "aws_redshift_cluster" "ca" {
cluster_identifier = "tf-ca-cluster"
database_name = "mydb"
master_username = "foo"
master_password = "Mustbe8characters"
node_type = "dc2.large"
resource "aws_redshift_cluster" "redshiftEncryptedWithNoKms" {
cluster_identifier = "tf-redshift-cluster"
database_name = "mydb"
master_username = "foo"
master_password = "Mustbe8characters"
node_type = "dc1.large"
resource "aws_redshift_cluster" "ca" {
cluster_identifier = "tf-ca-cluster"
database_name = "mydb"
master_username = "foo"
master_password = "Mustbe8characters"
node_type = "dc2.large"
resource "aws_redshift_cluster" "encrypted_not_set" {
cluster_identifier = "my-redshift-cluster"
database_name = "mydb"
master_username = "admin"
master_password = "F0obarbaz"
node_type = "dc2.large"
Parameters
-
allow_version_upgradeoptional - bool -
arnoptional computed - string -
automated_snapshot_retention_periodoptional - number -
availability_zoneoptional computed - string -
cluster_identifierrequired - string -
cluster_parameter_group_nameoptional computed - string -
cluster_public_keyoptional computed - string -
cluster_revision_numberoptional computed - string -
cluster_security_groupsoptional computed - set of string -
cluster_subnet_group_nameoptional computed - string -
cluster_typeoptional computed - string -
cluster_versionoptional - string -
database_nameoptional computed - string -
dns_nameoptional computed - string -
elastic_ipoptional - string -
encryptedoptional - bool -
endpointoptional computed - string -
enhanced_vpc_routingoptional computed - bool -
final_snapshot_identifieroptional - string -
iam_rolesoptional computed - set of string -
idoptional computed - string -
kms_key_idoptional computed - string -
master_passwordoptional - string -
master_usernameoptional - string -
node_typerequired - string -
number_of_nodesoptional - number -
owner_accountoptional - string -
portoptional - number -
preferred_maintenance_windowoptional computed - string -
publicly_accessibleoptional - bool -
skip_final_snapshotoptional - bool -
snapshot_cluster_identifieroptional - string -
snapshot_identifieroptional - string -
tagsoptional - map from string to string -
vpc_security_group_idsoptional computed - set of string -
logginglist block-
bucket_nameoptional computed - string -
enablerequired - bool -
s3_key_prefixoptional computed - string
-
-
snapshot_copylist block-
destination_regionrequired - string -
grant_nameoptional - string -
retention_periodoptional - number
-
-
timeoutssingle block
Explanation in Terraform Registry
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.
AWS::Redshift::Cluster (CloudFormation)
The Cluster in Redshift can be configured in CloudFormation with the resource name AWS::Redshift::Cluster. The following sections describe 10 examples of how to use the resource and its parameters.
Example Usage from GitHub
Type: AWS::Redshift::Cluster
Properties:
AllowVersionUpgrade: true
AutomatedSnapshotRetentionPeriod: 5
ClusterIdentifier: dw-production-redshift-cluster
ClusterParameterGroupName: !Ref RedshiftParameterGroup
Type: "AWS::Redshift::Cluster"
Properties:
DBName: "mydb"
MasterUsername: "master"
MasterUserPassword:
Ref: "MasterUserPassword"
Type: "AWS::Redshift::Cluster"
Properties:
DBName: "mydb"
MasterUsername: "master"
MasterUserPassword:
Ref: "MasterUserPassword"
Type: "AWS::Redshift::Cluster"
Properties:
DBName: "mydb"
MasterUsername: "master"
MasterUserPassword:
Ref: "MasterUserPassword"
Type: "AWS::Redshift::Cluster"
Properties:
DBName: "mydb"
MasterUsername: "master"
MasterUserPassword:
Ref: "MasterUserPassword"
"resourceType": "AWS::Redshift::Cluster",
"resourceId": "cluster-with-kms",
"resourceName": "cluster-with-kms",
"awsRegion": "us-west-2",
"availabilityZone": "us-west-2c",
"resourceCreationTime": "2016-10-13T22:26:39.723Z",
"Type": "AWS::Redshift::ClusterSecurityGroup",
"Properties": {
"Description" : "Security group to determine where connections to the Amazon Redshift cluster can come from"
}
},
"redshiftSecurityGroupIngress" : {
"Type": "AWS::Redshift::ClusterSecurityGroup",
"Properties": {
"Description" : "Security group to determine where connections to the Amazon Redshift cluster can come from"
}
},
"redshiftSecurityGroupIngress" : {
"Type": "AWS::Redshift::Cluster",
"Properties": {
"NodeType": "ds2.xlarge",
"ClusterType": "single-node",
"Tags": [
{
"resourceType" : "AWS::Redshift::Cluster",
"properties" : [ {
"propertyName" : "AllowVersionUpgrade",
"propertyType" : "Boolean",
"required" : false
}, {
Parameters
-
ClusterIdentifieroptional - String -
MasterUsernamerequired - String -
MasterUserPasswordrequired - String -
NodeTyperequired - String -
AllowVersionUpgradeoptional - Boolean -
AutomatedSnapshotRetentionPeriodoptional - Integer -
AvailabilityZoneoptional - String -
ClusterParameterGroupNameoptional - String -
ClusterTyperequired - String -
ClusterVersionoptional - String -
ClusterSubnetGroupNameoptional - String -
DBNamerequired - String -
ElasticIpoptional - String -
Encryptedoptional - Boolean -
HsmClientCertificateIdentifieroptional - String -
HsmConfigurationIdentifieroptional - String -
KmsKeyIdoptional - String -
NumberOfNodesoptional - Integer -
Portoptional - Integer -
PreferredMaintenanceWindowoptional - String -
PubliclyAccessibleoptional - Boolean -
ClusterSecurityGroupsoptional - List -
IamRolesoptional - List -
Tagsoptional - List of Tag -
VpcSecurityGroupIdsoptional - List -
SnapshotClusterIdentifieroptional - String -
SnapshotIdentifieroptional - String -
OwnerAccountoptional - String -
LoggingPropertiesoptional - LoggingProperties -
Endpointoptional - Endpoint -
DestinationRegionoptional - String -
SnapshotCopyRetentionPeriodoptional - Integer -
SnapshotCopyGrantNameoptional - String -
ManualSnapshotRetentionPeriodoptional - Integer -
SnapshotCopyManualoptional - Boolean -
AvailabilityZoneRelocationoptional - Boolean -
AvailabilityZoneRelocationStatusoptional - String -
AquaConfigurationStatusoptional - String -
Classicoptional - Boolean -
EnhancedVpcRoutingoptional - Boolean -
MaintenanceTrackNameoptional - String -
DeferMaintenanceoptional - Boolean -
DeferMaintenanceStartTimeoptional - String -
DeferMaintenanceEndTimeoptional - String -
DeferMaintenanceDurationoptional - Integer -
RevisionTargetoptional - String -
ResourceActionoptional - String -
RotateEncryptionKeyoptional - Boolean
Explanation in CloudFormation Registry
Specifies a cluster. A cluster is a fully managed data warehouse that consists of a set of compute nodes.
To create a cluster in Virtual Private Cloud (VPC), you must provide a cluster subnet group name. The cluster subnet group identifies the subnets of your VPC that Amazon Redshift uses when creating the cluster. For more information about managing clusters, go to Amazon Redshift Clusters in the Amazon Redshift Cluster Management Guide.
Frequently asked questions
What is AWS Amazon Redshift Cluster?
AWS Amazon Redshift Cluster is a resource for Amazon Redshift of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.
Where can I find the example code for the AWS Amazon Redshift Cluster?
For Terraform, the SonarSource/sonar-iac, gilyas/infracost and storebot/pr_demo_flat source code examples are useful. See the Terraform Example section for further details.
For CloudFormation, the judithribeiro/Data-Engineer, jmelt5056/WebGoat.NET and iactest/newKaiMonkey source code examples are useful. See the CloudFormation Example section for further details.