{"id":311,"date":"2022-11-15T14:18:22","date_gmt":"2022-11-15T14:18:22","guid":{"rendered":"https:\/\/santosh-shah.com\/blog\/?p=311"},"modified":"2022-12-01T05:48:45","modified_gmt":"2022-12-01T05:48:45","slug":"sns-notification-target-rule-is-unreachable-when-tryin-to-send-a-notification-from-code-pipeline","status":"publish","type":"post","link":"https:\/\/santosh-shah.com\/blog\/sns-notification-target-rule-is-unreachable-when-tryin-to-send-a-notification-from-code-pipeline\/","title":{"rendered":"SNS notification target rule is &#8220;unreachable&#8221; when tryin to send a notification from code pipeline"},"content":{"rendered":"<p>Whenever you create an&nbsp;<strong>SNS topic<\/strong> by itself, the default access policy will look something like this: The default access policy shown as below is wrong and will not work.&nbsp;<\/p>\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"Version\": \"2008-10-17\",\n  \"Id\": \"__default_policy_ID\",\n  \"Statement\": &#91;\n    {\n      \"Sid\": \"__default_statement_ID\",\n      \"Effect\": \"Allow\",\n      \"Principal\": {\n        \"AWS\": \"*\"\n      },\n      \"Action\": &#91;\n        \"SNS:Publish\",\n        \"SNS:RemovePermission\",\n        \"SNS:SetTopicAttributes\",\n        \"SNS:DeleteTopic\",\n        \"SNS:ListSubscriptionsByTopic\",\n        \"SNS:GetTopicAttributes\",\n        \"SNS:AddPermission\",\n        \"SNS:Subscribe\"\n      ],\n      \"Resource\": \"arn:aws:sns:us-east-2:123456789012:my-sns-topic\",\n      \"Condition\": {\n        \"StringEquals\": {\n          \"AWS:SourceOwner\": \"123456789012\"\n        }\n      }\n    }\n  ]\n}<\/code><\/pre>\n\n\n\n<p>The above is wrong and will not let your CodePipeline access the&nbsp;<strong>SNS topic<\/strong>&nbsp;(make it reachable\/&#8221;Active&#8221;)! Change the&nbsp;<strong>Access policy<\/strong>&nbsp;for your&nbsp;<strong>SNS topic<\/strong>&nbsp;to the following instead:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"Version\": \"2008-10-17\",\n  \"Statement\": &#91;\n    {\n      \"Sid\": \"CodeNotification_publish\",\n      \"Effect\": \"Allow\",\n      \"Principal\": {\n        \"Service\": \"codestar-notifications.amazonaws.com\"\n      },\n      \"Action\": \"SNS:Publish\",\n      \"Resource\": \"arn:aws:sns:us-east-2:123456789012:my-sns-topic\"\n    }\n  ]\n}<\/code><\/pre>\n\n\n\n<p><strong>NOTE 1<\/strong>: Change&nbsp;<code>123456789012<\/code>&nbsp;to your AWS account ID, and&nbsp;<code>my-sns-topic<\/code>&nbsp;to the name of your&nbsp;<strong>SNS topic<\/strong>.<br><strong>NOTE 2<\/strong>: If your region is different than&nbsp;<code>us-east-2<\/code>, then change that too in the above snippet.<br><strong>NOTE 3<\/strong>: Both the&nbsp;<strong>SNS topic<\/strong>&nbsp;and the&nbsp;<strong>CodePipeline Notification rule<\/strong>&nbsp;should be in the same region, otherwise this won&#8217;t work.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Notification Rule and Notification Rule Target Issue<\/h3>\n\n\n\n<p>Whenever you create a&nbsp;<strong>Notification Rule<\/strong>&nbsp;and then a&nbsp;<strong>Notification Rule Target<\/strong>, the only way possible for AWS to refresh the&nbsp;<strong>Notification target status<\/strong>&nbsp;is for you to delete the&nbsp;<strong>Notification rule target<\/strong>&nbsp;from&nbsp;<code>CodePipeline -&gt; Settings (on the left side bar) -&gt; Notification rules -&gt; Notification rule targets<\/code>&nbsp;(this is extremely important!).<\/p>\n\n\n\n<p><strong>NOTE<\/strong>: Deleting the&nbsp;<strong>Notification rule target<\/strong>&nbsp;from the notification rule itself won&#8217;t do anything; because of that, when you re-add it in that page, the&nbsp;<strong>Notification rule target<\/strong>&nbsp;will still be the old one and thus the&nbsp;<strong>Notification target status<\/strong>&nbsp;will remain &#8220;Unreachable&#8221;.<\/p>\n\n\n\n<p><a href=\"https:\/\/stackoverflow.com\/questions\/66743113\/sns-notification-target-rule-is-unreachable-when-tryin-to-send-a-notification\" target=\"_blank\" rel=\"noreferrer noopener\">credit link<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Whenever you create an&nbsp;SNS topic by itself, the default access policy will look something like this: The default access policy shown as below is wrong and will not work.&nbsp; The above is wrong and will not let your CodePipeline access the&nbsp;SNS topic&nbsp;(make it reachable\/&#8221;Active&#8221;)! Change the&nbsp;Access policy&nbsp;for your&nbsp;SNS topic&nbsp;to the following instead: NOTE 1: Change&nbsp;123456789012&nbsp;to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[],"class_list":["post-311","post","type-post","status-publish","format-standard","hentry","category-aws"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SNS notification target rule is &quot;unreachable&quot; when tryin to send a notification from code pipeline - Santosh Kumar Shah<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/santosh-shah.com\/blog\/sns-notification-target-rule-is-unreachable-when-tryin-to-send-a-notification-from-code-pipeline\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SNS notification target rule is &quot;unreachable&quot; when tryin to send a notification from code pipeline - Santosh Kumar Shah\" \/>\n<meta property=\"og:description\" content=\"Whenever you create an&nbsp;SNS topic by itself, the default access policy will look something like this: The default access policy shown as below is wrong and will not work.&nbsp; The above is wrong and will not let your CodePipeline access the&nbsp;SNS topic&nbsp;(make it reachable\/&#8221;Active&#8221;)! Change the&nbsp;Access policy&nbsp;for your&nbsp;SNS topic&nbsp;to the following instead: NOTE 1: Change&nbsp;123456789012&nbsp;to [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/santosh-shah.com\/blog\/sns-notification-target-rule-is-unreachable-when-tryin-to-send-a-notification-from-code-pipeline\/\" \/>\n<meta property=\"og:site_name\" content=\"Santosh Kumar Shah\" \/>\n<meta property=\"article:published_time\" content=\"2022-11-15T14:18:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-12-01T05:48:45+00:00\" \/>\n<meta name=\"author\" content=\"Santosh Kumar Shah\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Santosh Kumar Shah\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/santosh-shah.com\/blog\/sns-notification-target-rule-is-unreachable-when-tryin-to-send-a-notification-from-code-pipeline\/\",\"url\":\"https:\/\/santosh-shah.com\/blog\/sns-notification-target-rule-is-unreachable-when-tryin-to-send-a-notification-from-code-pipeline\/\",\"name\":\"SNS notification target rule is \\\"unreachable\\\" when tryin to send a notification from code pipeline - Santosh Kumar Shah\",\"isPartOf\":{\"@id\":\"https:\/\/santosh-shah.com\/blog\/#website\"},\"datePublished\":\"2022-11-15T14:18:22+00:00\",\"dateModified\":\"2022-12-01T05:48:45+00:00\",\"author\":{\"@id\":\"https:\/\/santosh-shah.com\/blog\/#\/schema\/person\/b17cb45bdd5f518e74a08ad2c6c4b39f\"},\"breadcrumb\":{\"@id\":\"https:\/\/santosh-shah.com\/blog\/sns-notification-target-rule-is-unreachable-when-tryin-to-send-a-notification-from-code-pipeline\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/santosh-shah.com\/blog\/sns-notification-target-rule-is-unreachable-when-tryin-to-send-a-notification-from-code-pipeline\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/santosh-shah.com\/blog\/sns-notification-target-rule-is-unreachable-when-tryin-to-send-a-notification-from-code-pipeline\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/santosh-shah.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SNS notification target rule is &#8220;unreachable&#8221; when tryin to send a notification from code pipeline\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/santosh-shah.com\/blog\/#website\",\"url\":\"https:\/\/santosh-shah.com\/blog\/\",\"name\":\"Santosh Kumar Shah\",\"description\":\"JavaScript Developer\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/santosh-shah.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/santosh-shah.com\/blog\/#\/schema\/person\/b17cb45bdd5f518e74a08ad2c6c4b39f\",\"name\":\"Santosh Kumar Shah\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/santosh-shah.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cf46c57219d897547f3204b6b302169b3302b17507ccc902946b622a78d0b98b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cf46c57219d897547f3204b6b302169b3302b17507ccc902946b622a78d0b98b?s=96&d=mm&r=g\",\"caption\":\"Santosh Kumar Shah\"},\"description\":\"I am JavaScript developer.\",\"sameAs\":[\"https:\/\/santosh-shah.com\/blog\"],\"url\":\"https:\/\/santosh-shah.com\/blog\/author\/sks7yu\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SNS notification target rule is \"unreachable\" when tryin to send a notification from code pipeline - Santosh Kumar Shah","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/santosh-shah.com\/blog\/sns-notification-target-rule-is-unreachable-when-tryin-to-send-a-notification-from-code-pipeline\/","og_locale":"en_US","og_type":"article","og_title":"SNS notification target rule is \"unreachable\" when tryin to send a notification from code pipeline - Santosh Kumar Shah","og_description":"Whenever you create an&nbsp;SNS topic by itself, the default access policy will look something like this: The default access policy shown as below is wrong and will not work.&nbsp; The above is wrong and will not let your CodePipeline access the&nbsp;SNS topic&nbsp;(make it reachable\/&#8221;Active&#8221;)! Change the&nbsp;Access policy&nbsp;for your&nbsp;SNS topic&nbsp;to the following instead: NOTE 1: Change&nbsp;123456789012&nbsp;to [&hellip;]","og_url":"https:\/\/santosh-shah.com\/blog\/sns-notification-target-rule-is-unreachable-when-tryin-to-send-a-notification-from-code-pipeline\/","og_site_name":"Santosh Kumar Shah","article_published_time":"2022-11-15T14:18:22+00:00","article_modified_time":"2022-12-01T05:48:45+00:00","author":"Santosh Kumar Shah","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Santosh Kumar Shah","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/santosh-shah.com\/blog\/sns-notification-target-rule-is-unreachable-when-tryin-to-send-a-notification-from-code-pipeline\/","url":"https:\/\/santosh-shah.com\/blog\/sns-notification-target-rule-is-unreachable-when-tryin-to-send-a-notification-from-code-pipeline\/","name":"SNS notification target rule is \"unreachable\" when tryin to send a notification from code pipeline - Santosh Kumar Shah","isPartOf":{"@id":"https:\/\/santosh-shah.com\/blog\/#website"},"datePublished":"2022-11-15T14:18:22+00:00","dateModified":"2022-12-01T05:48:45+00:00","author":{"@id":"https:\/\/santosh-shah.com\/blog\/#\/schema\/person\/b17cb45bdd5f518e74a08ad2c6c4b39f"},"breadcrumb":{"@id":"https:\/\/santosh-shah.com\/blog\/sns-notification-target-rule-is-unreachable-when-tryin-to-send-a-notification-from-code-pipeline\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/santosh-shah.com\/blog\/sns-notification-target-rule-is-unreachable-when-tryin-to-send-a-notification-from-code-pipeline\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/santosh-shah.com\/blog\/sns-notification-target-rule-is-unreachable-when-tryin-to-send-a-notification-from-code-pipeline\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/santosh-shah.com\/blog\/"},{"@type":"ListItem","position":2,"name":"SNS notification target rule is &#8220;unreachable&#8221; when tryin to send a notification from code pipeline"}]},{"@type":"WebSite","@id":"https:\/\/santosh-shah.com\/blog\/#website","url":"https:\/\/santosh-shah.com\/blog\/","name":"Santosh Kumar Shah","description":"JavaScript Developer","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/santosh-shah.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/santosh-shah.com\/blog\/#\/schema\/person\/b17cb45bdd5f518e74a08ad2c6c4b39f","name":"Santosh Kumar Shah","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/santosh-shah.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cf46c57219d897547f3204b6b302169b3302b17507ccc902946b622a78d0b98b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cf46c57219d897547f3204b6b302169b3302b17507ccc902946b622a78d0b98b?s=96&d=mm&r=g","caption":"Santosh Kumar Shah"},"description":"I am JavaScript developer.","sameAs":["https:\/\/santosh-shah.com\/blog"],"url":"https:\/\/santosh-shah.com\/blog\/author\/sks7yu\/"}]}},"_links":{"self":[{"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/posts\/311","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/comments?post=311"}],"version-history":[{"count":3,"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/posts\/311\/revisions"}],"predecessor-version":[{"id":324,"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/posts\/311\/revisions\/324"}],"wp:attachment":[{"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/media?parent=311"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/categories?post=311"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/tags?post=311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}