amazon-web-services - 为 UserData 创建 CloudFormation 堆栈失败
问题描述
我创建了一个 CloudFormation 堆栈,并将旧 VPC Id 实施到新 VPC Id。但它正在使用 UserData Old VPC Id。我们正在切换到新的 VPC id 并执行 CFT 堆栈仍然低于问题, 2021-08-20 01:09:32 UTC+0530 MasterNodeWaitCondition CREATE_FAILED WaitCondition 收到失败消息:“配置失败。” 唯一 ID:i-072e5282d5854d33f
CloudFormation 堆栈用户数据下方:
UserData:
Fn::Base64:
Fn::Sub:
- |-
<script>
powershell -NoLogo -NonInteractive -ExecutionPolicy Bypass -Command "& { New-Item -Path C:\temp\run-before-aic.txt -Force -Type File -Value (Get-Date) }"
powershell -NoLogo -NonInteractive -ExecutionPolicy Bypass -File C:\ProgramData\Sabre\aic-script.ps1
powershell -NoLogo -NonInteractive -ExecutionPolicy Bypass -Command "& {New-Item -Path C:\temp\run-after-aic.txt -Force -Type File -Value (Get-Date) }"
powershell -NoLogo -NonInteractive -ExecutionPolicy Bypass -Command "& { Set-Item -Path WSMan:\localhost\Client\TrustedHosts -Value '*' -Force }"
netsh winhttp set proxy proxy-server="${ProxyDomain}:${ProxyPort}" bypass-list="localhost;169.254.169.254;cloudformation.us-west-2.amazonaws.com;ec2.us-west-2.amazonaws.com;ec2messages.us-west-2.amazonaws.com;kms.us-west-2.amazonaws.com;logs.us-west-2.amazonaws.com;monitoring.us-west-2.amazonaws.com;ssm.us-west-2.amazonaws.com;ssmmessages.us-west-2.amazonaws.com;10.*.*.*"
cfn-init.exe -v -c config -r renderingserver1 -s ${AWS::StackName} --region ${AWS::Region} --http-proxy=http://${ProxyDomain}:${ProxyPort} --https-proxy=http://${ProxyDomain}:${ProxyPort}
cfn-signal.exe -e %ERRORLEVEL% ${MasterNodeWaitHandle} -d "Done by me" --stack ${AWS::StackName} --region ${AWS::Region} --http-proxy=http://${ProxyDomain}:${ProxyPort} --https-proxy=http://${ProxyDomain}:${ProxyPort}
<powershell>
$AWS_AVAIL_ZONE=Get-EC2InstanceMetadata -Category AvailabilityZone
$AWS_REGION=$AWS_AVAIL_ZONE.Substring(0,$AWS_AVAIL_ZONE.length-1)
$AWS_INSTANCE_ID=Get-EC2InstanceMetadata -Category instanceId
$ROOT_VOLUME_IDS=((Get-EC2Instance -Region $AWS_REGION -InstanceId $AWS_INSTANCE_ID).Instances.BlockDeviceMappings | where-object DeviceName -match '/dev/sda1').Ebs.VolumeId
$Tags = @( @{key="Name";value="${RootEBSName}"},
@{key="Environment";value="dev"},
@{key="TechnicalService";value="${TechnicalService}"},
@{key="BusinessUnit";value="${BusinessUnit}"},
@{key="Customer";value="6H"},
@{key="AppIdentifier";value="${AppIdentifier}"},
@{key="ContactEmail";value="${ContactEmail}"},
@{key="Owner";value="${Owner}"}
@{key="BusinessService";value="${BusinessService}"} )
New-EC2Tag -Resource $ROOT_VOLUME_IDS -Region $AWS_REGION -Tags $Tags
</powershell>
</script><persist>true</persist>
- Owner:
Ref: Owner
BusinessService:
Ref: BusinessService
ProxyDomain:
Fn::ImportValue:
Fn::Sub: ${BusinessUnit}-dev-ss${ProxyVpcIdentifier}-proxy-domain
BusinessUnit:
Ref: BusinessUnit
TechnicalService:
Ref: TechnicalService
ContactEmail:
Ref: ContactEmail
MasterNodeWaitHandle:
Fn::Base64:
Ref: MasterNodeWaitHandle
RootEBSName:
Fn::Join:
- "-"
- - ebs
- Ref: BusinessUnit
- 6H-dev-renderingserver1-Volume
ProxyPort:
Fn::ImportValue:
Fn::Sub: ${BusinessUnit}-dev-ss${ProxyVpcIdentifier}-proxy-port
AppIdentifier:
Ref: AppIdentifier
使用旧 VPC Id 的 CFT 堆栈用户数据上方。请帮助使用powershell脚本对用户数据进行任何更改???
解决方案
推荐阅读
- mysql - Laravel 加入以检索总数
- java - 我想“鼠标点击监听器”在 JPanel 中的照片上创建一个标记
- typescript - 在 Typescript 中检查字符串是否是类型中的键
- arrays - 如何从长度未知的数组中提取所有对象并将它们放入 React 中的状态变量中?
- android - 地图片段上的 TextView 在拖动时不跟随其移动
- javascript - 在父项中更新复选框 isChecked 状态
- r - 字符变量默认为 R 中的因子
- python-3.x - 使用转换器和 pytorch 微调因果语言模型
- python - 为什么我会收到 CORS 错误原因:CORS 请求未成功
- python - 根据要求着色 Matplotlib 热图