当我在堆栈中运行它时,我正在使用对流层创建一个 CloudFormation 模板,它只创建一个可用区。我在每个子网中有 2 个私有子网和 1 个可用区。文件 create VPC, subnets, rounte internet gateway, EC2 instances and RDS instance
,除了它在 RDS 中为单个可用区创建的所有内容,我也进行了设置,MultiAZ = true
但仍然失败。
RDSdatabase = t.add_resource(
rds.DBInstance(
"RDSDatabase",
DBName=Client+'RDSDatabase',
AllocatedStorage=Ref(dballocatedstorage),
DBInstanceClass=Ref(dbclass),
Engine="MySQL",
EngineVersion="5.5",
MasterUsername=Ref(dbuser),
MasterUserPassword=Ref(dbpassword),
DBSubnetGroupName=Ref(mydbsubnetgroup),
VPCSecurityGroups=[Ref(myvpcsecuritygroup)],
MultiAZ=True,
Tags=Tags(
Application=ref_stack_name, Client=Client, Name=Client+'_RDS-Master_1'),
))
这是我的子网组---
mydbsubnetgroup = t.add_resource(
rds.DBSubnetGroup(
"MyDBSubnetGroup",
DBSubnetGroupDescription="Subnets available for the RDS DB Instance",
SubnetIds=[Ref(db_subnet_AZ_1),Ref(db_subnet_AZ_2)],
Tags=Tags(Name=Join("-", [Ref("AWS::StackName"), "DBSubnetGroup"]),
),
))