Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
238 views
in Technique[技术] by (71.8m points)

amazon web services - Autoscaling - lifecylehook implementation

I'm trying to implement my first ASG with a lifecycle hook and I am having this issue:

LifecycleHandlerFunction: Encountered unsupported property Role The following resource(s) failed to create: [LifecycleHandlerFunction]. Rollback requested by user.

I don't know what I am doing wrong. I am using this code sample: https://github.com/aws-samples/ecs-refarch-cloudformation/blob/master/infrastructure/lifecyclehook.yaml

AutoscalingNotificationRole & LambdaExecutionRole are setup in my aws account.

"NotificationTopic": {
        "Type": "AWS::SNS::Topic",
        "Properties": {
          "Subscription": [
            {
              "Endpoint": {
                "Fn::GetAtt": [
                "LifecycleHandlerFunction",
                "Arn"
                ]
              },
              "Protocol": "lambda"
            }
          ]   
        },
        "DependsOn": "LifecycleHandlerFunction"
    },
    "InstanceTerminatingHook": {
      "Type": "AWS::AutoScaling::LifecycleHook",
      "Properties": {
        "AutoScalingGroupName": {
            "Fn::Join": [
                "",
                [
                    { "Ref": "ClusterName" }, "-autoscaling"
                ]
            ]
        },
        "DefaultResult": "ABANDON",
        "HeartbeatTimeout": "900",
        "LifecycleTransition": "autoscaling:EC2_INSTANCE_TERMINATING",
        "NotificationTargetARN": "NotificationTopic",
        "RoleARN": [ 
            "AutoscalingNotificationRole", 
            "Arn" 
        ]
      },
      "DependsOn": "NotificationTopic"
    },
    "LambdaInvokePermission": {
      "Type": "AWS::Lambda::Permission",
      "Properties": {
        "FunctionName": "LifecycleHandlerFunction",
        "Action": "lambda:InvokeFunction",
        "Principal": "sns.amazonaws.com",
        "SourceArn": { "Ref": "NotificationTopic" }
      }
    },
    "LifecycleHandlerFunction": {
      "Type": "AWS::Lambda::Function",
      "Properties": {
        "Environment": {
          "Variables": {
            "CLUSTER": { "Ref": "ClusterName" }
        },
        "Handler": "index.lambda_handler",
        "Role": [ 
            "LambdaAutoscalingExecutionRole",
            "Arn"
        ],
        "Code": {
          "ZipFile": [
              "",
              [
                "my python code"
              ]
            ]
        },
        "Runtime": "python3.6",
        "Timeout": 10
        }
    }

Thanks a lot in advance for your help.

question from:https://stackoverflow.com/questions/66049540/autoscaling-lifecylehook-implementation

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...