gpt4 book ai didi

amazon-web-services - cfn-signal UPDATE_ROLLBACK_COMPLETE 状态且无法发出信号

转载 作者:行者123 更新时间:2023-12-03 07:25:34 27 4
gpt4 key购买 nike

有时,cfn-signal 命令会崩溃并显示以下消息:

ValidationError: Stack arn:aws:cloudformation:eu-west-1:XXXXX:stack/XXX/XXXXX is in UPDATE_ROLLBACK_COMPLETE state and cannot be signaled

使用此命令:

/usr/local/bin/cfn-signal -e 0 \ 
--stack arn:aws:cloudformation:eu-west-1:XXX:stack/XXX/XXXX \
--resource AutoScalingGroup \
--region eu-west-1

我不明白为什么CloudFormation状态是相关的?我相信 AutoScalingGroup 正在等待生命周期事件?

当我手动完成实例生命周期时,没有问题:

aws autoscaling complete-lifecycle-action \
--auto-scaling-group-name XXXX \
--lifecycle-hook-name CodeDeploy-managed-automatic-launch-deployment-hook-XX \
--instance-id i-XX \
--lifecycle-action-result CONTINUE \
--region eu-west-1

UserData 脚本的一部分:

 UserData:
Fn::Base64: !Sub |
[...]
# Setup CodeDeploy
sudo /home/ubuntu/install-codedeploy-agent auto
rm /home/ubuntu/install-codedeploy-agent

# Install the files and packages from the metadata
/usr/local/bin/cfn-init -v \
--stack ${AWS::StackId} \
--resource LaunchConfiguration \
--region ${AWS::Region}

# All done so signal success to CloudFormation
/usr/local/bin/cfn-signal -e $? \
--stack ${AWS::StackId} \
--resource AutoScalingGroup \
--region ${AWS::Region}

# Start CodeDeploy agent
sudo service codedeploy-agent start
sudo service codedeploy-agent status

AutoScaling 组定义:

AutoScalingGroup:
Type: AWS::AutoScaling::AutoScalingGroup
Properties:
AvailabilityZones:
Fn::GetAZs: !Ref AWS::Region
LaunchConfigurationName: !Ref LaunchConfiguration
MinSize: 1
MaxSize: 2
DesiredCapacity: 1
TargetGroupARNs:
- !Ref ElasticLoadBalancerTargetGroup
HealthCheckType: ELB
HealthCheckGracePeriod: 600 # in seconds
CreationPolicy:
ResourceSignal:
Count: 1
Timeout: PT15M # 15 minutes
UpdatePolicy:
AutoScalingRollingUpdate:
PauseTime: PT15M # 15 minutes
WaitOnResourceSignals: true

最佳答案

据我所知cfn-signal与自动缩放生命周期 Hook 完全无关。

其目的是向 CloudFormation 发出信号,告知给定自动缩放组中的实例已准备就绪。当 CloudFormation 收到一定数量的成功信号时,它会认为 ASG 为 CREATE_COMPLETEUPDATE_COMPLETE 。如果应该接收信号的堆栈由于模板中的一些其他问题而回滚,cfn-signal将失败,因为其信号不再与 _COMPLETE 中的堆栈相关。状态。

关于amazon-web-services - cfn-signal UPDATE_ROLLBACK_COMPLETE 状态且无法发出信号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49072883/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com