, - - .
, , , , . AWS::AutoScaling::LifecycleHook NotificationMetadata, , Route53ZoneId:
"MyLifecycleHook": {
"Type": "AWS::AutoScaling::LifecycleHook",
"Properties": {
"AutoScalingGroupName": { "Ref": "MyASG" },
"LifecycleTransition": "autoscaling:EC2_INSTANCE_LAUNCHING",
"NotificationMetadata": { "Fn::Join": [ "", [
"{",
" \"Route53ZoneId\": \"YOUR_ROUTE53_ZONE_IDENTIFIER_HERE\"",
"}"
] ] },
"NotificationTargetARN": { "Ref": "MyTopic" },
"RoleARN": { "Fn::GetAtt": [ "MyLifecycleHookRole", "Arn" ] }
}
}
Then in your lambda handler, assuming you are writing it in Python, you can access the variables in this dictionary, for example:
def handler(event, context):
message = json.loads(event[u'Records'][0][u'Sns'][u'Message'])
metadata = json.loads(message['NotificationMetadata'])
logger.info("Route53 Zone Identifier {0}".format(metadata['Route53ZoneId']))
source
share