Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
EC2 AutoScale event notifications via SNS.
{
"Records": [
{
"EventSource": "aws:sns",
"EventVersion": "1.0",
"EventSubscriptionArn": "arn:aws:sns:eu-west-1:371548805176:FT-App-API-UAT-AutoScalingEvents-1VA671X21ETS2:500fe343-1af7-4b98-a81c-2a91c32f3f05",
"Sns": {
"Type": "Notification",
"MessageId": "1decf081-3906-5ba1-a408-a1c886a6549e",
"TopicArn": "arn:aws:sns:eu-west-1:371548805176:FT-App-API-UAT-AutoScalingEvents-1VA671X21ETS2",
"Subject": "Auto Scaling: launch for group \"FT-App-API-UAT-AutoScalingGroup-69SUZS5XE90F\"",
"Message": "{\"Progress\":50,\"AccountId\":\"371548805176\",\"Description\":\"Launching a new EC2 instance: i-0c55bedeb30ef1f08\",\"RequestId\":\"4e50ac14-2d21-4d91-a7cd-1f184f2b73d1\",\"EndTime\":\"2017-03-20T11:30:40.246Z\",\"AutoScalingGroupARN\":\"arn:aws:autoscaling:eu-west-1:371548805176:autoScalingGroup:41888f5b-5931-4adc-96da-03cee77470be:autoScalingGroupName/FT-App-API-UAT-AutoScalingGroup-69SUZS5XE90F\",\"ActivityId\":\"4e50ac14-2d21-4d91-a7cd-1f184f2b73d1\",\"StartTime\":\"2017-03-20T11:30:03.609Z\",\"Service\":\"AWS Auto Scaling\",\"Time\":\"2017-03-20T11:30:40.246Z\",\"EC2InstanceId\":\"i-0c55bedeb30ef1f08\",\"StatusCode\":\"InProgress\",\"StatusMessage\":\"\",\"Details\":{\"Subnet ID\":\"subnet-33102047\",\"Availability Zone\":\"eu-west-1a\"},\"AutoScalingGroupName\":\"FT-App-API-UAT-AutoScalingGroup-69SUZS5XE90F\",\"Cause\":\"At 2017-03-20T11:29:40Z a user request update of AutoScalingGroup constraints to min: 0, max: 2, desired: 1 changing the desired capacity from 0 to 1. At 2017-03-20T11:30:00Z an instance was started in response to a difference between desired and actual capacity, increasing the capacity from 0 to 1.\",\"Event\":\"autoscaling:EC2_INSTANCE_LAUNCH\"}",
"Timestamp": "2017-03-20T11:30:40.278Z",
"SignatureVersion": "1",
"Signature": "eBBei7ufYmJTWzyWtVWvKJCWAOVT73pH9x2Hf+MwBqzPyjYG/vbWdn6MmwwG/5jQ7/RYbbUyURjv2rCN8Cgk9YLsN21JAbXNTjnthSStYulQkLikwGkKHdcjX02MhBRxL4cJWgA6fQZd6hIyweH2lmxd2Xq9+INgbx9QRjQarSsMzJ96LRE7qbA/eqtKv16HuR3JXCW7guk59C3aLnrPuvhvPyQ4ZhWXynYvBBtx+rtAELyES0rMjZIQGQNhg7Bdp8wO7Q7pi6Bg8rcateYFMFssE0P6zvQd0yC7ai/AbJLedcy34v1zmcBB3CPo9peJ3NLxy0vCABi5SsLKSF/grw==",
"SigningCertUrl": "https://sns.eu-west-1.amazonaws.com/SimpleNotificationService-b95095beb82e8f6a046b3aafc7f4149a.pem",
"UnsubscribeUrl": "https://sns.eu-west-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:eu-west-1:371548805176:FT-App-API-UAT-AutoScalingEvents-1VA671X21ETS2:500fe343-1af7-4b98-a81c-2a91c32f3f05",
"MessageAttributes": {}
}
}
]
}
{
"Records": [
{
"EventSource": "aws:sns",
"EventVersion": "1.0",
"EventSubscriptionArn": "arn:aws:sns:eu-west-1:371548805176:FT-App-API-UAT-AutoScalingEvents-1VA671X21ETS2:500fe343-1af7-4b98-a81c-2a91c32f3f05",
"Sns": {
"Type": "Notification",
"MessageId": "8c5a0f66-5d6c-5016-8432-5e2f9d71ca49",
"TopicArn": "arn:aws:sns:eu-west-1:371548805176:FT-App-API-UAT-AutoScalingEvents-1VA671X21ETS2",
"Subject": "Auto Scaling: termination for group \"FT-App-API-UAT-AutoScalingGroup-69SUZS5XE90F\"",
"Message": "{\"Progress\":50,\"AccountId\":\"371548805176\",\"Description\":\"Terminating EC2 instance: i-0c55bedeb30ef1f08\",\"RequestId\":\"80392b36-7258-4a6b-9706-730b97030b43\",\"EndTime\":\"2017-03-20T11:32:45.750Z\",\"AutoScalingGroupARN\":\"arn:aws:autoscaling:eu-west-1:371548805176:autoScalingGroup:41888f5b-5931-4adc-96da-03cee77470be:autoScalingGroupName/FT-App-API-UAT-AutoScalingGroup-69SUZS5XE90F\",\"ActivityId\":\"80392b36-7258-4a6b-9706-730b97030b43\",\"StartTime\":\"2017-03-20T11:32:02.905Z\",\"Service\":\"AWS Auto Scaling\",\"Time\":\"2017-03-20T11:32:45.750Z\",\"EC2InstanceId\":\"i-0c55bedeb30ef1f08\",\"StatusCode\":\"InProgress\",\"StatusMessage\":\"\",\"Details\":{\"Subnet ID\":\"subnet-33102047\",\"Availability Zone\":\"eu-west-1a\"},\"AutoScalingGroupName\":\"FT-App-API-UAT-AutoScalingGroup-69SUZS5XE90F\",\"Cause\":\"At 2017-03-20T11:31:43Z a user request update of AutoScalingGroup constraints to min: 0, max: 2, desired: 0 changing the desired capacity from 1 to 0. At 2017-03-20T11:32:02Z an instance was taken out of service in response to a difference between desired and actual capacity, shrinking the capacity from 1 to 0. At 2017-03-20T11:32:02Z instance i-0c55bedeb30ef1f08 was selected for termination.\",\"Event\":\"autoscaling:EC2_INSTANCE_TERMINATE\"}",
"Timestamp": "2017-03-20T11:32:45.793Z",
"SignatureVersion": "1",
"Signature": "Eko9ycttpLjA1/Es7EWyd69tDqxqtOEw3Rx6NwR7wh2dVx4pqdUpde1rzE7zK/f2CaLHozEUwi6tyRrmmrvSvWo/sCIVZ513VSAsH/uCk0F4+A51OZPmbzEApl0D/BWBWc1B/75XcIxE93A5lNpeeG1+gVM4sPyUWGQ+cjnBIs39cGDd31ORNDvtwjs9bJYiIyU2jwLfftF1apSupVeCz7/Ntzf41ANMy3Ac9oykVFnRORhQ6KPXnpAXnLMjY5FMEReO/Y/N4oQlJU2w2MLe2Mpa+MJuXASSgWrlPDKGUEDwpZZVPq372Uc+OlHVCjatKt6tZ+L0xcc6xkKVKrXbfQ==",
"SigningCertUrl": "https://sns.eu-west-1.amazonaws.com/SimpleNotificationService-b95095beb82e8f6a046b3aafc7f4149a.pem",
"UnsubscribeUrl": "https://sns.eu-west-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:eu-west-1:371548805176:FT-App-API-UAT-AutoScalingEvents-1VA671X21ETS2:500fe343-1af7-4b98-a81c-2a91c32f3f05",
"MessageAttributes": {}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.