我们使用负载均衡的自动扩展Web服务器(IIS)在Amazon EC2上运行我们的Web应用程序.
在自动扩展之前,我们的部署过程是文件复制到几个大型Web服务器.
现在,通过自动缩放,我们可以随意显示和消失5到12个Web服务器,从而使部署过程更加困难.
为了解决这个问题,我编写了一个powershell脚本,用于检索自动扩展组中的服务器IP,并使用MSDeploy将它们与指定的部署服务器同步(在自动扩展组之外的负载均衡器中).然后,它会创建一个新的AMI并更新自动缩放配置.
一切似乎都很好,在重建部署服务器之后,同步脚本不会更新网站的运行状态.所以我可以将网站置于维护模式.
我想知道:
其他人如何解决问题(特别是在autoscaling ec2中同步iis服务器)(在没有WFF的情况下为IIS 8)
为什么启动/停止同步失败
码:
Set-AWSCredentials -AccessKey XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -SecretKey XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Set-DefaultAWSRegion "us-west-2"
$date = get-date
$dateString = $date.ToString("yyyyMMdd-HHmm")
$name = $dateString + "Web"
$imageId = new-ec2image -InstanceId x-xxxxxxxx -Name $name -NoReboot 1
$launchConfiguration = New-ASLaunchConfiguration -LaunchConfigurationName $name -ImageId $imageId -InstanceType "m3.medium" -SecurityGroups @('Web') -InstanceMonitoring_Enabled $false
Update-AsAutoScalingGroup -AutoScalingGroupName "XxxxxxxxxxxxXxxxxxxxxx" -LaunchConfigurationName $name
$a = Get-ASAutoScalingInstance | select -expandproperty InstanceId | Get-EC2Instance | select -expandproperty RunningInstance | select -property PrivateIpAddress
foreach($ip in $a)
{
$command = …Run Code Online (Sandbox Code Playgroud)