{"id":15361,"date":"2014-09-01T13:38:48","date_gmt":"2014-09-01T08:08:48","guid":{"rendered":"https:\/\/2thenew.xyz\/blog\/?p=15361"},"modified":"2014-09-01T13:40:39","modified_gmt":"2014-09-01T08:10:39","slug":"alarms-deletion-at-server-termination","status":"publish","type":"post","link":"https:\/\/2thenew.xyz\/blog\/alarms-deletion-at-server-termination\/","title":{"rendered":"Alarms Deletion at server termination"},"content":{"rendered":"<p>Whenever Autoscaling server terminates it leaves its alarms which later goes into insufficient state. This blog will guide you how to delete all those alarms of autoscaling server when it terminates. In order to do so, I&#8217;ve written a small shell script, I&#8217;m assuming that you already have aws cli installed if not you can <a href=\"http:\/\/docs.aws.amazon.com\/cli\/latest\/userguide\/installing.html\">click here<\/a> to follow amazon documentation to install it<\/p>\n<p>[js]#!\/bin\/bash \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 ########### she bang<br \/>\nINST_ID=`ec2metadata &#8211;instance-id` \u00a0 \u00a0 ############## to store instance id of a autoscaling server in a variable INST_ID<br \/>\nalarm_name=`aws cloudwatch describe-alarms &#8211;query &#8216;MetricAlarms[*].[Dimensions[0].Value,AlarmName]&#8217; |awk &#8216;\/&#8217;&quot;$INST_ID&quot;&#8217;\/ {print $2}&#8217;` ### to store alarm names that are attached to the server<br \/>\nfor i in `alarm_name`<br \/>\ndo<br \/>\naws cloudwatch delete-alarms &#8211;alarm-names $i \u00a0 \u00a0 \u00a0 \u00a0##### to delete alarms<br \/>\ndone<br \/>\n[\/js]<\/p>\n<p>Now move this script to \/etc\/init.d\/ and create a symbolic link to \/etc\/rc0.d\/. The symlink name should begin with a &#8220;S&#8221; or &#8220;K&#8221;.<br \/>\nFiles that begin with K are run to terminate (kill) a system service. Files that begin with S are run to start a system service.<br \/>\nIf you analyze scripts in \/etc\/rcX.d\/ directory, they starts with &#8220;S&#8221; or &#8220;K&#8221; followed by a number. These numbers decide their priority in which these scripts will run, for example, S23 runs before S34.<\/p>\n<p>I&#8217;ve created a script in \/etc\/init.d\/delete_alarms<\/p>\n<p>and then made its symbolic link in \/etc\/rc0.d\/<\/p>\n<p>ln -s \/etc\/init.d\/delete_alarms \/etc\/rc0.d\/K00delete_alarms<\/p>\n<p>Please pick you priority number carefully as wrong priority number might crash your system and it wont boot again. My script name has started with K00 as autoscaling server has only one life, so I don&#8217;t have to be worried about starting that again<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Whenever Autoscaling server terminates it leaves its alarms which later goes into insufficient state. This blog will guide you how to delete all those alarms of autoscaling server when it terminates. In order to do so, I&#8217;ve written a small shell script, I&#8217;m assuming that you already have aws cli installed if not you can [&hellip;]<\/p>\n","protected":false},"author":124,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":5,"footnotes":""},"categories":[1174],"tags":[],"class_list":["post-15361","post","type-post","status-publish","format-standard","hentry","category-aws-2"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Whenever Autoscaling server terminates it leaves its alarms which later goes into insufficient state. This blog will guide you how to delete all those alarms of autoscaling server when it terminates. In order to do so, I&#039;ve written a small shell script, I&#039;m assuming that you already have aws cli installed if not you can\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Nikhil Kumar Sharma\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/2thenew.xyz\/blog\/alarms-deletion-at-server-termination\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"TO THE NEW BLOG\" \/>\n\t\t<meta property=\"og:type\" content=\"blog\" \/>\n\t\t<meta property=\"og:title\" content=\"Alarms Deletion at server termination | TO THE NEW Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"Whenever Autoscaling server terminates it leaves its alarms which later goes into insufficient state. This blog will guide you how to delete all those alarms of autoscaling server when it terminates. In order to do so, I&#039;ve written a small shell script, I&#039;m assuming that you already have aws cli installed if not you can\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/2thenew.xyz\/blog\/alarms-deletion-at-server-termination\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@tothenew\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Alarms Deletion at server termination | TO THE NEW Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Whenever Autoscaling server terminates it leaves its alarms which later goes into insufficient state. This blog will guide you how to delete all those alarms of autoscaling server when it terminates. In order to do so, I&#039;ve written a small shell script, I&#039;m assuming that you already have aws cli installed if not you can\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/alarms-deletion-at-server-termination\\\/#article\",\"name\":\"Alarms Deletion at server termination | TO THE NEW Blog\",\"headline\":\"Alarms Deletion at server termination\",\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/nikhil-sharma\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"},\"datePublished\":\"2014-09-01T13:38:48+05:30\",\"dateModified\":\"2014-09-01T13:40:39+05:30\",\"inLanguage\":\"en-US\",\"commentCount\":1,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/alarms-deletion-at-server-termination\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/alarms-deletion-at-server-termination\\\/#webpage\"},\"articleSection\":\"AWS\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/alarms-deletion-at-server-termination\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/aws-2\\\/#listItem\",\"name\":\"AWS\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/aws-2\\\/#listItem\",\"position\":2,\"name\":\"AWS\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/aws-2\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/alarms-deletion-at-server-termination\\\/#listItem\",\"name\":\"Alarms Deletion at server termination\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/alarms-deletion-at-server-termination\\\/#listItem\",\"position\":3,\"name\":\"Alarms Deletion at server termination\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/aws-2\\\/#listItem\",\"name\":\"AWS\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\",\"name\":\"TO THE NEW Blog\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/nikhil-sharma\\\/#author\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/nikhil-sharma\\\/\",\"name\":\"Nikhil Kumar Sharma\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/alarms-deletion-at-server-termination\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/910a28868c1246d9bb93ff99e7b41d629230d6d8c48e9e245788b833039ff175?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Nikhil Kumar Sharma\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/alarms-deletion-at-server-termination\\\/#webpage\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/alarms-deletion-at-server-termination\\\/\",\"name\":\"Alarms Deletion at server termination | TO THE NEW Blog\",\"description\":\"Whenever Autoscaling server terminates it leaves its alarms which later goes into insufficient state. This blog will guide you how to delete all those alarms of autoscaling server when it terminates. In order to do so, I've written a small shell script, I'm assuming that you already have aws cli installed if not you can\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/alarms-deletion-at-server-termination\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/nikhil-sharma\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/nikhil-sharma\\\/#author\"},\"datePublished\":\"2014-09-01T13:38:48+05:30\",\"dateModified\":\"2014-09-01T13:40:39+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\",\"name\":\"TO THE NEW Blog\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Alarms Deletion at server termination | TO THE NEW Blog","description":"Whenever Autoscaling server terminates it leaves its alarms which later goes into insufficient state. This blog will guide you how to delete all those alarms of autoscaling server when it terminates. In order to do so, I've written a small shell script, I'm assuming that you already have aws cli installed if not you can","canonical_url":"https:\/\/2thenew.xyz\/blog\/alarms-deletion-at-server-termination\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/2thenew.xyz\/blog\/alarms-deletion-at-server-termination\/#article","name":"Alarms Deletion at server termination | TO THE NEW Blog","headline":"Alarms Deletion at server termination","author":{"@id":"https:\/\/2thenew.xyz\/blog\/author\/nikhil-sharma\/#author"},"publisher":{"@id":"https:\/\/2thenew.xyz\/blog\/#organization"},"datePublished":"2014-09-01T13:38:48+05:30","dateModified":"2014-09-01T13:40:39+05:30","inLanguage":"en-US","commentCount":1,"mainEntityOfPage":{"@id":"https:\/\/2thenew.xyz\/blog\/alarms-deletion-at-server-termination\/#webpage"},"isPartOf":{"@id":"https:\/\/2thenew.xyz\/blog\/alarms-deletion-at-server-termination\/#webpage"},"articleSection":"AWS"},{"@type":"BreadcrumbList","@id":"https:\/\/2thenew.xyz\/blog\/alarms-deletion-at-server-termination\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog#listItem","position":1,"name":"Home","item":"https:\/\/2thenew.xyz\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog\/category\/aws-2\/#listItem","name":"AWS"}},{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog\/category\/aws-2\/#listItem","position":2,"name":"AWS","item":"https:\/\/2thenew.xyz\/blog\/category\/aws-2\/","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog\/alarms-deletion-at-server-termination\/#listItem","name":"Alarms Deletion at server termination"},"previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog\/alarms-deletion-at-server-termination\/#listItem","position":3,"name":"Alarms Deletion at server termination","previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.xyz\/blog\/category\/aws-2\/#listItem","name":"AWS"}}]},{"@type":"Organization","@id":"https:\/\/2thenew.xyz\/blog\/#organization","name":"TO THE NEW Blog","url":"https:\/\/2thenew.xyz\/blog\/"},{"@type":"Person","@id":"https:\/\/2thenew.xyz\/blog\/author\/nikhil-sharma\/#author","url":"https:\/\/2thenew.xyz\/blog\/author\/nikhil-sharma\/","name":"Nikhil Kumar Sharma","image":{"@type":"ImageObject","@id":"https:\/\/2thenew.xyz\/blog\/alarms-deletion-at-server-termination\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/910a28868c1246d9bb93ff99e7b41d629230d6d8c48e9e245788b833039ff175?s=96&d=mm&r=g","width":96,"height":96,"caption":"Nikhil Kumar Sharma"}},{"@type":"WebPage","@id":"https:\/\/2thenew.xyz\/blog\/alarms-deletion-at-server-termination\/#webpage","url":"https:\/\/2thenew.xyz\/blog\/alarms-deletion-at-server-termination\/","name":"Alarms Deletion at server termination | TO THE NEW Blog","description":"Whenever Autoscaling server terminates it leaves its alarms which later goes into insufficient state. This blog will guide you how to delete all those alarms of autoscaling server when it terminates. In order to do so, I've written a small shell script, I'm assuming that you already have aws cli installed if not you can","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/2thenew.xyz\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/2thenew.xyz\/blog\/alarms-deletion-at-server-termination\/#breadcrumblist"},"author":{"@id":"https:\/\/2thenew.xyz\/blog\/author\/nikhil-sharma\/#author"},"creator":{"@id":"https:\/\/2thenew.xyz\/blog\/author\/nikhil-sharma\/#author"},"datePublished":"2014-09-01T13:38:48+05:30","dateModified":"2014-09-01T13:40:39+05:30"},{"@type":"WebSite","@id":"https:\/\/2thenew.xyz\/blog\/#website","url":"https:\/\/2thenew.xyz\/blog\/","name":"TO THE NEW Blog","inLanguage":"en-US","publisher":{"@id":"https:\/\/2thenew.xyz\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"TO THE NEW BLOG","og:type":"blog","og:title":"Alarms Deletion at server termination | TO THE NEW Blog","og:description":"Whenever Autoscaling server terminates it leaves its alarms which later goes into insufficient state. This blog will guide you how to delete all those alarms of autoscaling server when it terminates. In order to do so, I've written a small shell script, I'm assuming that you already have aws cli installed if not you can","og:url":"https:\/\/2thenew.xyz\/blog\/alarms-deletion-at-server-termination\/","og:image":"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","og:image:secure_url":"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","twitter:card":"summary","twitter:site":"@tothenew","twitter:title":"Alarms Deletion at server termination | TO THE NEW Blog","twitter:description":"Whenever Autoscaling server terminates it leaves its alarms which later goes into insufficient state. This blog will guide you how to delete all those alarms of autoscaling server when it terminates. In order to do so, I've written a small shell script, I'm assuming that you already have aws cli installed if not you can","twitter:image":"https:\/\/2thenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png"},"aioseo_meta_data":{"post_id":"15361","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"created":"2021-04-29 23:56:32","updated":"2024-02-29 09:34:09","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.xyz\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.xyz\/blog\/category\/aws-2\/\" title=\"AWS\">AWS<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tAlarms Deletion at server termination\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/2thenew.xyz\/blog"},{"label":"AWS","link":"https:\/\/2thenew.xyz\/blog\/category\/aws-2\/"},{"label":"Alarms Deletion at server termination","link":"https:\/\/2thenew.xyz\/blog\/alarms-deletion-at-server-termination\/"}],"_links":{"self":[{"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/posts\/15361","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/users\/124"}],"replies":[{"embeddable":true,"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/comments?post=15361"}],"version-history":[{"count":0,"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/posts\/15361\/revisions"}],"wp:attachment":[{"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/media?parent=15361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/categories?post=15361"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2thenew.xyz\/blog\/wp-json\/wp\/v2\/tags?post=15361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}