AWS PostgreSQL `找不到极光的版本 X`
AWS PostgreSQL `Cannot find version X for aurora`
与 Error creating DB Instance: InvalidParameterCombination: Cannot find version 5.6.10a for aurora-mysql 类似,但对于 Postgres,其原因不同。
* error creating RDS Cluster (mycompany-pulumi-aurora-cluster) Instance: InvalidParameterCombination: Cannot find version 12.6 for aurora
status code: 400, request id: someid
但是 12.6 在该地区对 Aurora PostgreSQL 有效:
$ aws rds describe-db-engine-versions --engine aurora-postgresql --query '*[].[EngineVersion]' --output text --region us-east-2
9.6.3
9.6.6
9.6.8
9.6.9
9.6.11
9.6.12
9.6.16
9.6.17
9.6.18
9.6.19
9.6.21
10.4
10.5
10.6
10.7
10.11
10.12
10.13
10.14
10.14
10.16
11.4
11.6
11.7
11.8
11.9
11.11
12.4
12.6
有两个同时导致此错误的原因:
Aurora 版本是 restricted based on the instance type
您需要 specify the engineVersion
for each cluster instance(以及集群本身)。
结果代码(我使用的是 Pulumi,但同样的逻辑适用于 Terraform、原始 CloudFormation 等)。
const rdsCluster = new aws.rds.Cluster("default", {
clusterIdentifier: config.database.clusterName,
engine: "aurora-postgresql",
// Restricted based on https://docs.amazonaws.cn/en_us/AmazonRDS/latest/AuroraUserGuide/Concepts.DBInstanceClass.html#Concepts.DBInstanceClass.SupportAurora
engineVersion: "12.7",
databaseName: config.database.name,
masterUsername: config.database.username,
masterPassword: config.database.password,
dbSubnetGroupName: rdsSubnetGroup.name,
storageEncrypted: true,
});
// https://www.pulumi.com/docs/reference/pkg/aws/rds/clusterinstance/#engineversion_nodejs
const clusterInstances: Array<aws.rds.ClusterInstance> = [];
for (let range = 0; range < config.database.instanceCount; range++) {
clusterInstances.push(
new aws.rds.ClusterInstance(`clusterInstances-${range}`, {
identifier: `aurora-cluster-demo-${range}`,
clusterIdentifier: rdsCluster.id,
instanceClass: config.database.instanceType,
// Engine must be specified otherwise AWS will give a misleading error about DB versions not being available.
// https://github.com/hashicorp/terraform-provider-aws/issues/2419#issuecomment-347060274
engine: "aurora-postgresql",
engineVersion: "12.7",
})
);
}
与 Error creating DB Instance: InvalidParameterCombination: Cannot find version 5.6.10a for aurora-mysql 类似,但对于 Postgres,其原因不同。
* error creating RDS Cluster (mycompany-pulumi-aurora-cluster) Instance: InvalidParameterCombination: Cannot find version 12.6 for aurora
status code: 400, request id: someid
但是 12.6 在该地区对 Aurora PostgreSQL 有效:
$ aws rds describe-db-engine-versions --engine aurora-postgresql --query '*[].[EngineVersion]' --output text --region us-east-2
9.6.3
9.6.6
9.6.8
9.6.9
9.6.11
9.6.12
9.6.16
9.6.17
9.6.18
9.6.19
9.6.21
10.4
10.5
10.6
10.7
10.11
10.12
10.13
10.14
10.14
10.16
11.4
11.6
11.7
11.8
11.9
11.11
12.4
12.6
有两个同时导致此错误的原因:
Aurora 版本是 restricted based on the instance type
您需要 specify the
engineVersion
for each cluster instance(以及集群本身)。
结果代码(我使用的是 Pulumi,但同样的逻辑适用于 Terraform、原始 CloudFormation 等)。
const rdsCluster = new aws.rds.Cluster("default", {
clusterIdentifier: config.database.clusterName,
engine: "aurora-postgresql",
// Restricted based on https://docs.amazonaws.cn/en_us/AmazonRDS/latest/AuroraUserGuide/Concepts.DBInstanceClass.html#Concepts.DBInstanceClass.SupportAurora
engineVersion: "12.7",
databaseName: config.database.name,
masterUsername: config.database.username,
masterPassword: config.database.password,
dbSubnetGroupName: rdsSubnetGroup.name,
storageEncrypted: true,
});
// https://www.pulumi.com/docs/reference/pkg/aws/rds/clusterinstance/#engineversion_nodejs
const clusterInstances: Array<aws.rds.ClusterInstance> = [];
for (let range = 0; range < config.database.instanceCount; range++) {
clusterInstances.push(
new aws.rds.ClusterInstance(`clusterInstances-${range}`, {
identifier: `aurora-cluster-demo-${range}`,
clusterIdentifier: rdsCluster.id,
instanceClass: config.database.instanceType,
// Engine must be specified otherwise AWS will give a misleading error about DB versions not being available.
// https://github.com/hashicorp/terraform-provider-aws/issues/2419#issuecomment-347060274
engine: "aurora-postgresql",
engineVersion: "12.7",
})
);
}