具有云形成和AZ问题的RDS [英] RDS with Cloud Formation and AZ issues
问题描述
我正在使用云形成来创建包含RDS实例的设置。
I am using cloud formation to create a setup containing an RDS instance.
由于以下错误,我在创建RDS实例时遇到了一些困难:
I am having some difficulties creating the RDS Instance on the account of the following error:
DB子网组不满足可用性区域覆盖范围的要求。
请添加子网以覆盖至少2个可用区。当前的
覆盖率:1
DB Subnet Group doesn't meet availability zone coverage requirement. Please add subnets to cover at least 2 availability zones. Current coverage: 1
问题是整个设置位于单个AZ上...我该怎么办去做?只是在另一个仅用于RDS的可用区中创建一个额外的子网?
The problem is that the entire setup is on a single AZ... what am i supposed to do? just create an extra subnet in a different AZ that has nothing in it just for the RDS?
也许AWS可以通过某种方式自动创建该子网并将我拒之门外那一团糟。我不需要额外的子网,也不想为此选择另一个可用区负担。
Maybe there is some way AWS can create that subnet automatically and leave me out of that mess. I don't want that extra subnet and I don't want to burden my users with selecting another AZ just for this.
推荐答案
是的,即使对于完全包含在单个可用区[AZ]中的部署,也必须在不同的AZ中创建一个额外的子网,并将其包含在DB子网组中。此要求的基本原理是支持高可用性多可用区部署,如在RDS用户指南的VPC中使用数据库实例部分:
Yes, even for a deployment entirely contained within a single Availability Zone [AZ], you must create an extra subnet in a different AZ and include it in your DB Subnet Group. The rationale for this requirement is to support high-availability Multi-AZ deployments, as noted in the Working with a DB Instance in a VPC section of the RDS User Guide:
对于多可用区部署,为一个区域中的两个或多个可用区定义一个子网允许Amazon RDS在需要时在另一个可用区中创建新的备用站点。即使在单可用区部署中,您也需要这样做,以防万一您想将它们转换为多可用区部署。
For Multi-AZ deployments, defining a subnet for two or more Availability Zones in a region allows Amazon RDS to create a new standby in another Availability Zone should the need arise. You need to do this even for Single-AZ deployments, just in case you want to convert them to Multi-AZ deployments at some point.
<对于不为此而选择另一个可用区,不会给用户带来负担,有多种方法可以实现。例如,您可以使用 Fn :: GetAZs
和 Fn :: Select 内在函数。如果您允许用户选择主要可用区,则还需要条件,以确保辅助可用区与所选的主要可用区不相等。
As for not burdening your users with selecting another AZ just for this, there are ways to accomplish this. For example, you could select a secondary AZ automatically using the Fn::GetAZs
and Fn::Select intrinsic functions. If you allow the user to select the primary AZ, you'll also need a Condition to ensure the secondary AZ doesn't equal the primary AZ selected.
以下是示例模板摘要:
Parameters:
PrimaryAZ:
Type: AWS::EC2::AvailabilityZone::Name
Description: Primary AZ
Conditions:
IsFirstPrimaryAZ:
Fn::Equals:
- !Ref PrimaryAZ
- Fn::Select [0, {Fn::GetAZs: ""}]
Resources:
Subnet1:
Type: "AWS::EC2::Subnet"
Properties:
AvailabilityZone: !Ref PrimaryAZ
# ...
Subnet2:
Type: "AWS::EC2::Subnet"
Properties:
AvailabilityZone:
Fn::If:
- IsFirstPrimaryAZ
- Fn::Select [1, {Fn::GetAZs: ""}]
- Fn::Select [0, {Fn::GetAZs: ""}]
# ...
这篇关于具有云形成和AZ问题的RDS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!