{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "AWS CloudFormation Sample Template: Redshift cluster",
"Parameters": {
"DatabaseName": {
"Description": "The name of the first database to be created when the redshift cluster is created",
"Type": "String",
"Default": "defaultdb",
"AllowedPattern": "([a-z]|[0-9])+"
},
"ClusterType": {
"Description": "The type of the cluster",
"Type": "String",
"Default": "single-node",
"AllowedValues": [
"single-node",
"multi-node"
]
},
"NumberOfNodes": {
"Description": "The number of compute nodes in the redshift cluster. When cluster type is specified as: 1) single-node, the NumberOfNodes parameter should be specified as 1, 2) multi-node, the NumberOfNodes parameter should be greater than 1",
"Type": "Number",
"Default": "1"
},
"NodeType": {
"Description": "The node type to be provisioned for the redshift cluster",
"Type": "String",
"Default": "dw2.large"
},
"MasterUsername": {
"Description": "The user name associated with the master user account for the redshift cluster that is being created",
"Type": "String",
"Default": "defaultuser",
"AllowedPattern": "([a-z])([a-z]|[0-9])*",
"NoEcho": "true"
},
"MasterUserPassword": {
"Description": "The password associated with the master user account for the redshift cluster that is being created. ",
"Type": "String",
"NoEcho": "true"
}
},
"Conditions": {
"IsMultiNodeCluster": {
"Fn::Equals": [
{
"Ref": "ClusterType"
},
"multi-node"
]
}
},
"Resources": {
"RedshiftCluster": {
"Type": "AWS::Redshift::Cluster",
"Properties": {
"ClusterType": {
"Ref": "ClusterType"
},
"NumberOfNodes": {
"Fn::If": [
"IsMultiNodeCluster",
{
"Ref": "NumberOfNodes"
},
{
"Ref": "AWS::NoValue"
}
]
},
"NodeType": {
"Ref": "NodeType"
},
"DBName": {
"Ref": "DatabaseName"
},
"MasterUsername": {
"Ref": "MasterUsername"
},
"MasterUserPassword": {
"Ref": "MasterUserPassword"
},
"ClusterParameterGroupName": {
"Ref": "RedshiftClusterParameterGroup"
}
},
"DeletionPolicy": "Snapshot"
},
"RedshiftClusterParameterGroup": {
"Type": "AWS::Redshift::ClusterParameterGroup",
"Properties": {
"Description": "Cluster parameter group",
"ParameterGroupFamily": "redshift-1.0",
"Parameters": [
{
"ParameterName": "enable_user_activity_logging",
"ParameterValue": "true"
}
]
}
}
},
"Outputs": {
"ClusterEndpoint": {
"Value": {
"Fn::Join": [
":",
[
{
"Fn::GetAtt": [
"RedshiftCluster",
"Endpoint.Address"
]
},
{
"Fn::GetAtt": [
"RedshiftCluster",
"Endpoint.Port"
]
}
]
]
}
}
}
}