'CloudFormation error: "only 1 subschema matches out of 2"
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?
amazon-web-services">
amazon-web-servicesamazon-cloudformation">
amazon-cloudformationamazon-rds">
amazon-rds
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
