title: cfn-signal UPDATE_ROLLBACK_COMPLETE state and cannot be signaled
body: <p>Sometimes, the command cfn-signal is crashing with this message:</p>
  
  <blockquote>
    <p>ValidationError: Stack
    arn:aws:cloudformation:eu-west-1:XXXXX:stack/XXX/XXXXX
    is in UPDATE_ROLLBACK_COMPLETE state and cannot be signaled</p>
  </blockquote>
  
  <p>With this command:</p>
  
  <pre><code>/usr/local/bin/cfn-signal -e 0 \ 
    --stack arn:aws:cloudformation:eu-west-1:XXX:stack/XXX/XXXX \
    --resource AutoScalingGroup \
    --region eu-west-1
  </code></pre>
  
  <p>I don't understand why the CloudFormation state is related? I believe it's the AutoScalingGroup that is waiting for the life cycle event?</p>
  
  <p>When I manually complete the instance life cycle, there is no issue:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Part of the UserData script:</p>
  
  <pre><code> 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
  </code></pre>
  
  <p>The AutoScaling Group definition:</p>
  
  <pre><code>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
  </code></pre>