2016-07-13 56 views
1

我是使用AWS的东西的新手。我想通过AWS Cloud Formation获取当前SQL Server实例的快照并使用相同的快照创建另一个实例(以便迁移所有现有数据库和数据)和更多存储容量。AWS RDS SQL Server的云形成模板

我看到了亚马逊一样https://s3-us-west-2.amazonaws.com/cloudformation-templates-us-west-2/RDS_MySQL_With_Read_Replica.template

的东西,但不能是定制我的需要。我不想要所有的EC2实例和额外的东西。只是我现有的快照ID,并且将与快照ID

+1

这CloudFormation模板创建MySQL数据库。您可以将其更改为MSSQL并删除您不需要的模板的任何部分,但是,您不需要使用CloudFormation模板来执行此操作。只需使用控制台和它的一个新数据库创建一个快照。这些步骤位于http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_CommonTasks.BackupRestore.html – jbird

+0

处的AWS文档中。谢谢!我需要一个CloudFormation模板,否则它不可能,因为我想让我的新数据库存储大小超过快照Db存储大小。 – Srini

回答

1

被克隆新的SQL Server实例RDS细节把你的现有数据库的快照,手动,使用CLI或PowerShell中,注意到DBSnapshotIdentifier的。

使用PowerShell它看起来像这样:

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

好了,现在你有一个快照,你需要改变使用DBSnapshotIdentifier你的CloudFormation模板。

改变现有的模板来创建一个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