gpt4 book ai didi

typescript - 资源处理程序返回消息 : "Model validation failed (#/VpcSubnetIds: expected minimum item count: 2, found: 1)"

转载 作者:行者123 更新时间:2023-12-03 07:41:11 26 4
gpt4 key购买 nike

我正在执行以下操作:

const vpc = ec2.Vpc.fromLookup(this, "vpcDefault", { vpcId: "someid" });
const instanceType: ec2.InstanceType = ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.LARGE);
const subnetGroup = rds.SubnetGroup.fromSubnetGroupName(this, "subnetGroup", "test subnet group")
const secretKey = kms.Key.fromKeyArn(this, "kmsKey", "someresourcearn")

const secretSecret = new secrets.Secret(this, "secretSecret", {
encryptionKey: secretKey,
secretName: "onTheSpotGeneratedKeyFromKMS",
});

// create new DB Instance
const dbInstance = new rds.DatabaseInstance(this, "testDbInstance", {
vpc,
subnetGroup,
instanceType,
allocatedStorage: 10,
storageEncrypted: true,
databaseName: "test_cdk_db",
instanceIdentifier: "test-db",
engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_13 }),
});

const dbProxy = new rds.DatabaseProxy(this, "dbProxy", {
proxyTarget: rds.ProxyTarget.fromInstance(dbInstance),
secrets: [secretSecret],
vpc,
});

我看到以下错误:

创建失败 | AWS::RDS::DBProxy | AWS::RDS::DBProxy数据库代理

Resource handler returned message: "Model validation failed (#/VpcSubnetIds: expected minimum item count: 2, found: 1)" (RequestToken: XXX, HandlerErrorCode: InvalidRequest)

这个问题似乎是在我创建 dbProxy 时发生的。有什么想法吗?

编辑:这些是我的子网。 enter image description here

最佳答案

该错误表示您的子网组不正确:

subnetGroup = rds.SubnetGroup.fromSubnetGroupName(this, "subnetGroup", "test subnet group")

未显示您具体如何创建该组,但该组似乎只有一个子网。它必须有two subnets不同的可用区:

Your VPC must have at least two subnets. These subnets must be in two different Availability Zones in the AWS Region where you want to deploy your DB instance.

关于typescript - 资源处理程序返回消息 : "Model validation failed (#/VpcSubnetIds: expected minimum item count: 2, found: 1)",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67830681/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com