最后再看看如何用PowerShell 管理AWS的DNS服务。
Route 53的启用很简单,可以在AWS上注册新的域名 也可以在其他网站注册新的域名再迁徙过来。豆子在GoDaddy上已经有一个域名 beanxyz.com了,管理界面挪到Route 53 很简单,在Route 53新建一个HostedZone beanxyz.com, 他会自动生成对应的NS 记录,在我的GoDaddy里面把NS记录指向AWS的NS就行了。
手动配置很简单,如下所示,我创建了一个blog.beanxyz.com 的记录
下面简单的演示用PowerShell来修改这个记录,修改的操作其实是删除和创建两个步骤
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
$domain = Get-R53HostedZonesByName -DNSName beanxyz.com
$hostid = $domain .id.Split( "/" )[2]
Get-R53ResourceRecordSet -HostedZoneId $domain .id.Split( "/" )[2] | select -ExpandProperty ResourceRecordSets
$change1 = New-Object Amazon.Route53.Model.Change
$change1 .Action = "DELETE"
$change1 .ResourceRecordSet = New-Object Amazon.Route53.Model.ResourceRecordSet
$change1 .ResourceRecordSet.Name = "blog.beanxyz.com"
$change1 .ResourceRecordSet.Type = "A"
$change1 .ResourceRecordSet.TTL = 300
$change1 .ResourceRecordSet.ResourceRecords.Add(@{Value= "52.63.115.148" })
$change3 = New-Object Amazon.Route53.Model.Change
$change3 .Action = "CREATE"
$change3 .ResourceRecordSet = New-Object Amazon.Route53.Model.ResourceRecordSet
$change3 .ResourceRecordSet.Name = "blog.beanxyz.com"
$change3 .ResourceRecordSet.Type = "A"
$change3 .ResourceRecordSet.TTL = 300
$change3 .ResourceRecordSet.ResourceRecords.Add(@{Value= "52.63.241.219" })
$params = @{
HostedZoneId= $hostid
ChangeBatch_Comment= "Changes the A record for blog.beanxyz.com from 52.63.115.148 to 52.63.241.219"
ChangeBatch_Change= $change1 , $change3
} Edit-R53ResourceRecordSet @params
|
执行成功
稍等片刻之后 DNS就可以成功解析了
本文转自 beanxyz 51CTO博客,原文链接:http://blog.51cto.com/beanxyz/1827402,如需转载请自行联系原作者