AWSTemplateFormatVersion: "2010-09-09" Description: Creates a RedShift cluster within a VPC. **WARNING** This template creates an Amazon Redshift cluster of the size and instance type that you specify. You will be billed for the AWS resources used if you create a stack from this template. (qs-1nlkhq1p3) Parameters: DatabaseName: Description: Redshift database name Type: String DatabasePort: Default: "5439" Description: The port that Amazon Redshift will listen on, which will be allowed through the security group. Type: String NodeType: AllowedValues: - ra3.4xlarge - ra3.16xlarge - dc2.large - dc2.8xlarge ConstraintDescription: must be a valid RedShift node type. Default: dc2.large Description: The node type to be provisioned for the redshift cluster Type: String NumberOfNodes: Default: "1" Description: The number of compute nodes in the redshift cluster. Type: Number PubliclyAccessible: AllowedValues: - "true" - "false" Default: "false" Description: Indicates whether the cluster can be accessed from a public network. Type: String QSRedshiftRoleARN: Description: QSRedshiftRole ARN Type: String RedshiftEncrypted: AllowedValues: - "true" - "false" Default: "false" Description: Determines whether the Redshift data is encrypted at rest Type: String RedshiftInboundCIDR: AllowedPattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(1[6-9]|2[0-8]))$ ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-28 Description: CIDR block that gets access to Redshift Type: String RedshiftPassword: Description: The password that is associated with the master user account for the cluster that is being created. NoEcho: "true" Type: String RedshiftSnapshotRetention: Description: Retention period for Redshift snapshots in days. If set to 0, snapshots are disabled. Default: 1 Type: Number RedshiftUsername: Description: The user name that is associated with the master user account for the cluster that is being created Type: String SubnetId1: Description: Redshift subnet id 1. Type: AWS::EC2::Subnet::Id SubnetId2: Description: Redshift subnet id 2. Type: AWS::EC2::Subnet::Id VpcId: Description: VPC id. Type: AWS::EC2::VPC::Id Mappings: RegionMap: us-east-1: KinesisFirehoseCIDR: 52.70.63.192/27 us-east-2: KinesisFirehoseCIDR: 13.58.135.96/27 us-west-2: KinesisFirehoseCIDR: 52.89.255.224/27 eu-west-1: KinesisFirehoseCIDR: 52.19.239.192/27 eu-central-1: KinesisFirehoseCIDR: 35.158.127.160/27 ap-southeast-1: KinesisFirehoseCIDR: 13.228.64.192/27 eu-west-2: KinesisFirehoseCIDR: 18.130.1.96/27 Conditions: IsMultiNodeCluster: !Not - !Equals - !Ref "NumberOfNodes" - "1" IsPublic: !Equals - !Ref "PubliclyAccessible" - "true" Resources: RedshiftCluster: Properties: AutomatedSnapshotRetentionPeriod: !Ref "RedshiftSnapshotRetention" ClusterSubnetGroupName: !Ref "RedshiftClusterSubnetGroup" ClusterType: !If - IsMultiNodeCluster - multi-node - single-node DBName: !Ref "DatabaseName" Encrypted: !Ref "RedshiftEncrypted" IamRoles: - !Ref "QSRedshiftRoleARN" MasterUserPassword: !Ref "RedshiftPassword" MasterUsername: !Ref "RedshiftUsername" NodeType: !Ref "NodeType" NumberOfNodes: !If - IsMultiNodeCluster - !Ref "NumberOfNodes" - !Ref "AWS::NoValue" Port: !Ref "DatabasePort" PubliclyAccessible: !If - IsPublic - true - !Ref "AWS::NoValue" VpcSecurityGroupIds: - !Ref "RedshiftSecurityGroup" Type: AWS::Redshift::Cluster RedshiftClusterSubnetGroup: Properties: Description: Cluster subnet group SubnetIds: - !Ref "SubnetId1" - !Ref "SubnetId2" Type: AWS::Redshift::ClusterSubnetGroup RedshiftSecurityGroup: Properties: GroupDescription: Enable JDBC port SecurityGroupIngress: - CidrIp: !Ref "RedshiftInboundCIDR" FromPort: !Ref "DatabasePort" IpProtocol: tcp ToPort: !Ref "DatabasePort" - CidrIp: !FindInMap - RegionMap - !Ref "AWS::Region" - KinesisFirehoseCIDR FromPort: !Ref "DatabasePort" IpProtocol: tcp ToPort: !Ref "DatabasePort" VpcId: !Ref "VpcId" Type: AWS::EC2::SecurityGroup Outputs: ConnectionURL: Description: Cluster endpoint Value: !Join - "" - - jdbc:redshift:// - !GetAtt "RedshiftCluster.Endpoint.Address" - ":" - !GetAtt "RedshiftCluster.Endpoint.Port" - / - !Ref "DatabaseName"