AWS Amazon Redshift Subnet Group

This page shows how to write Terraform and CloudFormation for Amazon Redshift Subnet Group and write them securely.

aws_redshift_subnet_group (Terraform)

The Subnet Group in Amazon Redshift can be configured in Terraform with the resource name aws_redshift_subnet_group. The following sections describe 1 example of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L7
resource "aws_redshift_subnet_group" "this" {
  description = var.description
  name        = var.name
  subnet_ids  = var.subnet_ids
  tags        = var.tags
}

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Creates a new Amazon Redshift subnet group. You must provide a list of one or more subnets in your existing Amazon Virtual Private Cloud (Amazon VPC) when creating Amazon Redshift subnet group.

AWS::Redshift::ClusterSubnetGroup (CloudFormation)

The ClusterSubnetGroup in Redshift can be configured in CloudFormation with the resource name AWS::Redshift::ClusterSubnetGroup. The following sections describe 10 examples of how to use the resource and its parameters.

Example Usage from GitHub

Underutilized-Amazon-Redshift-Clusters_cfn.yml#L34
    Type: 'AWS::Redshift::ClusterSubnetGroup'
    Properties:
      Description: "SubnetGroup created to testing C7N policies"
      SubnetIds: !Ref SubnetID

  NotificationTopic:
redshift.yml#L33
    Type: AWS::Redshift::ClusterSubnetGroup
    Properties:
      Description: Redshift Subnet group
      SubnetIds:
        - !Ref RedshiftSubnet

redshift.yml#L33
    Type: AWS::Redshift::ClusterSubnetGroup
    Properties:
      Description: Redshift Subnet group
      SubnetIds:
        - !Ref RedshiftSubnet

redshift-template.yml#L21
    Type: AWS::Redshift::ClusterSubnetGroup
    Properties:
      Description: "cluster subnet group"
      SubnetIds:
        - !Ref Subnet1
        - !Ref Subnet2
redshift-cluster.yml#L16
    Type: AWS::Redshift::ClusterSubnetGroup
    Properties:
      Description: RedshiftSNG
      SubnetIds:
        - !Ref Subnet1Id
        - !Ref Subnet2Id
RedshiftClusterSubnetGroupSpecification.json#L4
    "AWS::Redshift::ClusterSubnetGroup": {
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-clustersubnetgroup.html",
      "Properties": {
        "Description": {
          "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-clustersubnetgroup.html#cfn-redshift-clustersubnetgroup-description",
          "PrimitiveType": "String",
RedshiftClusterSubnetGroupSpecification.json#L4
    "AWS::Redshift::ClusterSubnetGroup": {
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-clustersubnetgroup.html",
      "Properties": {
        "Description": {
          "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-clustersubnetgroup.html#cfn-redshift-clustersubnetgroup-description",
          "PrimitiveType": "String",
redshift_subnetgroup.json#L4
    "Type" : "AWS::Redshift::ClusterSubnetGroup",
    "Properties" : {
      "Description" : "{{settings["description"]}}",
      "SubnetIds" : [
      {% for subnet in settings["subnets"] %}
        { "Fn::ImportValue" : {"Fn::Sub" : ["${VPCStack}-Subnet-{{subnet}}", {"VPCStack":  {"Ref": "VPCStack"}}] }}{% if not loop.last %},{% endif %}
RedshiftClusterSubnetGroupSpecification.json#L22
    "AWS::Redshift::ClusterSubnetGroup": {
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-clustersubnetgroup.html",
      "Properties": {
        "Description": {
          "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-clustersubnetgroup.html#cfn-redshift-clustersubnetgroup-description",
          "PrimitiveType": "String",
RedshiftClusterSubnetGroupSpecification.json#L22
    "AWS::Redshift::ClusterSubnetGroup": {
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-clustersubnetgroup.html",
      "Properties": {
        "Description": {
          "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-clustersubnetgroup.html#cfn-redshift-clustersubnetgroup-description",
          "PrimitiveType": "String",

Parameters

Explanation in CloudFormation Registry

Specifies an Amazon Redshift subnet group. You must provide a list of one or more subnets in your existing Amazon Virtual Private Cloud (Amazon VPC) when creating Amazon Redshift subnet group.

For information about subnet groups, go to Amazon Redshift Cluster Subnet Groups in the Amazon Redshift Cluster Management Guide.

Frequently asked questions

What is AWS Amazon Redshift Subnet Group?

AWS Amazon Redshift Subnet Group 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 Subnet Group?

For Terraform, the niveklabs/aws source code example is useful. See the Terraform Example section for further details.

For CloudFormation, the felipekiko/finops-c7n, andresionek91/bootcamp-turma-5 and cfascina/hb-data-engineering source code examples are useful. See the CloudFormation Example section for further details.