首页 > 解决方案 > "DBInstanceClass" property of resource type "AWS::RDS::DBInstance"

问题描述

For the below MySQL database instance, created with below template:

  DbInstance:
    Type: "AWS::RDS::DBInstance"
    Properties:
      DBSubnetGroupName: { "Ref": "DbSubnetGroup" }
      MultiAZ: "true"
      AvailabilityZone: { "Ref": "DbAvailabilityZone" }
      AllocatedStorage: 8
      StorageType: "gp2"
      DBInstanceClass: "db.t2.micro"
      DBName: "someapp"
      Engine: "MySQL"
      EngineVersion: "5.6"
      MasterUsername: { "Ref": "DbUsername" }
      MasterUserPassword: { "Ref": "DbPassword" }
      VPCSecurityGroups:
        - { "Ref": "DbSecurityGroup" }
      Tags:
        - Key: "Name"
          Value: { "Fn::Join": ["", [ { "Ref": "AWS::StackName" }, "-db" ] ] }


  DbSecurityGroup:
    Type: "AWS::EC2::SecurityGroup"
    Properties:
      GroupDescription: "someapp DB Security Group"
      VpcId: { "Ref": "VpcId" }
      SecurityGroupIngress:
        - IpProtocol: "tcp"
          FromPort: "3306"
          ToPort: "3306"
          SourceSecurityGroupId: { "Ref": "EC2InstanceSecurityGroup" }

  DbSubnetGroup:
    Type: "AWS::RDS::DBSubnetGroup"
    Properties:
      DBSubnetGroupDescription: "someapp DB Subnet Group"
      SubnetIds: { "Ref": "DbSubnets" }
      Tags:
        - Key: "Name"
          Value: { "Fn::Join": ["", [ { "Ref": "AWS::StackName" }, "-db-subnet-group" ] ] }

my understanding is,

RDS is a computer(EC2 instance), where an EC2 instance will be launched on every subnet of "DbSubnetGroup".

This computer is of "db.t2.micro" EC2 instance type.

Each computer will host a MySQL database instance(someapp).

Multiple subnets in "DbSubnetGroup" can be in same or different availability zones, because MultiAZ: "true"


If this is the right understanding then,

Is DbSecurityGroup assigned to each EC2 instance type(DBInstanceClass) of "db.t2.micro"?

标签: amazon-web-servicesamazon-ec2amazon-rds

解决方案


RDS 是一台计算机(EC2 实例),其中将在“DbSubnetGroup”的每个子网上启动一个 EC2 实例。

是的,这是正确的,RDS 托管在 EC2 实例上,但您不需要管理这些实例。

这台计算机属于“db.t2.micro”EC2 实例类型。

是的,RDS 实例类型由用户在配置时选择。因此,如果您选择了微类型,那么 EC2 实例应该是相同的类型。

每台计算机将托管一个 MySQL 数据库实例(someapp)。

是的,EC2 实例将托管数据库。

"DbSubnetGroup" 中的多个子网可以位于相同或不同的可用区,因为 MultiAZ: "true"

如果您选择了多可用区数据库,则将使用不同的可用区来设置主数据库和辅助数据库。它们不会在同一个 AZ 中,因为它不会提供 AZ 冗余。

如果这是正确的理解,

DbSecurityGroup 是否分配给“db.t2.micro”的每个 EC2 实例类型(DBInstanceClass)?

是的,安全组将分配给 RDS 设置中的每个 EC2 实例。


推荐阅读