【问题标题】:AWS RDS Cloud formation template for SQL Server适用于 SQL Server 的 AWS RDS Cloudformation 模板
【发布时间】:2016-11-16 10:41:10
【问题描述】:

我对使用 AWS 的东西还很陌生。我想拍摄当前 SQL Server 实例的快照,并使用 AWS Cloud Formation 创建另一个具有相同快照的实例(以便迁移所有现有数据库和数据)和更多存储容量。

我在亚马逊上看到了 https://s3-us-west-2.amazonaws.com/cloudformation-templates-us-west-2/RDS_MySQL_With_Read_Replica.template 之类的东西

但无法根据我的需要进行定制。我不想要所有的 EC2 实例和额外的东西。只是我现有的快照 ID 和将使用快照 ID 克隆的新 SQL Server RDS 实例详细信息

【问题讨论】:

  • 该 CloudFormation 模板创建了一个 MySQL 数据库。您可以将其更改为 MSSQL 并删除您不需要的模板的任何部分,但是,您不需要 CloudFormation 模板来执行此操作。只需使用控制台创建快照并从中创建一个新数据库。这些步骤位于 docs.aws.amazon.com/AmazonRDS/latest/UserGuide/… 的 AWS 文档中
  • 谢谢!我需要一个 CloudFormation 模板,否则这是不可能的,因为我希望我的新数据库存储大小大于快照数据库存储大小。

标签: amazon-web-services aws-rds


【解决方案1】:

使用 CLI 或 PowerShell 手动获取现有数据库的快照,并记下 DBSnapshotIdentifier。

使用 PowerShell 看起来像这样:

New-RDSDBSnapshot -DBSnapshotIdentifier "NameOfYourNewSnapshot" -DBInstanceIdentifier "YourExistingDbIdentifier"

好的,现在您有了快照,您需要更改 CloudFormation 模板以使用 DBSnapshotIdentifier。

更改现有模板以创建 SqlServer 数据库并指定新属性DBSnapshotIdentifier

"MyDB" : {
 "Type" : "AWS::RDS::DBInstance",
 "Properties" : {
     "DBSecurityGroups" : [
        {"Ref" : "MyDbSecurityByEC2SecurityGroup"}, {"Ref" : "MyDbSecurityByCIDRIPGroup"} ],
     "AllocatedStorage" : "20",
     "DBInstanceClass" : "db.t2.micro",
     "Engine" : "sqlserver-ex",
     "MasterUsername" : "MyName",
     "MasterUserPassword" : "MyPassword",
     "DBSnapshotIdentifier" : "NameOfYourNewSnapshot"
 }
}

应该是这样,当您运行堆栈时,它会从您的快照中删除并重新创建您的数据库,因此请务必注意停机时间。

文档:

http://docs.aws.amazon.com/powershell/latest/reference/Index.html
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-dbsnapshotidentifier

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-08-20
    • 2022-01-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-01
    • 1970-01-01
    相关资源
    最近更新 更多