binxio/ec2-elastic-ip-manager

How to trigger it when change happen in ASG state.

Closed this issue · 1 comments

Hi,

If you have some time could you please help? I want to trigger IP change when state of ASG change.
I tried to change the trigger from aws.ec to aws.autoscalling group. Below trigger

"source": [
"aws.autoscaling"
],
"detail-type": [
"EC2 Instance Launch Successful",
"EC2 Instance Terminate Successful",
"EC2 Instance Launch Unsuccessful",
"EC2 Instance Terminate Unsuccessful",
"EC2 Instance-launch Lifecycle Action",
"EC2 Instance-terminate Lifecycle Action"
],
"detail": {
"AutoScalingGroupName": [
"elastic-ip"
]
}

It's triigering lambda function but IP is not chnaging. Changed below lines in manage.py and compiled code using docker and upload new code to lambda but no success.

def is_state_change_event(event):
return event.get("source") == "aws.autoscaling" and event.get("detail-type") in [
"EC2 Instance Launch Successful"
"EC2 Instance Terminate Successful",
"EC2 Instance Launch Unsuccessful",
"EC2 Instance Terminate Unsuccessful",
"EC2 Instance-launch Lifecycle Action",
"EC2 Instance-terminate Lifecycle Action"
]

No error in lambda function log. Please if you have some free time and guide where to make changed in code.

Regards,

Closing as this issue is really old. I trust you solved it.