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 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…