Amazon web services 此自动缩放组的服务链接角色尚未准备好使用

Amazon web services 此自动缩放组的服务链接角色尚未准备好使用,amazon-web-services,amazon-ec2,aws-lambda,amazon-cloudformation,autoscaling,Amazon Web Services,Amazon Ec2,Aws Lambda,Amazon Cloudformation,Autoscaling,我正在创建AWS CloudFormation模板,以添加lambda函数作为生命周期挂钩。但CloudFormation模板部署失败,出现以下消息: The Service-Linked Role for this Auto Scaling group is not yet ready for use. CF模板是用YAML编写的,自动缩放组的部分如下所示: ServerGroup: Type: 'AWS::AutoScaling::AutoScalingGroup' Dep

我正在创建AWS CloudFormation模板,以添加lambda函数作为生命周期挂钩。但CloudFormation模板部署失败,出现以下消息:

The Service-Linked Role for this Auto Scaling group is not yet ready for use.
CF模板是用YAML编写的,自动缩放组的部分如下所示:

ServerGroup:
    Type: 'AWS::AutoScaling::AutoScalingGroup'
    DependsOn: 
      - VpcStack
      - NodeManagerExecRole
      - NodeManagerSnsTopic
    Properties:
      VPCZoneIdentifier: 
        - !GetAtt [VpcStack, Outputs.Subnet2Id]
      LaunchConfigurationName: !Ref LaunchConfig2
      MinSize: '0'
      MaxSize: !Ref NodesPerZone
      DesiredCapacity: !Ref NodesPerZone
      Cooldown: '300'
      HealthCheckType: EC2
      HealthCheckGracePeriod: '300'
      LoadBalancerNames:
        - !Ref ElasticLoadBalancer    
      LifecycleHookSpecificationList:
        - LifecycleTransition: 'autoscaling:EC2_INSTANCE_LAUNCHING'
          LifecycleHookName: NodeManager
          HeartbeatTimeout: 4800
          NotificationTargetARN: !Ref NodeManagerSnsTopic          
          RoleARN: !GetAtt [NodeManagerExecRole, Arn]
NodeManager ExecRole
的代码片段如下:

NodeManagerExecRole:
    Type: 'AWS::IAM::Role'
    Properties:
      AssumeRolePolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Principal:
              Service:
                - lambda.amazonaws.com
            Action:
              - 'sts:AssumeRole'
      Policies:
        - PolicyName: NodeManager
          PolicyDocument:
            Version: 2012-10-17
            Statement:
              - Effect: Allow
                Action:
                  - "sns:Publish"
                Resource: "arn:aws:sns:*:*:*"
              - Effect: Allow
                Action:
                  - 'logs:CreateLogGroup'
                  - 'logs:CreateLogStream'
                  - 'logs:PutLogEvents'
                Resource: 'arn:aws:logs:*:*:*'
我搜索了AWS文档以及stackoverfolow,没有找到关于此错误的有用信息。只提到了细节信息


模板中是否有我遗漏的内容?

您需要为自动缩放组添加一个信任策略,以便发布到SNS

 "Principal": {
    "Service": "autoscaling.amazonaws.com"
  },

由于您添加了
DependsOn
,对我来说很好,问题将是其他问题。