Fixing error: “Subnet group name can not be blank.”

You may get the following error:

Subnet group name can not be blank. (Service: AmazonRDS; Status Code: 400; Error Code: InvalidParameterValue; Request ID: f29c7cbf-8879-420

Despite the error, the requested property is called DBSubnetGroupName. To fix this, you’ll need to set the property in question, which may require updating your VPC as well.

  VideoPlayerVPC:
    Type: "AWS::EC2::VPC"
    Properties:
      CidrBlock: "192.168.0.0/16"

  SubnetAZ1:
    Type: "AWS::EC2::Subnet"
    Properties:
      CidrBlock: "192.168.0.0/17"
      VpcId: !Ref VideoPlayerVPC
      AvailabilityZone: "us-east-1a"

  SubnetAZ2:
    Type: "AWS::EC2::Subnet"
    Properties:
      CidrBlock: "192.168.128.0/17"
      VpcId: !Ref VideoPlayerVPC
      AvailabilityZone: "us-east-1b"

  DatabaseSecurityGroup:
    Type: "AWS::EC2::SecurityGroup"
    Properties:
      GroupDescription: "Video Collection Database Security Group"
      VpcId: !Ref VideoPlayerVPC

  DatabaseSubnetGroup:
    Type: "AWS::RDS::DBSubnetGroup"
    Properties:
      DBSubnetGroupDescription: "Subnet for the database"
      SubnetIds:
        - !Ref SubnetAZ1
        - !Ref SubnetAZ2

  Database:
    Type: "AWS::RDS::DBCluster"
    Properties:
      Engine: "aurora-postgresql"
      EngineMode: "serverless"
      MasterUserPassword: !Ref DatabasePassword
      MasterUsername: "videoplayer"
      DBSubnetGroupName: !Ref DatabaseSubnetGroup
      VpcSecurityGroupIds:
        - !Ref DatabaseSecurityGroup

Leave a Reply

Your email address will not be published. Required fields are marked *