01 CloudFormation template (JSON):
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Enable Deferred Maintenance",
"Parameters": {
"ClusterName": {
"Default": "cc-redshift-cluster",
"Description": "Redshift cluster name",
"Type": "String",
"MinLength": "1",
"MaxLength": "63",
"AllowedPattern": "^[0-9a-zA-Z-/]*$",
"ConstraintDescription": "Must begin with a letter and must not end with a hyphen or contain two consecutive hyphens."
},
"ClusterNodeType": {
"Default": "dc2.large",
"Description": "Cluster node type",
"Type": "String",
"ConstraintDescription": "Must provide a valid cluster node type."
},
"DBName": {
"Description": "Cluster database name",
"Type": "String",
"MinLength": "1",
"MaxLength": "64",
"AllowedPattern": "[a-zA-Z][a-zA-Z0-9]*",
"ConstraintDescription": "Must begin with a letter and contain only alphanumeric characters."
},
"DBUsername": {
"Description": "Master username for cluster database access",
"Type": "String",
"MinLength": "1",
"MaxLength": "16",
"AllowedPattern": "[a-zA-Z][a-zA-Z0-9]*",
"ConstraintDescription": "Must begin with a letter and contain only alphanumeric characters."
},
"DBPassword": {
"NoEcho": "true",
"Description": "Password for cluster database access",
"Type": "String",
"MinLength": "8",
"MaxLength": "41",
"AllowedPattern": "[a-zA-Z0-9]*",
"ConstraintDescription": "Must contain only alphanumeric characters."
}
},
"Resources": {
"RedshiftCluster": {
"Type": "AWS::Redshift::Cluster",
"Properties": {
"ClusterIdentifier": {
"Ref": "ClusterName"
},
"DBName": {
"Ref": "DBName"
},
"MasterUsername": {
"Ref": "DBUsername"
},
"MasterUserPassword": {
"Ref": "DBPassword"
},
"NodeType": {
"Ref": "ClusterNodeType"
},
"ClusterType": "single-node",
"AllowVersionUpgrade": true,
"DeferMaintenance": true,
"DeferMaintenanceDuration": 30
}
}
}
}
02 CloudFormation template (YAML):
AWSTemplateFormatVersion: '2010-09-09'
Description: Enable Deferred Maintenance
Parameters:
ClusterName:
Default: cc-redshift-cluster
Description: Redshift cluster name
Type: String
MinLength: '1'
MaxLength: '63'
AllowedPattern: ^[0-9a-zA-Z-/]*$
ConstraintDescription: Must begin with a letter and must not end with a hyphen
or contain two consecutive hyphens.
ClusterNodeType:
Default: dc2.large
Description: Cluster node type
Type: String
ConstraintDescription: Must provide a valid cluster node type.
DBName:
Description: Cluster database name
Type: String
MinLength: '1'
MaxLength: '64'
AllowedPattern: '[a-zA-Z][a-zA-Z0-9]*'
ConstraintDescription: Must begin with a letter and contain only alphanumeric
characters.
DBUsername:
Description: Master username for cluster database access
Type: String
MinLength: '1'
MaxLength: '16'
AllowedPattern: '[a-zA-Z][a-zA-Z0-9]*'
ConstraintDescription: Must begin with a letter and contain only alphanumeric
characters.
DBPassword:
NoEcho: 'true'
Description: Password for cluster database access
Type: String
MinLength: '8'
MaxLength: '41'
AllowedPattern: '[a-zA-Z0-9]*'
ConstraintDescription: Must contain only alphanumeric characters.
Resources:
RedshiftCluster:
Type: AWS::Redshift::Cluster
Properties:
ClusterIdentifier: !Ref 'ClusterName'
DBName: !Ref 'DBName'
MasterUsername: !Ref 'DBUsername'
MasterUserPassword: !Ref 'DBPassword'
NodeType: !Ref 'ClusterNodeType'
ClusterType: single-node
AllowVersionUpgrade: true
DeferMaintenance: true
DeferMaintenanceDuration: 30