Reputation: 6804
I want to update the stack, get this error message:
Properties validation failed for resource RDSDBinstance with message: #: #: only 1 subschema matches out of 2 #/DBSubnetGroupName: failed validation constraint for keyword [pattern]
I'm very confused with #: #
part of the message, google shows there's usually a kind of path pointing to the place with error. No errors in CloudTrail. More confusing, I have 5 environments already which already got this update successfully.
The new code:
subnetDatabase0: # similar for the second subnet, just
# another AZ and third octet of the CidrBlock
Type: AWS::EC2::Subnet
Properties:
VpcId: !Ref VPC
CidrBlock: !Sub "${Cidr}.14.0/24"
AvailabilityZone: !Select [ "0", !GetAZs "" ]
RDSSubnetGroup:
Type: AWS::RDS::DBSubnetGroup
Properties:
DBSubnetGroupName: !Sub "${ProjName}-db-subnetgroup"
DBSubnetGroupDescription: !Sub "${ProjName} DB subnet group"
SubnetIds:
- !Ref subnetDatabase0
- !Ref subnetDatabase1
sgDBInternalAccess:
Type: AWS::EC2::SecurityGroup
Properties:
GroupName: !Sub "${ProjName}-db-internal"
GroupDescription: Enable internal access to DB
VpcId: !Ref VPC
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 5432
ToPort: 5432
CidrIp: !Sub "${Cidr}.4.0/24"
RDSDBinstance:
Type: AWS::RDS::DBInstance
DependsOn:
- DbUser
- DbPwd
Properties:
DBInstanceIdentifier: !Ref SanitizedDomain
DBSubnetGroupName: !Ref RDSSubnetGroup
DBName: classerium_backend
DBInstanceClass: !Ref PgInstType
AllocatedStorage: "20"
Engine: postgres
EngineVersion: !Ref PgVersion
MasterUsername: !GetAtt DbUser.response
MasterUserPassword: !GetAtt DbPwd.passw
StorageType: gp2
BackupRetentionPeriod: 30
CopyTagsToSnapshot: True
DeleteAutomatedBackups: False
VPCSecurityGroups:
- !Ref sgDBInternalAccess
The only difference with the old code is this part was added
StorageType: gp2
BackupRetentionPeriod: 30
CopyTagsToSnapshot: True
DeleteAutomatedBackups: False
What am I doing wrong?
Upvotes: 3
Views: 11232
Reputation: 196
Because the error message seems a bit obscure, it is the second part of the error message that give you a hint about what went wrong.
I got a similar error message for the creation of a RDS instance:
Properties validation failed for resource RDSDemoInstance486243A2 with message: #: #: only 1 subschema matches out of 2 #/MasterUsername: failed validation constraint for keyword [pattern]
The solution was the /MasterUsername hint. I used characters for the database username that were not allowed by AWS. In your case it could have been a problem with illegal characters in your DBSubnetGroupName
Upvotes: 6