{"id":24543,"date":"2026-05-27T17:55:21","date_gmt":"2026-05-27T17:55:21","guid":{"rendered":"https:\/\/umang.pk\/2026\/05\/27\/%d8%b1%db%8c%d8%a6%d9%84-%d9%88%d8%b1%d9%84%da%88-%da%88%db%8c-%d8%a7%d9%88-%d8%a7%d9%88%d9%be%d8%b3-%d8%a2%d9%b9%d9%88%d9%85%db%8c%d8%b4%d9%86-%da%a9%db%92-%d9%84%db%8c%db%92-%d8%a8%d8%a7%d8%b4\/"},"modified":"2026-05-27T17:55:22","modified_gmt":"2026-05-27T17:55:22","slug":"%d8%b1%db%8c%d8%a6%d9%84-%d9%88%d8%b1%d9%84%da%88-%da%88%db%8c-%d8%a7%d9%88-%d8%a7%d9%88%d9%be%d8%b3-%d8%a2%d9%b9%d9%88%d9%85%db%8c%d8%b4%d9%86-%da%a9%db%92-%d9%84%db%8c%db%92-%d8%a8%d8%a7%d8%b4","status":"publish","type":"post","link":"https:\/\/umang.pk\/en_us\/2026\/05\/27\/%d8%b1%db%8c%d8%a6%d9%84-%d9%88%d8%b1%d9%84%da%88-%da%88%db%8c-%d8%a7%d9%88-%d8%a7%d9%88%d9%be%d8%b3-%d8%a2%d9%b9%d9%88%d9%85%db%8c%d8%b4%d9%86-%da%a9%db%92-%d9%84%db%8c%db%92-%d8%a8%d8%a7%d8%b4\/","title":{"rendered":"\u0631\u06cc\u0626\u0644 \u0648\u0631\u0644\u0688 \u0688\u06cc \u0627\u0648 \u0627\u0648\u067e\u0633 \u0622\u0679\u0648\u0645\u06cc\u0634\u0646 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0628\u0627\u0634 \u0627\u0648\u0631 \u0627\u0632\u06af\u0631 \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06cc\u0633\u06d2 \u06a9\u0631\u06cc\u06ba &#8211; 5 \u067e\u0631\u0648\u0688\u06a9\u0634\u0646 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06cc\u0633\u0632 \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0627\u06cc\u06a9 \u0645\u06a9\u0645\u0644 \u06c1\u06cc\u0646\u0688 \u0628\u06a9"},"content":{"rendered":"\n<div id=\"\">\n<p>\u0622\u0679\u0648\u0645\u06cc\u0634\u0646 \u0627\u0633\u06a9\u0631\u067e\u0679\u0633 \u0627\u06a9\u062b\u0631 \u0633\u0633\u0679\u0645 \u06a9\u06cc \u062d\u06cc\u062b\u06cc\u062a \u06a9\u06d2 \u0628\u062c\u0627\u0626\u06d2 \u0639\u0645\u0644 \u06a9\u06cc \u062a\u06a9\u0645\u06cc\u0644 \u06a9\u0648 \u0686\u06cc\u06a9 \u06a9\u0631\u062a\u06cc \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>Kubernetes Pods \u0686\u0644 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba \u062c\u0628\u06a9\u06c1 \u0627\u0646\u062f\u0631\u0648\u0646\u06cc \u0627\u06cc\u067e\u0644\u06cc \u06a9\u06cc\u0634\u0646\u0632 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u06a9\u06cc \u062a\u0635\u062f\u06cc\u0642 \u0646\u06c1\u06cc\u06ba \u06a9\u0631 \u0633\u06a9\u062a\u06cc\u06ba\u06d4 \u0627\u06cc\u06a9 \u0679\u06cc\u0631\u0627\u0641\u0627\u0631\u0645 \u06a9\u06cc \u062a\u0639\u06cc\u0646\u0627\u062a\u06cc \u0635\u0627\u0641 \u0637\u0648\u0631 \u067e\u0631 \u0648\u0627\u067e\u0633 \u0622\u0633\u06a9\u062a\u06cc \u06c1\u06d2 \u062c\u0628 \u06a9\u0648\u0626\u06cc \u062f\u0633\u062a\u06cc \u0637\u0648\u0631 \u067e\u0631 \u06a9\u0644\u0627\u0624\u0688 \u06a9\u0646\u0633\u0648\u0644 \u0645\u06cc\u06ba \u0628\u0646\u06cc\u0627\u062f\u06cc \u0688\u06be\u0627\u0646\u0686\u06d2 \u06a9\u0648 \u062a\u0628\u062f\u06cc\u0644 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u0627\u06cc\u06a9 \u06a9\u06cc\u0646\u0631\u06cc \u0644\u0627\u0646\u0686 \u0645\u06cc\u06ba \u06a9\u0648\u0626\u06cc \u062e\u0627\u0645\u06cc \u0628\u0627\u0644\u06a9\u0644 \u0646\u06c1\u06cc\u06ba \u062f\u06a9\u06be\u0627\u0626\u06cc \u062f\u06d2 \u0633\u06a9\u062a\u06cc \u06c1\u06d2 \u062c\u0628 \u06a9\u06c1 \u0635\u0627\u0631\u0641 \u06c1\u0631 \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u06a9\u06d2 \u0644\u06cc\u06d2 5 \u0633\u06cc\u06a9\u0646\u0688 \u0627\u0646\u062a\u0638\u0627\u0631 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u0645\u0633\u0626\u0644\u06c1 \u0622\u0644\u06d2 \u06a9\u0627 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4 \u0645\u0633\u0626\u0644\u06c1 \u06cc\u06c1 \u06c1\u06d2 \u06a9\u06c1 \u0627\u06cc\u06a9 \u0646\u0638\u0627\u0645 \u0635\u062d\u062a \u0645\u0646\u062f \u0638\u0627\u06c1\u0631 \u06c1\u0648\u0633\u06a9\u062a\u0627 \u06c1\u06d2 \u062c\u0628 \u062d\u0642\u06cc\u0642\u062a \u0645\u06cc\u06ba \u0627\u06cc\u0633\u0627 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4<\/p>\n<p>\u06cc\u06c1 \u06c1\u06cc\u0646\u0688 \u0628\u06a9 \u0622\u067e \u06a9\u0648 Bash \u0627\u0648\u0631 Python \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u06d2 \u06c1\u0648\u0626\u06d2 \u067e\u0631\u0648\u0688\u06a9\u0634\u0646 \u0637\u0631\u0632 \u06a9\u06d2 \u0622\u0679\u0648\u0645\u06cc\u0634\u0646 \u06a9\u06d2 \u067e\u0627\u0646\u0686 \u0645\u0646\u0638\u0631\u0646\u0627\u0645\u0648\u06ba \u0633\u06d2 \u06af\u0632\u0631\u062a\u06cc \u06c1\u06d2:<\/p>\n<ul>\n<li>\n<p>\u0627\u067e\u0646\u0627 \u0645\u0627\u06c1\u0627\u0646\u06c1 \u0628\u0644 \u0622\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u063a\u06cc\u0631 \u0645\u0639\u0645\u0648\u0644\u06cc AWS \u0627\u062e\u0631\u0627\u062c\u0627\u062a \u06a9\u0627 \u067e\u062a\u06c1 \u0644\u06af\u0627\u0626\u06cc\u06ba\u06d4<\/p>\n<\/li>\n<li>\n<p>\u0679\u0631\u06cc\u06a9\u0646\u06af \u0622\u0626\u06cc \u0688\u06cc\u0632 \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u06d2 \u06c1\u0648\u0626\u06d2 \u0645\u062a\u0639\u062f\u062f \u0633\u0631\u0648\u0633\u0632 \u0645\u06cc\u06ba \u0644\u0627\u06af\u0632 \u06a9\u0648 \u0622\u067e\u0633 \u0645\u06cc\u06ba \u062c\u0648\u0691\u06cc\u06ba\u06d4<\/p>\n<\/li>\n<li>\n<p>\u0679\u06cc\u0631\u0627\u0641\u0627\u0631\u0645 \u06a9\u06d2 \u0628\u0627\u06c1\u0631 \u0627\u0646\u0641\u0631\u0627\u0633\u0679\u0631\u06a9\u0686\u0631 \u06a9\u06d2 \u0628\u06c1\u0627\u0624 \u06a9\u0648 \u062a\u0644\u0627\u0634 \u06a9\u0631\u0646\u0627<\/p>\n<\/li>\n<li>\n<p>\u062f\u0631\u062e\u0648\u0627\u0633\u062a \u06a9\u06cc \u0633\u0637\u062d \u067e\u0631 \u062e\u0641\u06cc\u06c1 \u06af\u0631\u062f\u0634 \u06a9\u06cc \u062a\u0648\u062b\u06cc\u0642 \u06a9\u0648 \u0645\u062d\u0641\u0648\u0638 \u0628\u0646\u0627\u0626\u06cc\u06ba<\/p>\n<\/li>\n<li>\n<p>\u0635\u0627\u0631\u0641\u06cc\u0646 \u06a9\u06cc \u0634\u06a9\u0627\u06cc\u062a \u06a9\u0631\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u062e\u0648\u062f\u06a9\u0627\u0631 \u0637\u0648\u0631 \u067e\u0631 \u0633\u0633\u062a \u062a\u0639\u06cc\u0646\u0627\u062a\u06cc\u0648\u06ba \u06a9\u0648 \u0631\u0648\u0644 \u0628\u06cc\u06a9 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<\/li>\n<\/ul>\n<p>\u0627\u0633 \u06c1\u06cc\u0646\u0688 \u0628\u06a9 \u06a9\u06d2 \u0627\u062e\u062a\u062a\u0627\u0645 \u062a\u06a9\u060c \u0622\u067e \u0686\u06be\u0648\u0679\u06d2 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0644\u06a9\u06be\u0646\u06d2 \u06a9\u06d2 \u0642\u0627\u0628\u0644 \u06c1\u0648 \u062c\u0627\u0626\u06cc\u06ba \u06af\u06d2 \u062c\u0648 \u0622\u067e \u06a9\u0648 \u06cc\u06c1 \u0645\u062d\u0633\u0648\u0633 \u06a9\u0631\u0646\u06d2 \u0645\u06cc\u06ba \u0645\u062f\u062f \u06a9\u0631\u06cc\u06ba \u06af\u06d2 \u06a9\u06c1 \u062c\u0628 \u0622\u067e \u06a9\u06d2 \u0633\u0633\u0679\u0645 \u0645\u06cc\u06ba \u06a9\u0686\u06be \u063a\u0644\u0637 \u06c1\u06d2\u060c \u06cc\u06c1\u0627\u06ba \u062a\u06a9 \u06a9\u06c1 \u062c\u0628 \u0679\u0648\u0644 \u06a9\u06c1\u06d2 \u06a9\u06c1 \u0633\u0628 \u06a9\u0686\u06be \u0679\u06be\u06cc\u06a9 \u06c1\u06d2\u06d4<\/p>\n<p>\u0627\u0633\u06a9\u0631\u067e\u0679 \u062c\u0627\u0646 \u0628\u0648\u062c\u06be \u06a9\u0631 \u0686\u06be\u0648\u0679\u0627 \u06c1\u06d2\u06d4 \u0627\u06c1\u0645 \u062d\u0635\u06c1 \u0627\u0633 \u06a9\u06d2 \u067e\u06cc\u0686\u06be\u06d2 \u0622\u067e\u0631\u06cc\u0634\u0646\u0644 \u0633\u0648\u0686 \u06c1\u06d2: \u0627\u0633\u06a9\u0631\u067e\u0679 \u06a9\u06d2 \u0627\u0642\u062f\u0627\u0645\u0627\u062a \u06a9\u0648 \u06a9\u06cc\u0627 \u0627\u0634\u0627\u0631\u06c1 \u062f\u06cc\u062a\u0627 \u06c1\u06d2\u060c \u06cc\u06c1 \u06a9\u0633 \u0646\u0627\u06a9\u0627\u0645\u06cc \u06a9\u06d2 \u0637\u0631\u06cc\u0642\u0648\u06ba \u06a9\u0627 \u067e\u062a\u06c1 \u0644\u06af\u0627 \u0633\u06a9\u062a\u0627 \u06c1\u06d2\u060c \u0627\u0648\u0631 \u067e\u0644\u06cc\u0679 \u0641\u0627\u0631\u0645 \u06a9\u0646 \u0645\u0641\u0631\u0648\u0636\u0648\u06ba \u067e\u0631 \u0645\u0628\u0646\u06cc \u06c1\u06d2\u06d4<\/p>\n<p>\u06c1\u0631 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06d2 \u06a9\u06cc\u0633 \u0645\u06cc\u06ba \u0686\u0644\u0627\u0626\u06d2 \u062c\u0627\u0646\u06d2 \u06a9\u06d2 \u0642\u0627\u0628\u0644 \u0688\u06cc\u0645\u0648 \u0645\u0627\u062d\u0648\u0644\u060c \u0627\u06cc\u06a9 \u0645\u06a9\u0645\u0644 \u0627\u0633\u06a9\u0631\u067e\u0679\u060c \u0645\u062a\u0639\u0644\u0642\u06c1 \u0646\u0638\u0627\u0645 \u06a9\u06d2 \u0631\u0648\u06cc\u06d2 \u06a9\u0627 \u062a\u062c\u0632\u06cc\u06c1\u060c \u0627\u0648\u0631 \u062c\u0627\u0646 \u0628\u0648\u062c\u06be \u06a9\u0631 \u063a\u0644\u0637\u06cc\u0627\u06ba \u0634\u0627\u0645\u0644 \u06c1\u0648\u062a\u06cc \u06c1\u06cc\u06ba \u062c\u0646\u06c1\u06cc\u06ba \u0635\u0627\u0631\u0641 \u0628\u0631\u0627\u06c1 \u0631\u0627\u0633\u062a \u0627\u0646\u062c\u0627\u0645 \u062f\u06d2 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u0627\u06af\u0631 \u0622\u067e \u0627\u0633 \u0648\u0631\u06a9 \u0641\u0644\u0648 \u0645\u06cc\u06ba \u0646\u0626\u06d2 \u06c1\u06cc\u06ba\u060c \u062a\u0648 Use Case 1 \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0634\u0631\u0648\u0639 \u06a9\u0631\u06cc\u06ba \u0627\u0648\u0631 \u0627\u067e\u0646\u06d2 \u0631\u0627\u0633\u062a\u06d2 \u067e\u0631 \u06a9\u0627\u0645 \u06a9\u0631\u06cc\u06ba\u06d4 \u0627\u0633 \u06a9\u06d2 \u0628\u0639\u062f \u06a9\u06d2 \u062d\u0635\u06d2 \u0627\u0633\u06cc \u0637\u0631\u0632 \u067e\u0631 \u0645\u0628\u0646\u06cc \u06c1\u06cc\u06ba\u06d4 \u0622\u0679\u0648\u0645\u06cc\u0634\u0646 \u0646\u06c1 \u0635\u0631\u0641 \u0639\u0645\u0644 \u06a9\u0648 \u0645\u06a9\u0645\u0644 \u06a9\u0631\u0646\u06d2 \u0628\u0644\u06a9\u06c1 \u062d\u0642\u06cc\u0642\u062a \u06a9\u06cc \u062c\u0627\u0646\u0686 \u0641\u0631\u0627\u06c1\u0645 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0628\u06be\u06cc \u0645\u0641\u06cc\u062f \u06c1\u06d2\u06d4<\/p>\n<h2 id=\"heading-prerequisites\">\u0634\u0631\u0637\u06cc\u06ba<\/h2>\n<p>\u0634\u0631\u0648\u0639 \u06a9\u0631\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2\u060c \u062f\u0631\u062c \u0630\u06cc\u0644 \u0633\u06cc\u0679 \u06a9\u0631\u06cc\u06ba:<\/p>\n<pre><code class=\"language-plaintext\">python3 -m venv venv\nsource venv\/bin\/activate  \n\n # on Windows: \n\nvenvScriptsactivate\n<\/code><\/pre>\n<p>\u06cc\u06c1 \u0627\u0646\u0633\u0679\u0627\u0644 \u0634\u062f\u06c1 \u067e\u06cc\u06a9\u062c\u0648\u06ba \u06a9\u0648 \u0633\u0633\u0679\u0645 Python \u0633\u06d2 \u0627\u0644\u06af \u0631\u06a9\u06be\u06d2 \u06af\u0627 \u0627\u0648\u0631 \u0645\u0634\u062a\u0631\u06a9\u06c1 \u06a9\u0645\u067e\u06cc\u0648\u0679\u0631\u0632 \u067e\u0631 \u0627\u062c\u0627\u0632\u062a \u06a9\u06cc \u063a\u0644\u0637\u06cc\u0648\u06ba \u06a9\u0648 \u0631\u0648\u06a9\u06d2 \u06af\u0627\u06d4<\/p>\n<ul>\n<li>\n<p><strong>\u0628\u06cc\u062c<\/strong> &#8211; \u0627\u0632\u06af\u0631 \u06a9\u0627 \u067e\u06cc\u06a9\u062c \u0627\u0646\u0633\u0679\u0627\u0644\u0631 \u0627\u0632\u06af\u0631 \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0634\u0627\u0645\u0644 \u06c1\u06d2\u06d4<\/p>\n<\/li>\n<li>\n<p><strong>AWS CLI<\/strong> \u0648\u0631\u06a9 \u067e\u0631\u0648\u0641\u0627\u0626\u0644 \u06a9\u06d2 \u0637\u0648\u0631 \u067e\u0631 \u062a\u0634\u06a9\u06cc\u0644 \u0634\u062f\u06c1 &#8211; \u0645\u0641\u062a \u0679\u0627\u0626\u0631 AWS \u0627\u06a9\u0627\u0624\u0646\u0679\u0633 1\u060c 3 \u0627\u0648\u0631 4 \u06a9\u06d2 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06d2 \u0644\u06cc\u06d2 \u06a9\u0627\u0641\u06cc \u06c1\u06cc\u06ba\u06d4 \u0686\u06cc\u06a9 \u06a9\u0631\u06cc\u06ba \u06a9\u06c1 \u0622\u06cc\u0627 \u06cc\u06c1 \u0627\u0633 \u06a9\u06d2 \u0633\u0627\u062a\u06be \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2:<\/p>\n<pre><code class=\"language-plaintext\">aws sts get-caller-identity\n<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u0688\u0648\u06a9\u0631 \u0627\u0648\u0631 \u0688\u0648\u06a9\u0631 \u06a9\u0645\u067e\u0648\u0632<\/strong> &#8211; \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06d2 \u0645\u0639\u0627\u0645\u0644\u0627\u062a 2\u060c 4\u060c \u0627\u0648\u0631 5 \u06a9\u06d2 \u0644\u06cc\u06d2 \u062f\u0631\u06a9\u0627\u0631 \u06c1\u06d2\u06d4<\/p>\n<\/li>\n<li>\n<p><strong>\u0642\u0633\u0645<\/strong> (Docker \u067e\u0631 Kubernetes) \u2013 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06d2 \u06a9\u06cc\u0633\u0632 4 \u0627\u0648\u0631 5 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0645\u0642\u0627\u0645\u06cc \u0637\u0648\u0631 \u067e\u0631 Kubernetes \u06a9\u0648 \u06a9\u06cc\u0633\u06d2 \u0686\u0644\u0627\u06cc\u0627 \u062c\u0627\u0626\u06d2\u06d4 \u0627\u0633 \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0627\u0646\u0633\u0679\u0627\u0644 \u06a9\u0631\u06cc\u06ba <code>brew install kind<\/code> macOS \u067e\u0631\u060c Kind Quick start \u06af\u0627\u0626\u06cc\u0688 \u067e\u0631 \u0639\u0645\u0644 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<\/li>\n<li>\n<p><strong>\u06a9\u06cc\u0648\u0628\u06cc\u06a9\u0679\u0644<\/strong> &#8211; \u0622\u067e \u06a9\u06d2 Kubernetes \u06a9\u0644\u0633\u0679\u0631 \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0628\u0627\u062a \u0686\u06cc\u062a \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u06cc\u06a9 \u06a9\u0645\u0627\u0646\u0688 \u0644\u0627\u0626\u0646 \u0679\u0648\u0644\u06d4 Kind \u0627\u0646\u0633\u0679\u0627\u0644 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0628\u0639\u062f \u0627\u0633\u06d2 \u0686\u0644\u0627\u0626\u06cc\u06ba\u06d4 <code>kind create cluster<\/code> kubectl \u062e\u0648\u062f \u0628\u062e\u0648\u062f \u06a9\u0646\u0641\u06cc\u06af\u0631 \u06c1\u0648\u062c\u0627\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<\/li>\n<li>\n<p><strong>\u06a9\u0646\u0679\u0631\u0648\u0644<\/strong> &#8211; \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06cc\u0633 \u06a9\u06d2 \u0644\u06cc\u06d2 Kubernetes \u06a9\u06d2 \u0644\u06cc\u06d2 \u067e\u06cc\u06a9\u06cc\u062c \u0645\u06cc\u0646\u06cc\u062c\u0631 \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u06c1\u06d2 5\u06d4 \u0627\u0633 \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0627\u0646\u0633\u0679\u0627\u0644 \u06a9\u0631\u06cc\u06ba\u06d4 <code>brew install helm<\/code> \u06cc\u0627 \u06c1\u06cc\u0644\u0645 \u0627\u0646\u0633\u0679\u0627\u0644\u06cc\u0634\u0646 \u06af\u0627\u0626\u06cc\u0688<\/p>\n<\/li>\n<li>\n<p><strong>\u0679\u06cc\u0631\u0627\u0641\u0627\u0631\u0645<\/strong> &#8211; \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06d2 \u0644\u06cc\u06d2 \u062f\u0631\u06a9\u0627\u0631 \u06a9\u06cc\u0633 3\u06d4 \u0627\u0646\u0633\u0679\u0627\u0644 \u06a9\u0631\u06cc\u06ba\u06d4 <code>brew install terraform<\/code> macOS \u067e\u0631 \u06cc\u0627 Terraform \u0627\u0646\u0633\u0679\u0627\u0644\u06cc\u0634\u0646 \u06af\u0627\u0626\u06cc\u0688 \u067e\u0631 \u0639\u0645\u0644 \u06a9\u0631\u06cc\u06ba\u06d4 \u0627\u0633\u06d2 \u0686\u06cc\u06a9 \u06a9\u0631\u06cc\u06ba <code>terraform version<\/code>.<\/p>\n<\/li>\n<li>\n<p><strong>B.C<\/strong> &#8211; \u0627\u06cc\u06a9 \u06a9\u06cc\u0644\u06a9\u0648\u0644\u06cc\u0679\u0631 \u06cc\u0648\u0679\u06cc\u0644\u06cc\u0679\u06cc \u062c\u0648 \u06a9\u06cc\u0646\u0631\u06cc \u0648\u0627\u0686 \u0627\u0633\u06a9\u0631\u067e\u0679 \u06a9\u06d2 \u0630\u0631\u06cc\u0639\u06d2 \u0641\u0644\u0648\u0679\u0646\u06af \u067e\u0648\u0627\u0626\u0646\u0679 \u06a9\u06d2 \u0645\u0648\u0627\u0632\u0646\u06c1 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06cc \u062c\u0627\u062a\u06cc \u06c1\u06d2\u06d4 \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0627\u0646\u0633\u0679\u0627\u0644 \u06a9\u0631\u06cc\u06ba\u06d4 <code>brew install bc<\/code> macOS \u06cc\u0627 <code>apt install bc<\/code> \u0627\u0648\u0628\u0646\u0679\u0648 \u067e\u0631\u06d4 \u0686\u0644\u0627\u0626\u06cc\u06ba <code>bc --version<\/code> \u06a9\u06cc\u0633 5 \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u0634\u0631\u0648\u0639 \u06a9\u0631\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2\u060c \u0686\u06cc\u06a9 \u06a9\u0631\u06cc\u06ba \u06a9\u06c1 \u0622\u06cc\u0627 \u06cc\u06c1 \u062f\u0633\u062a\u06cc\u0627\u0628 \u06c1\u06d2\u06d4<\/p>\n<\/li>\n<\/ul>\n<h3 id=\"heading-knowledge-and-skills\">\u0639\u0644\u0645 \u0627\u0648\u0631 \u0645\u06c1\u0627\u0631\u062a<\/h3>\n<ul>\n<li>\n<p>\u0622\u067e \u06a9\u0648 \u0627\u0632\u06af\u0631 \u0627\u0648\u0631 \u0628\u0627\u0634 \u0627\u0633\u06a9\u0631\u067e\u0679\u0633 \u06a9\u0648 \u0634\u0631\u0648\u0639 \u0633\u06d2 \u0644\u06a9\u06be\u06d2 \u0628\u063a\u06cc\u0631 \u067e\u0691\u06be\u0646\u06d2 \u0645\u06cc\u06ba \u0622\u0631\u0627\u0645 \u0633\u06d2 \u0631\u06c1\u0646\u0627 \u0686\u0627\u06c1\u0626\u06d2\u06d4<\/p>\n<\/li>\n<li>\n<p>\u0622\u067e \u06a9\u06d2 \u067e\u0627\u0633 \u0628\u0646\u06cc\u0627\u062f\u06cc \u0644\u06cc\u0646\u06a9\u0633 \u0679\u0631\u0645\u06cc\u0646\u0644 \u06a9\u06cc \u0633\u06c1\u0648\u0644\u062a \u06c1\u0648\u0646\u06cc \u0686\u0627\u06c1\u06cc\u06d2\u060c \u0628\u0634\u0645\u0648\u0644 \u0688\u0627\u0626\u0631\u06a9\u0679\u0631\u06cc\u0648\u06ba \u06a9\u0648 \u0646\u06cc\u0648\u06cc\u06af\u06cc\u0679 \u06a9\u0631\u0646\u0627\u060c \u0627\u0633\u06a9\u0631\u067e\u0679 \u06a9\u0648 \u0686\u0644\u0627\u0646\u0627\u060c \u0627\u0648\u0631 \u0622\u0624\u0679 \u067e\u0679 \u067e\u0691\u06be\u0646\u0627\u06d4<\/p>\n<\/li>\n<li>\n<p>\u0628\u0646\u06cc\u0627\u062f\u06cc \u0633\u0637\u062d \u067e\u0631\u060c \u0622\u067e \u06a9\u0648 \u06cc\u06c1 \u062c\u0627\u0646\u0646\u06d2 \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u06c1\u06d2 \u06a9\u06c1 Kubernetes pods \u0627\u0648\u0631 \u062a\u0639\u06cc\u0646\u0627\u062a\u06cc\u0627\u06ba \u06a9\u06cc\u0627 \u06c1\u06cc\u06ba\u06d4 \u06a9\u06cc\u0633\u0632 4 \u0627\u0648\u0631 5 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u06cc\u06ba Kubernetes \u06a9\u06d2 \u062a\u0635\u0648\u0631\u0627\u062a \u06a9\u0648 \u0645\u062a\u0639\u0627\u0631\u0641 \u06a9\u0631\u0627\u062a\u06d2 \u06c1\u06cc\u06ba \u062c\u0648 \u0622\u067e \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba \u0627\u0648\u0631 \u06af\u06c1\u0631\u0627\u0626\u06cc \u0633\u06d2 Kubernetes \u06a9\u06cc \u0645\u06c1\u0627\u0631\u062a \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4<\/p>\n<\/li>\n<li>\n<p>AWS \u06a9\u06d2 \u0628\u0646\u06cc\u0627\u062f\u06cc \u0627\u0635\u0648\u0644\u0648\u06ba \u0633\u06d2 \u0648\u0627\u0642\u0641\u06cc\u062a \u062c\u06cc\u0633\u06d2 EC2\u060c IAM\u060c \u0627\u0648\u0631 Secrets Manager \u06a9\u06d2 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06d2 \u06a9\u06cc\u0633\u0632 1\u060c 3 \u0627\u0648\u0631 4 \u0645\u06cc\u06ba \u0645\u062f\u062f \u0645\u0644\u06d2 \u06af\u06cc\u060c \u062c\u0628\u06a9\u06c1 \u06a9\u06cc\u0633 2 \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u0645\u06a9\u0645\u0644 \u0637\u0648\u0631 \u067e\u0631 \u0622\u067e \u06a9\u06cc \u0645\u0642\u0627\u0645\u06cc \u0645\u0634\u06cc\u0646 \u067e\u0631 \u0686\u0644\u062a\u0627 \u06c1\u06d2 \u0627\u0648\u0631 \u0627\u0633\u06d2 AWS \u06a9\u06d2 \u0639\u0644\u0645 \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4<\/p>\n<\/li>\n<li>\n<p>\u06a9\u06cc\u0633 3 \u06a9\u06d2 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06d2 \u0644\u06cc\u06d2\u060c \u06cc\u06c1 \u062c\u0627\u0646\u0646\u0627 \u0645\u062f\u062f\u06af\u0627\u0631 \u06c1\u06d2 \u06a9\u06c1 Terraform \u06a9\u06cc\u0627 \u06c1\u06d2 \u0627\u0648\u0631 \u0631\u06cc\u0627\u0633\u062a\u06cc \u0641\u0627\u0626\u0644\u06cc\u06ba \u06a9\u06cc\u0627 \u06a9\u0631\u062a\u06cc \u06c1\u06cc\u06ba\u06d4 \u0622\u067e \u06a9\u0648 Terraform \u0644\u06a9\u06be\u0646\u06d2 \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u060c \u0644\u06cc\u06a9\u0646 \u06cc\u06c1 \u0633\u0645\u062c\u06be\u0646\u0627 \u06a9\u06c1 Terraform \u06a9\u06cc\u0627 \u0679\u0631\u06cc\u06a9 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u0627\u0648\u0631 \u06a9\u06cc\u0627 \u067e\u06cc\u062f\u0627 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u0622\u067e \u06a9\u06d2 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06d2 \u067e\u0648\u0631\u06d2 \u06a9\u06cc\u0633 \u06a9\u06cc \u0628\u0646\u06cc\u0627\u062f \u06c1\u06d2\u06d4<\/p>\n<\/li>\n<\/ul>\n<h3 id=\"heading-aws-iam-permissions-required\">AWS IAM \u0627\u062c\u0627\u0632\u062a \u062f\u0631\u06a9\u0627\u0631 \u06c1\u06d2\u06d4<\/h3>\n<p>\u0627\u0633 \u0622\u0631\u0679\u06cc\u06a9\u0644 \u0645\u06cc\u06ba \u0645\u0648\u062c\u0648\u062f \u0627\u0633\u06a9\u0631\u067e\u0679\u0633 \u0627\u0635\u0644 AWS API \u06a9\u0627\u0644 \u06a9\u0631\u062a\u06cc \u06c1\u06cc\u06ba\u06d4 \u0627\u06cc\u06a9 IAM \u0635\u0627\u0631\u0641 \u06cc\u0627 \u06a9\u0631\u062f\u0627\u0631 \u06a9\u0648 \u062f\u0631\u062c \u0630\u06cc\u0644 \u06a9\u0645 \u0627\u0632 \u06a9\u0645 \u0627\u062c\u0627\u0632\u062a\u0648\u06ba \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u06c1\u0648\u062a\u06cc \u06c1\u06d2: (\u0627\u06af\u0631 \u0622\u067e \u062f\u06cc\u06a9\u06be\u06cc\u06ba <code>AccessDenied<\/code> \u0627\u06af\u0631 \u0622\u067e \u06a9\u0648 \u06a9\u0648\u0626\u06cc \u063a\u0644\u0637\u06cc \u06c1\u0648 \u0631\u06c1\u06cc \u06c1\u06d2\u060c \u062a\u0648 \u0633\u0628 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u062c\u0648 \u062c\u06af\u06c1\u06cc\u06ba \u062f\u06cc\u06a9\u06be\u06cc\u06ba \u0648\u06c1 \u06cc\u06c1 \u06c1\u06cc\u06ba:<\/p>\n<table>\n<thead>\n<tr>\n<th>\u06a9\u06cc\u0633\u0632 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u06cc\u06ba\u06d4<\/th>\n<th>IAM \u0627\u062c\u0627\u0632\u062a\u06cc\u06ba \u062f\u0631\u06a9\u0627\u0631 \u06c1\u06cc\u06ba\u06d4<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>1 &#8211; \u0644\u0627\u06af\u062a \u0645\u06cc\u06ba \u0628\u06d2 \u0636\u0627\u0628\u0637\u06af\u06cc \u06a9\u0627 \u067e\u062a\u06c1 \u0644\u06af\u0627\u0646\u0627<\/td>\n<td><code>ce:GetCostAndUsage<\/code><\/td>\n<\/tr>\n<tr>\n<td>3 &#8211; \u0622\u0644\u06af\u0627\u0626\u06d2 \u06a9\u0627 \u067e\u062a\u06c1 \u0644\u06af\u0627\u0646\u0627<\/td>\n<td><code>ec2:DescribeSecurityGroups<\/code><\/td>\n<\/tr>\n<tr>\n<td>4 &#8211; \u062e\u0641\u06cc\u06c1 \u062a\u0628\u062f\u06cc\u0644\u06cc<\/td>\n<td><code>secretsmanager:GetSecretValue<\/code>\u060c <code>secretsmanager:PutSecretValue<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u0627\u06af\u0631 \u0622\u067e \u0627\u06cc\u06a9 \u0646\u06cc\u0627 AWS Free Tier \u0627\u06a9\u0627\u0624\u0646\u0679 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631 \u0631\u06c1\u06d2 \u06c1\u06cc\u06ba\u06d4 <code>AdministratorAccess<\/code> \u0686\u0648\u0646\u06a9\u06c1 \u0648\u06c1 \u0645\u0646\u0633\u0644\u06a9 \u06c1\u06cc\u06ba\u060c \u06cc\u06c1 \u0627\u062c\u0627\u0632\u062a\u06cc\u06ba \u067e\u06c1\u0644\u06d2 \u0633\u06d2 \u0634\u0627\u0645\u0644 \u06c1\u06cc\u06ba \u0627\u0648\u0631 \u0622\u067e \u0627\u0633 \u0645\u0631\u062d\u0644\u06c1 \u06a9\u0648 \u0686\u06be\u0648\u0691 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u0627\u06af\u0631 \u0622\u067e \u0627\u06cc\u06a9 \u0645\u062d\u062f\u0648\u062f IAM \u0635\u0627\u0631\u0641 \u06c1\u06cc\u06ba\u060c \u062a\u0648 \u0627\u0633 \u0635\u0627\u0631\u0641 \u06a9\u0648 \u0634\u0627\u0645\u0644 \u06a9\u0631\u0646\u06d2 \u06a9\u0627 \u0637\u0631\u06cc\u0642\u06c1 \u06cc\u06c1\u0627\u06ba \u06c1\u06d2: AWS \u06a9\u0646\u0633\u0648\u0644 \u0645\u06cc\u06ba\u060c IAM \u067e\u0631 \u062c\u0627\u0626\u06cc\u06ba\u060c \u0635\u0627\u0631\u0641\u06cc\u0646 \u067e\u0631 \u06a9\u0644\u06a9 \u06a9\u0631\u06cc\u06ba\u060c \u0627\u0648\u0631 \u067e\u06be\u0631 \u0627\u067e\u0646\u06d2 \u0635\u0627\u0631\u0641 \u0646\u0627\u0645 \u067e\u0631 \u06a9\u0644\u06a9 \u06a9\u0631\u06cc\u06ba\u06d4 \u0627\u062c\u0627\u0632\u062a \u0648\u0627\u0644\u06d2 \u0679\u06cc\u0628 \u067e\u0631\u060c \u0627\u062c\u0627\u0632\u062a \u0634\u0627\u0645\u0644 \u06a9\u0631\u06cc\u06ba \u067e\u0631 \u06a9\u0644\u06a9 \u06a9\u0631\u06cc\u06ba\u060c \u0627\u0648\u0631 \u067e\u06be\u0631 \u0627\u0646 \u0644\u0627\u0626\u0646 \u067e\u0627\u0644\u06cc\u0633\u06cc \u0628\u0646\u0627\u0626\u06cc\u06ba \u067e\u0631 \u06a9\u0644\u06a9 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<p>JSON \u0679\u06cc\u0628 \u067e\u0631 \u062c\u0627\u0626\u06cc\u06ba \u0627\u0648\u0631 \u0627\u0648\u067e\u0631 \u062f\u06cc\u06d2 \u06af\u0626\u06d2 \u062c\u062f\u0648\u0644 \u0645\u06cc\u06ba \u0627\u062c\u0627\u0632\u062a \u062f\u06cc\u0646\u06d2 \u0648\u0627\u0644\u06d2 \u067e\u0627\u0644\u06cc\u0633\u06cc \u062f\u0633\u062a\u0627\u0648\u06cc\u0632 \u06a9\u0648 \u0686\u0633\u067e\u0627\u06ba \u06a9\u0631\u06cc\u06ba \u0627\u0648\u0631 \u0645\u062d\u0641\u0648\u0638 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<p>\u0627\u06af\u0631 \u0622\u067e \u06a9\u06cc \u06a9\u0645\u067e\u0646\u06cc \u0622\u067e \u06a9\u06cc \u062a\u0646\u0638\u06cc\u0645 \u06a9\u06d2 \u0630\u0631\u06cc\u0639\u06d2 AWS \u06a9\u0627 \u0627\u0646\u062a\u0638\u0627\u0645 \u06a9\u0631\u062a\u06cc \u06c1\u06d2 \u0627\u0648\u0631 \u0622\u067e \u06a9\u0648 \u0627\u067e\u0646\u06cc IAM \u067e\u0627\u0644\u06cc\u0633\u06cc\u0648\u06ba \u0645\u06cc\u06ba \u062a\u0631\u0645\u06cc\u0645 \u06a9\u0631\u0646\u06d2 \u06a9\u06cc \u0627\u062c\u0627\u0632\u062a \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u060c \u062a\u0648 \u0627\u067e\u0646\u06d2 \u0645\u0646\u062a\u0638\u0645 \u0633\u06d2 \u0627\u0646 \u0627\u062c\u0627\u0632\u062a\u0648\u06ba \u06a9\u0648 \u0627\u067e\u0646\u06d2 \u06a9\u0631\u062f\u0627\u0631 \u0645\u06cc\u06ba \u0634\u0627\u0645\u0644 \u06a9\u0631\u0646\u06d2 \u06a9\u0648 \u06a9\u06c1\u06cc\u06ba\u06d4<\/p>\n<h3 id=\"heading-companion-github-repository\">\u0633\u0627\u062a\u06be\u06cc GitHub \u0630\u062e\u06cc\u0631\u06c1<\/h3>\n<p>\u062a\u0645\u0627\u0645 \u0688\u06cc\u0645\u0648 \u067e\u0631\u0648\u062c\u06cc\u06a9\u0679\u0633 \u06cc\u06c1\u0627\u06ba \u0645\u0648\u062c\u0648\u062f \u06c1\u06cc\u06ba: <strong>https:\/\/github.com\/irvingtalks\/devops-scripting-labs<\/strong><\/p>\n<p>\u06c1\u0631 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06d2 \u06a9\u06cc\u0633 \u0645\u06cc\u06ba \u0627\u06cc\u06a9 \u0645\u06a9\u0645\u0644 \u0627\u0633\u06a9\u0631\u067e\u0679\u060c \u0633\u067e\u0648\u0631\u0679 \u0641\u0627\u0626\u0644\u06cc\u06ba\u060c <code>setup.sh<\/code> \u0645\u0627\u062d\u0648\u0644 \u062a\u06cc\u0627\u0631 \u06a9\u0631\u06cc\u06ba\u060c <code>break_it.sh<\/code> \u06cc\u06c1 \u0645\u062e\u0635\u0648\u0635 \u063a\u0644\u0637\u06cc\u0627\u06ba \u0627\u0646\u062c\u06cc\u06a9\u0634\u0646 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u062c\u0648 \u06c1\u0631 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06d2 \u0645\u0639\u0627\u0645\u0644\u06d2 \u06a9\u06cc \u0628\u0646\u06cc\u0627\u062f \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u0634\u0631\u0648\u0639 \u06a9\u0631\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u0630\u062e\u06cc\u0631\u06c1 \u06a9\u0644\u0648\u0646 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<pre><code class=\"language-plaintext\">git clone https:\/\/github.com\/irvingtalks\/devops-scripting-labs\ncd devops-scripting-labs\n<\/code><\/pre>\n<p>\u0627\u067e\u0646\u06d2 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06d2 \u06a9\u06cc\u0633 \u06a9\u0648 \u0686\u0644\u0627\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u06cc\u0642\u06cc\u0646\u06cc \u0628\u0646\u0627\u0626\u06cc\u06ba \u06a9\u06c1 \u0633\u0628 \u06a9\u0686\u06be \u0627\u0646\u0633\u0679\u0627\u0644 \u06c1\u06d2\u06d4<\/p>\n<pre><code class=\"language-plaintext\">.\/preflight.sh\n<\/code><\/pre>\n<p>\u0627\u0633 \u0645\u06cc\u06ba \u0648\u06c1 \u062a\u0645\u0627\u0645 \u0679\u0648\u0644\u0632 \u0634\u0627\u0645\u0644 \u06c1\u06cc\u06ba \u062c\u0646 \u06a9\u06cc \u0622\u067e \u06a9\u0648 \u0645\u0634\u0642 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0636\u0631\u0648\u0631\u062a \u06c1\u06d2\u060c \u0628\u0634\u0645\u0648\u0644 Python\u060c AWS CLI\u060c Docker\u060c Kind\u060c Helm\u060c \u0627\u0648\u0631 Terraform\u06d4 <code>bc<\/code> \u06cc\u06c1 \u0622\u067e \u06a9\u0648 \u0628\u062a\u0627\u062a\u0627 \u06c1\u06d2 \u06a9\u06c1 \u06c1\u0631 \u0627\u0646\u0633\u0679\u0627\u0644\u06cc\u0634\u0646 \u06a9\u0645\u0627\u0646\u0688 \u0645\u06cc\u06ba \u06a9\u06cc\u0627 \u063a\u0627\u0626\u0628 \u06c1\u06d2\u06d4<\/p>\n<h2 id=\"heading-table-of-contents\">\u0627\u0646\u0688\u06cc\u06a9\u0633<\/h2>\n<h2 id=\"heading-use-case-1-cost-anomaly-detection\">\u06a9\u06cc\u0633 1 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u06cc\u06ba &#8211; \u0644\u0627\u06af\u062a \u0645\u06cc\u06ba \u0628\u06d2 \u0636\u0627\u0628\u0637\u06af\u06cc \u06a9\u0627 \u067e\u062a\u06c1 \u0644\u06af\u0627\u0646\u0627<\/h2>\n<p><strong>\u0645\u0627\u062d\u0648\u0644:<\/strong> AWS Cost Explorer API (\u0635\u0631\u0641 \u067e\u0691\u06be\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2\u060c \u062a\u0645\u0627\u0645 \u0627\u06a9\u0627\u0624\u0646\u0679\u0633 \u06a9\u06d2 \u0644\u06cc\u06d2 \u062f\u0633\u062a\u06cc\u0627\u0628) <strong>\u0632\u0628\u0627\u0646:<\/strong> \u0627\u0632\u06af\u0631<\/p>\n<h3 id=\"heading-the-production-problem\">\u067e\u06cc\u062f\u0627\u0648\u0627\u0631 \u06a9\u06d2 \u0645\u0633\u0627\u0626\u0644<\/h3>\n<p>\u0627\u06cc\u06a9 \u062c\u0648\u0646\u06cc\u0626\u0631 \u0627\u0646\u062c\u06cc\u0646\u0626\u0631 Kubernetes \u06a9\u0646\u0641\u06cc\u06af\u0631\u06cc\u0634\u0646 \u06a9\u06cc \u062c\u0627\u0646\u0686 \u06a9\u0631 \u0631\u06c1\u0627 \u06c1\u06d2\u06d4 \u0622\u067e AWS \u0645\u06cc\u06ba \u0627\u06cc\u06a9 \u0645\u0646\u0638\u0645 \u0646\u0648\u0688 \u06af\u0631\u0648\u067e \u06a9\u0648 \u06af\u06be\u0645\u0627\u062a\u06d2 \u06c1\u06cc\u06ba (EC2 \u0648\u0631\u0686\u0648\u0626\u0644 \u0645\u0634\u06cc\u0646\u0648\u06ba \u06a9\u0627 \u0627\u06cc\u06a9 \u0633\u06cc\u0679 \u062c\u0633\u06d2 \u0622\u067e \u06a9\u0627 Kubernetes \u06a9\u0644\u0633\u0679\u0631 \u0627\u067e\u0646\u06d2 \u06a9\u0627\u0645 \u06a9\u06d2 \u0628\u0648\u062c\u06be \u06a9\u0648 \u0686\u0644\u0627\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u0627 \u06c1\u06d2) \u0627\u0648\u0631 \u06a9\u0644\u0633\u0679\u0631 \u0622\u0679\u0648 \u0627\u0633\u06a9\u06cc\u0644\u0631 \u06a9\u0648 \u06a9\u0646\u0641\u06cc\u06af\u0631 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u060c \u0627\u06cc\u06a9 Kubernetes \u062c\u0632\u0648 \u062c\u0648 \u0622\u067e \u06a9\u06d2 \u06a9\u0644\u0633\u0679\u0631 \u06a9\u0648 \u0632\u06cc\u0627\u062f\u06c1 \u0635\u0644\u0627\u062d\u06cc\u062a \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u06c1\u0648\u0646\u06d2 \u067e\u0631 \u0645\u0632\u06cc\u062f \u0645\u0634\u06cc\u0646\u06cc\u06ba \u0634\u0627\u0645\u0644 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u0627\u0645\u062a\u062d\u0627\u0646 \u0627\u0686\u06be\u0627 \u06c1\u0648\u0627 \u0627\u0648\u0631 \u062c\u0645\u0639\u06c1 \u06a9\u06cc \u062f\u0648\u067e\u06c1\u0631 \u062a\u06a9 \u06c1\u0645 \u0645\u0627\u062d\u0648\u0644 \u06a9\u0648 \u062a\u0628\u0627\u06c1 \u06a9\u0631\u0646\u0627 \u0628\u06be\u0648\u0644 \u0686\u06a9\u06d2 \u062a\u06be\u06d2\u06d4<\/p>\n<p>\u0686\u0648\u0646\u06a9\u06c1 \u06c1\u0641\u062a\u06d2 \u06a9\u06d2 \u0622\u062e\u0631 \u0645\u06cc\u06ba \u0622\u0632\u0645\u0627\u0626\u0634\u06cc \u06a9\u0627\u0645 \u06a9\u0627 \u0628\u0648\u062c\u06be \u062c\u0627\u0631\u06cc \u0631\u06c1\u062a\u0627 \u06c1\u06d2 \u0627\u0648\u0631 \u0648\u0633\u0627\u0626\u0644 \u06a9\u06cc \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u060c \u0622\u0679\u0648 \u0627\u0633\u06a9\u06cc\u0644\u0631 \u0646\u0626\u06d2 \u0646\u0648\u0688\u0633 \u06a9\u06cc \u0641\u0631\u0627\u06c1\u0645\u06cc \u062c\u0627\u0631\u06cc \u0631\u06a9\u06be\u062a\u0627 \u06c1\u06d2\u06d4 \u0645\u06cc\u0631\u06d2 \u067e\u0627\u0633 \u0646\u0648\u0688\u0633 \u06a9\u0627 \u0627\u06cc\u06a9 \u06af\u0631\u0648\u067e \u062a\u06be\u0627 \u062c\u0648 \u067e\u06cc\u0631 \u06a9\u06cc \u0635\u0628\u062d \u062a\u06a9 2 1\/2 \u062f\u0646\u0648\u06ba \u0633\u06d2 \u062e\u0627\u0645\u0648\u0634\u06cc \u0633\u06d2 \u0628\u0691\u06be \u0631\u06c1\u0627 \u062a\u06be\u0627 \u0627\u0648\u0631 3 \u06c1\u0641\u062a\u0648\u06ba \u06a9\u06d2 \u0628\u0639\u062f \u0628\u0644 \u0622\u0646\u06d2 \u062a\u06a9 \u06a9\u0633\u06cc \u0646\u06d2 \u0646\u0648\u0679\u0633 \u0646\u06c1\u06cc\u06ba \u0644\u06cc\u0627\u06d4<\/p>\n<p>\u0627\u0633 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06d2 \u06a9\u06cc\u0633 \u06a9\u0627 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0645\u0648\u062c\u0648\u062f \u06c1\u06d2 \u06a9\u06cc\u0648\u0646\u06a9\u06c1 AWS \u0628\u0644 \u0635\u0631\u0641 \u0645\u0627\u06c1\u0627\u0646\u06c1 \u0646\u0645\u0628\u0631 \u0646\u06c1\u06cc\u06ba \u06c1\u06cc\u06ba\u06d4 \u06cc\u06c1 \u0627\u06cc\u06a9 \u0679\u0627\u0626\u0645 \u0633\u06cc\u0631\u06cc\u0632 \u06c1\u06d2 \u0627\u0648\u0631 \u0627\u0633 \u06a9\u06cc \u0646\u06af\u0631\u0627\u0646\u06cc \u0627\u0633\u06cc \u0637\u0631\u062d \u06a9\u06cc \u062c\u0627 \u0633\u06a9\u062a\u06cc \u06c1\u06d2 \u062c\u0633 \u0637\u0631\u062d \u0622\u067e \u0627\u06cc\u067e\u0644\u06cc\u06a9\u06cc\u0634\u0646 \u0645\u06cc\u0679\u0631\u06a9\u0633 \u06a9\u06cc \u0646\u06af\u0631\u0627\u0646\u06cc \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 \u0631\u0648\u0632\u0627\u0646\u06c1 \u0686\u06cc\u06a9 \u0627\u0646 \u06a9\u0631\u06a9\u06d2 \u0627\u0648\u0631 \u0627\u067e\u0646\u06cc \u0628\u0646\u06cc\u0627\u062f\u06cc \u0644\u0627\u0626\u0646 \u06a9\u0648 \u062c\u0627\u0646 \u06a9\u0631\u060c \u0622\u067e \u0627\u0633 \u0642\u0633\u0645 \u06a9\u06d2 \u0648\u0627\u0642\u0639\u0627\u062a \u06a9\u0648 \u06c1\u0641\u062a\u0648\u06ba \u06a9\u06d2 \u0628\u062c\u0627\u0626\u06d2 \u06af\u06be\u0646\u0679\u0648\u06ba \u0645\u06cc\u06ba \u067e\u06a9\u0691 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<h3 id=\"heading-whats-actually-happening-at-the-system-level\">\u0646\u0638\u0627\u0645 \u06a9\u06cc \u0633\u0637\u062d \u067e\u0631 \u0627\u0635\u0644 \u0645\u06cc\u06ba \u06a9\u06cc\u0627 \u06c1\u0648 \u0631\u06c1\u0627 \u06c1\u06d2\u061f<\/h3>\n<p><strong>\u06cc\u06c1 \u06a9\u06cc\u0627 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2:<\/strong> \u06cc\u06c1 \u0645\u0627\u0644\u06cc\u0627\u062a\u06cc \u0688\u06cc\u0634 \u0628\u0648\u0631\u0688 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4 \u06cc\u06c1 \u0631\u0648\u06cc\u06d2 \u0633\u06d2 \u0645\u062a\u0639\u0644\u0642 \u0628\u06d2 \u0636\u0627\u0628\u0637\u06af\u06cc \u06a9\u0627 \u067e\u062a\u06c1 \u0644\u06af\u0627\u0646\u06d2 \u0648\u0627\u0644\u0627 \u06c1\u06d2 \u0627\u0648\u0631 \u062c\u0633 \u0633\u06af\u0646\u0644 \u067e\u0631 \u0646\u0638\u0631 \u0631\u06a9\u06be\u062a\u0627 \u06c1\u06d2 \u0648\u06c1 \u0642\u06cc\u0645\u062a \u06c1\u06d2\u06d4 \u0644\u06cc\u06a9\u0646 \u062c\u0648 \u062d\u0642\u06cc\u0642\u062a \u0645\u06cc\u06ba \u0627\u0633 \u06a9\u0627 \u067e\u062a\u06c1 \u0686\u0644\u062a\u0627 \u06c1\u06d2 \u0648\u06c1 \u063a\u06cc\u0631 \u0645\u062a\u0648\u0642\u0639 \u0628\u0646\u06cc\u0627\u062f\u06cc \u0688\u06be\u0627\u0646\u0686\u06d2 \u06a9\u0627 \u0631\u0648\u06cc\u06c1 \u06c1\u06d2\u060c \u062c\u06cc\u0633\u06d2 \u0686\u0644\u0627\u0646\u06d2 \u0648\u0627\u0644\u06d2 \u0648\u0633\u0627\u0626\u0644\u060c \u0622\u0679\u0648 \u0627\u0633\u06a9\u06cc\u0644\u0631 \u0627\u06cc\u0648\u0646\u0679\u0633\u060c \u0627\u0648\u0631 \u0628\u06be\u0648\u0644\u06d2 \u06c1\u0648\u0626\u06d2 \u0645\u0627\u062d\u0648\u0644\u06d4<\/p>\n<p>AWS Cost Explorer \u0627\u06cc\u06a9 \u0627\u06cc\u0633\u06cc \u062e\u062f\u0645\u062a \u06c1\u06d2 \u062c\u0648 \u0627\u062f\u0627\u0626\u06cc\u06af\u06cc \u06a9\u06d2 \u0688\u06cc\u0679\u0627 \u06a9\u0648 \u0630\u062e\u06cc\u0631\u06c1 \u06a9\u0631\u062a\u06cc \u06c1\u06d2 \u0627\u0648\u0631 \u0627\u0633\u06d2 API \u06a9\u06d2 \u0630\u0631\u06cc\u0639\u06d2 \u0638\u0627\u06c1\u0631 \u06a9\u0631\u062a\u06cc \u06c1\u06d2\u06d4 \u0627\u0633\u06d2 \u06a9\u0627\u0644 \u06a9\u0631\u0646\u06d2 \u0633\u06d2 \u0622\u067e \u06a9\u06d2 \u0627\u06a9\u0627\u0624\u0646\u0679 \u06a9\u06cc \u0627\u062f\u0627\u0626\u06cc\u06af\u06cc \u06a9\u06cc \u0633\u0631\u06af\u0632\u0634\u062a \u06a9\u06d2 \u062e\u0644\u0627\u0641 \u0627\u06cc\u06a9 \u0627\u0633\u062a\u0641\u0633\u0627\u0631 \u0686\u0644\u06d2 \u06af\u0627\u060c \u062c\u0633 \u0645\u06cc\u06ba \u0648\u0642\u062a \u06a9\u06cc \u062d\u062f\u060c \u06af\u0631\u06cc\u0646\u0648\u0644\u0631\u06cc\u0679\u06cc\u060c \u0627\u0648\u0631 \u0622\u067e \u0646\u062a\u0627\u0626\u062c \u06a9\u0648 \u06a9\u0633 \u0637\u0631\u062d \u06af\u0631\u0648\u067e \u06a9\u0631\u0646\u0627 \u0686\u0627\u06c1\u062a\u06d2 \u06c1\u06cc\u06ba \u06a9\u06cc \u0648\u0636\u0627\u062d\u062a \u06a9\u0631\u06d2 \u06af\u0627\u06d4<\/p>\n<p>\u062f\u06a9\u06be\u0627\u0626\u06d2 \u06af\u0626\u06d2 \u0627\u062e\u0631\u0627\u062c\u0627\u062a \u06a9\u06cc \u062a\u062d\u0642\u06cc\u0642 \u0634\u0631\u0648\u0639 \u06a9\u0631\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u0627\u06cc\u06a9 \u0686\u06cc\u0632 \u062c\u0648 \u0622\u067e \u06a9\u0648 \u0645\u0639\u0644\u0648\u0645 \u06c1\u0648\u0646\u06cc \u0686\u0627\u06c1\u06cc\u06d2 \u0648\u06c1 \u06cc\u06c1 \u06c1\u06d2 \u06a9\u06c1 AWS \u06cc\u06c1 \u0641\u06cc\u0635\u0644\u06c1 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u06a9\u06c1 \u0622\u067e \u0633\u06d2 \u0646\u06c1\u06cc\u06ba \u0628\u0644\u06a9\u06c1 \u06a9\u0646 \u0633\u0631\u0648\u0633 \u06a9\u06cc\u0679\u06cc\u06af\u0631\u06cc\u0632 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0622\u067e \u06a9\u0648 \u0686\u0627\u0631\u062c \u06a9\u06cc\u0627 \u062c\u0627\u0626\u06d2 \u06af\u0627\u06d4 \u0645\u062a\u0639\u062f\u062f \u062e\u0637\u0648\u06ba \u0645\u06cc\u06ba \u0686\u0644\u0646\u06d2 \u0648\u0627\u0644\u06cc EBS \u0633\u0646\u06cc\u067e \u0634\u0627\u0679 \u06a9\u0627\u067e\u06cc\u0627\u06ba \u0688\u06cc\u0679\u0627 \u0679\u0631\u0627\u0646\u0633\u0641\u0631 \u06a9\u06d2 \u0628\u062c\u0627\u0626\u06d2 EC2 \u06a9\u06d2 \u062a\u062d\u062a \u0638\u0627\u06c1\u0631 \u06c1\u0648 \u0633\u06a9\u062a\u06cc \u06c1\u06cc\u06ba\u06d4 \u062f\u0648\u0633\u0631\u06d2 \u0644\u0641\u0638\u0648\u06ba \u0645\u06cc\u06ba\u060c EC2 \u06a9\u06d2 \u0627\u062e\u0631\u0627\u062c\u0627\u062a \u0645\u06cc\u06ba \u0627\u0636\u0627\u0641\u06d2 \u06a9\u0627 \u0645\u0637\u0644\u0628 \u06cc\u06c1 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2 \u06a9\u06c1 \u0622\u067e \u06a9\u06d2 EC2 \u0645\u062b\u0627\u0644\u0648\u06ba \u0645\u06cc\u06ba \u06a9\u0648\u0626\u06cc \u0645\u0633\u0626\u0644\u06c1 \u06c1\u06d2\u06d4 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0627\u0633\u067e\u0627\u0626\u06a9\u0633 \u06a9\u0648 \u0635\u062d\u06cc\u062d \u0637\u0631\u06cc\u0642\u06d2 \u0633\u06d2 \u062c\u06be\u0646\u0688\u0627 \u062f\u06cc\u062a\u0627 \u06c1\u06d2\u060c \u0644\u06cc\u06a9\u0646 \u0627\u0646 \u06a9\u06cc \u0686\u06be\u0627\u0646 \u0628\u06cc\u0646 \u06a9\u0631\u0646\u06d2 \u06a9\u0627 \u0645\u0637\u0644\u0628 \u06c1\u06d2 \u0633\u0648\u0627\u0644\u0627\u062a \u067e\u0648\u0686\u06be\u0646\u0627 \u062c\u06cc\u0633\u06d2: <em>&quot;\u0627\u0633 \u062a\u0627\u0631\u06cc\u062e \u06a9\u0648 \u0645\u06cc\u0631\u06d2 \u0628\u0646\u06cc\u0627\u062f\u06cc \u0688\u06be\u0627\u0646\u0686\u06d2 \u0645\u06cc\u06ba \u06a9\u06cc\u0627 \u062a\u0628\u062f\u06cc\u0644\u06cc \u0622\u0626\u06cc&#8221;<\/em> \u0628\u0644\u06a9\u06c1 <em>&quot;\u0627\u0628\u06be\u06cc EC2 \u067e\u0631 \u06a9\u06cc\u0627 \u0686\u0644 \u0631\u06c1\u0627 \u06c1\u06d2\u061f&#8221;<\/em><\/p>\n<p>\u0628\u0644 \u06a9\u0627 \u0644\u06cc\u0628\u0644 \u0627\u06cc\u06a9 \u0646\u0642\u0637\u06c1 \u0622\u063a\u0627\u0632 \u06c1\u06d2\u060c \u062a\u0634\u062e\u06cc\u0635 \u0646\u06c1\u06cc\u06ba\u06d4<\/p>\n<h3 id=\"heading-set-up-the-demo-environment\">\u0688\u06cc\u0645\u0648 \u06a9\u06cc \u062a\u0631\u062a\u06cc\u0628\u0627\u062a<\/h3>\n<p>\u0627\u06af\u0644\u06d2 \u067e\u0631 \u062c\u0627\u0626\u06cc\u06ba\u06d4 <code>01-cost-anomaly\/<\/code> \u06cc\u06c1 \u0633\u0627\u062a\u06be\u06cc \u0630\u062e\u06cc\u0631\u06c1 \u0645\u06cc\u06ba \u06c1\u06d2\u06d4 \u0627\u0633 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06d2 \u0645\u0639\u0627\u0645\u0644\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u06a9\u0633\u06cc \u06a9\u0644\u0633\u0679\u0631 \u0633\u06cc\u0679 \u0627\u067e \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u0646\u06c1\u06cc\u06ba \u06c1\u06d2 \u06a9\u06cc\u0648\u0646\u06a9\u06c1 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0628\u0631\u0627\u06c1 \u0631\u0627\u0633\u062a \u0622\u067e \u06a9\u06d2 AWS \u0627\u06a9\u0627\u0624\u0646\u0679 \u06a9\u06d2 \u062e\u0644\u0627\u0641 \u0686\u0644\u062a\u0627 \u06c1\u06d2 \u0627\u0648\u0631 \u0627\u0633 \u06a9\u0627 \u0648\u0627\u062d\u062f \u0627\u0646\u062d\u0635\u0627\u0631 boto3 \u06c1\u06d2\u06d4<\/p>\n<pre><code class=\"language-plaintext\">cd 01-cost-anomaly\npip install boto3\n<\/code><\/pre>\n<p>\u06cc\u0642\u06cc\u0646\u06cc \u0628\u0646\u0627\u0626\u06cc\u06ba \u06a9\u06c1 \u0622\u067e \u06a9\u06d2 \u062d\u0642\u06cc\u0642\u06cc \u0627\u06a9\u0627\u0624\u0646\u0679 \u06a9\u06d2 \u062e\u0644\u0627\u0641 \u0686\u0644\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u0622\u067e \u06a9\u06d2 AWS \u0627\u0633\u0646\u0627\u062f \u06a9\u0648 \u062a\u0631\u062a\u06cc\u0628 \u062f\u06cc\u0627 \u06af\u06cc\u0627 \u06c1\u06d2\u06d4 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0627\u0646 \u062a\u0645\u0627\u0645 \u0627\u0633\u0646\u0627\u062f \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u06cc \u06c1\u06d2 \u062c\u0648 AWS CLI \u0646\u06d2 \u062a\u0631\u062a\u06cc\u0628 \u062f\u06cc \u06c1\u06cc\u06ba\u06d4 \u0627\u06af\u0631 \u0622\u067e \u0646\u06d2 \u0627\u0628\u06be\u06cc \u062a\u06a9 \u06cc\u06c1 \u0646\u06c1\u06cc\u06ba \u06a9\u06cc\u0627 \u06c1\u06d2:<\/p>\n<pre><code class=\"language-plaintext\">aws configure\n<\/code><\/pre>\n<p>\u0627\u0633 \u06a9\u06d2 \u0628\u0639\u062f \u0622\u067e \u0627\u067e\u0646\u06cc AWS \u0631\u0633\u0627\u0626\u06cc \u06a9\u0644\u06cc\u062f ID\u060c \u062e\u0641\u06cc\u06c1 \u0631\u0633\u0627\u0626\u06cc \u06a9\u0644\u06cc\u062f\u060c \u0627\u0648\u0631 \u067e\u06c1\u0644\u06d2 \u0633\u06d2 \u0637\u06d2 \u0634\u062f\u06c1 \u0639\u0644\u0627\u0642\u06c1 (\u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u06d2 \u06c1\u0648\u0626\u06d2 <code>us-east-1<\/code> \u0627\u06af\u0631 \u0622\u067e \u06a9\u0648 \u06cc\u0642\u06cc\u0646 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2) \u0627\u0648\u0631 \u0622\u0624\u0679 \u067e\u0679 \u0641\u0627\u0631\u0645\u06cc\u0679 (type <code>json<\/code>)\u06d4 \u0622\u067e \u0627\u067e\u0646\u06cc \u0631\u0633\u0627\u0626\u06cc \u06a9\u06cc\u0632 \u06a9\u0648 AWS \u06a9\u0646\u0633\u0648\u0644 \u0645\u06cc\u06ba IAM \u2192 \u0635\u0627\u0631\u0641\u06cc\u0646 \u2192 \u0635\u0627\u0631\u0641 \u0646\u0627\u0645 \u2192 \u0633\u06cc\u06a9\u06cc\u0648\u0631\u0679\u06cc \u0627\u0633\u0646\u0627\u062f \u2192 \u0631\u0633\u0627\u0626\u06cc \u06a9\u06cc\u0632 \u0628\u0646\u0627\u0626\u06cc\u06ba \u06a9\u06d2 \u062a\u062d\u062a \u062a\u0644\u0627\u0634 \u06a9\u0631 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u0622\u067e \u06a9\u06d2 \u0627\u06a9\u0627\u0624\u0646\u0679 \u0645\u06cc\u06ba <code>ce:GetCostAndUsage<\/code> \u0627\u06af\u0631 \u0622\u067e \u0627\u06cc\u06a9 \u0646\u06cc\u0627 \u0627\u06a9\u0627\u0624\u0646\u0679 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba \u062c\u0633 \u0645\u06cc\u06ba \u067e\u06c1\u0644\u06d2 \u0633\u06d2 \u0627\u06cc\u0688\u0645\u0646\u0633\u0679\u0631\u06cc\u0679\u0631 \u0631\u0633\u0627\u0626\u06cc \u0634\u0627\u0645\u0644 \u06c1\u06d2 \u062a\u0648 \u0622\u067e \u06a9\u0648 \u0628\u06be\u06cc \u0627\u062c\u0627\u0632\u062a \u06c1\u0648\u06af\u06cc\u06d4<\/p>\n<p>\u0627\u06af\u0631 \u0622\u067e \u06a9\u06d2 \u067e\u0627\u0633 AWS \u0627\u06a9\u0627\u0624\u0646\u0679 \u06c1\u06d2 \u062c\u0633 \u0645\u06cc\u06ba \u06a9\u0626\u06cc \u06c1\u0641\u062a\u0648\u06ba \u06a9\u06cc \u0628\u0644\u0646\u06af \u06a9\u06cc \u062a\u0627\u0631\u06cc\u062e \u06c1\u06d2\u060c \u062a\u0648 \u0622\u067e \u0627\u0633\u06a9\u0631\u067e\u0679 \u06a9\u0648 \u0628\u0631\u0627\u06c1 \u0631\u0627\u0633\u062a \u062d\u0642\u06cc\u0642\u06cc \u0688\u06cc\u0679\u0627 \u067e\u0631 \u0686\u0644\u0627 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<pre><code class=\"language-plaintext\">python detect_cost_anomaly.py\n<\/code><\/pre>\n<p>\u062d\u0642\u06cc\u0642\u06cc \u0627\u06a9\u0627\u0624\u0646\u0679 \u06a9\u06d2 \u062e\u0644\u0627\u0641 \u0686\u0644\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u0622\u067e \u06a9\u0648 \u062f\u0648 \u0686\u06cc\u0632\u06cc\u06ba \u062c\u0627\u0646\u0646\u06d2 \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u06c1\u06d2\u06d4 \u0633\u0628 \u0633\u06d2 \u067e\u06c1\u0644\u06d2\u060c Cost Explorer \u0688\u06cc\u0679\u0627 \u0645\u06cc\u06ba 24 \u06af\u06be\u0646\u0679\u06d2 \u06a9\u06cc \u062a\u0627\u062e\u06cc\u0631 \u06c1\u0648\u062a\u06cc \u06c1\u06d2\u06d4 \u0627\u0633 \u06a9\u0627 \u0645\u0637\u0644\u0628 \u06cc\u06c1 \u06c1\u06d2 \u06a9\u06c1 \u0622\u062c \u06a9\u06d2 \u0627\u062e\u0631\u0627\u062c\u0627\u062a \u06a9\u0644 \u062a\u06a9 \u0638\u0627\u06c1\u0631 \u0646\u06c1\u06cc\u06ba \u06c1\u0648\u06ba \u06af\u06d2\u060c \u0627\u0633 \u0644\u06cc\u06d2 \u0646\u0627\u0645\u06a9\u0645\u0644 \u0646\u062a\u0627\u0626\u062c \u0633\u06d2 \u0628\u0686\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u0633\u06a9\u0631\u067e\u0679 \u062e\u0648\u062f \u0628\u062e\u0648\u062f \u062d\u0627\u0644\u06cc\u06c1 \u062a\u0627\u0631\u06cc\u062e \u06a9\u0648 \u062e\u0627\u0631\u062c \u06a9\u0631 \u062f\u06cc\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u062f\u0648\u0633\u0631\u0627\u060c \u0627\u0633\u06a9\u0631\u067e\u0679 \u0645\u0644\u0627\u0648\u0679 \u0634\u062f\u06c1 \u0627\u062e\u0631\u0627\u062c\u0627\u062a \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u060c \u062c\u0648 \u06a9\u06c1 \u0648\u06c1 \u0642\u06cc\u0645\u062a\u06cc\u06ba \u06c1\u06cc\u06ba \u062c\u0648 \u0622\u067e \u0627\u0635\u0644 \u0645\u06cc\u06ba \u0627\u06cc\u06a9 \u0627\u06a9\u0627\u0624\u0646\u0679 \u0633\u06cc\u0679 \u0627\u067e \u0645\u06cc\u06ba \u0627\u062f\u0627 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 \u0645\u0644\u0627\u0648\u0679 \u0634\u062f\u06c1 \u0642\u06cc\u0645\u062a\u06cc\u06ba \u0648\u0632\u0646\u06cc \u0627\u0648\u0633\u0637 \u06c1\u06cc\u06ba \u062c\u0648 \u06a9\u062b\u06cc\u0631 \u0627\u06a9\u0627\u0624\u0646\u0679\u06cc \u062a\u0646\u0638\u06cc\u0645\u0648\u06ba \u0645\u06cc\u06ba \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06c1\u0648\u062a\u06cc \u06c1\u06cc\u06ba \u062c\u0648 \u0645\u062d\u0641\u0648\u0638 \u0635\u0644\u0627\u062d\u06cc\u062a \u06a9\u0627 \u0627\u0634\u062a\u0631\u0627\u06a9 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba \u0627\u0648\u0631 \u0645\u062e\u062a\u0644\u0641 \u0646\u0645\u0628\u0631 \u0641\u0631\u0627\u06c1\u0645 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u0627\u06af\u0631 \u0622\u067e \u06a9\u06d2 \u067e\u0627\u0633 \u0646\u06cc\u0627 \u0627\u06a9\u0627\u0624\u0646\u0679 \u06c1\u06d2 \u06cc\u0627 \u0622\u067e \u0627\u0635\u0644 \u0628\u0644\u0646\u06af \u0688\u06cc\u0679\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u0646\u06c1\u06cc\u06ba \u06a9\u0631\u0646\u0627 \u0686\u0627\u06c1\u062a\u06d2 \u062a\u0648 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0645\u06cc\u06ba \u0634\u0627\u0645\u0644 \u06c1\u06cc\u06ba: <code>--sample<\/code> \u0627\u06cc\u0645\u0628\u06cc\u0688\u0688 \u0688\u06cc\u0679\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u0646\u06d2 \u0627\u0648\u0631 AWS APIs \u06a9\u0648 \u06a9\u0627\u0644 \u0646\u06c1 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u06cc\u06a9 \u062c\u06be\u0646\u0688\u0627\u06d4<br \/>\u06a9\u0648\u0688 \u06a9\u0648 \u067e\u0691\u06be\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2\u060c \u06cc\u06c1 \u062f\u06cc\u06a9\u06be\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u067e\u06c1\u0644\u06d2 \u0686\u0644\u0627\u0626\u06cc\u06ba \u06a9\u06c1 \u0622\u0624\u0679 \u067e\u0679 \u06a9\u06cc\u0633\u0627 \u0644\u06af\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<pre><code class=\"language-plaintext\">python detect_cost_anomaly.py --sample\n<\/code><\/pre>\n<h3 id=\"heading-the-script\">\u0633\u06a9\u0631\u067e\u0679<\/h3>\n<pre><code class=\"language-python\">#!\/usr\/bin\/env python3\n# detect_cost_anomaly.py \u2014 Use Case 1: Cost Anomaly Detection\n# Full explanation of every function is in the article.\n\nimport statistics\nimport sys\nfrom datetime import datetime, timedelta\n\nimport boto3\n\ndef build_sample_data(days=30):\n    \"\"\"Synthetic Cost Explorer rows for the last `days` (ending yesterday).\n\n    The EC2 spike is placed on yesterday (device local date) so sample output\n    always matches the same window as live Cost Explorer mode.\n    \"\"\"\n    last_day = datetime.today().date() - timedelta(days=1)\n    first_day = last_day - timedelta(days=days - 1)\n    anomaly_day_index = days - 1\n    results = []\n    for i in range(days):\n        day = first_day + timedelta(days=i)\n        d = i + 1\n        results.append(\n            {\n                \"TimePeriod\": {\n                    \"Start\": str(day),\n                    \"End\": str(day + timedelta(days=1)),\n                },\n                \"Groups\": [\n                    {\n                        \"Keys\": [\"Amazon EC2\"],\n                        \"Metrics\": {\n                            \"UnblendedCost\": {\n                                \"Amount\": str(\n                                    round(\n                                        18.50\n                                        if i == anomaly_day_index\n                                        else 1.10 + (d % 3) * 0.10,\n                                        2,\n                                    )\n                                )\n                            }\n                        },\n                    },\n                    {\n                        \"Keys\": [\"Amazon S3\"],\n                        \"Metrics\": {\n                            \"UnblendedCost\": {\n                                \"Amount\": str(round(0.04 + (d % 5) * 0.01, 2))\n                            }\n                        },\n                    },\n                    {\n                        \"Keys\": [\"Amazon RDS\"],\n                        \"Metrics\": {\n                            \"UnblendedCost\": {\n                                \"Amount\": str(round(0.85 + (d % 4) * 0.05, 2))\n                            }\n                        },\n                    },\n                ],\n            }\n        )\n    return results, str(last_day)\n\n\ndef get_daily_costs(days=30):\n    ce = boto3.client(\"ce\", region_name=\"us-east-1\")\n    end = datetime.today().date() - timedelta(days=1)\n    start = end - timedelta(days=days)\n    response = ce.get_cost_and_usage(\n        TimePeriod={\"Start\": str(start), \"End\": str(end)},\n        Granularity=\"DAILY\",\n        Metrics=[\"UnblendedCost\"],\n        GroupBy=[{\"Type\": \"DIMENSION\", \"Key\": \"SERVICE\"}],\n    )\n    return response[\"ResultsByTime\"]\n\n\ndef build_service_timeseries(results):\n    services = {}\n    for day in results:\n        date_str = day[\"TimePeriod\"][\"Start\"]\n        for group in day[\"Groups\"]:\n            service = group[\"Keys\"][0]\n            cost = float(group[\"Metrics\"][\"UnblendedCost\"][\"Amount\"])\n            if service not in services:\n                services[service] = []\n            services[service].append({\"date\": date_str, \"cost\": cost})\n    return services\n\n\ndef detect_anomalies(services, baseline_days=7, multiplier=2.0, recent_days=None):\n    \"\"\"Flag days where cost exceeds prior `baseline_days` average + 2\u03c3.\n\n    Uses a rolling baseline (each day vs the previous week). If `recent_days`\n    is set, only returns anomalies on or after today - recent_days.\n    \"\"\"\n    cutoff = None\n    if recent_days is not None:\n        cutoff = datetime.today().date() - timedelta(days=recent_days)\n\n    anomalies = []\n    for service, daily in services.items():\n        if len(daily) < baseline_days + 1:\n            continue\n        for i in range(baseline_days, len(daily)):\n            day = daily[i]\n            day_date = datetime.strptime(day[\"date\"], \"%Y-%m-%d\").date()\n            if cutoff is not None and day_date < cutoff:\n                continue\n            baseline_costs = [d[\"cost\"] for d in daily[i - baseline_days : i]]\n            avg = statistics.mean(baseline_costs)\n            if avg < 0.01:\n                continue\n            try:\n                std = statistics.stdev(baseline_costs)\n            except statistics.StatisticsError:\n                continue\n            threshold = avg + (multiplier * std)\n            if day[\"cost\"] > threshold:\n                anomalies.append(\n                    {\n                        \"service\": service,\n                        \"date\": day[\"date\"],\n                        \"actual\": round(day[\"cost\"], 4),\n                        \"baseline_avg\": round(avg, 4),\n                        \"threshold\": round(threshold, 4),\n                        \"pct_above\": round(((day[\"cost\"] - avg) \/ avg) * 100, 1),\n                    }\n                )\n    return sorted(anomalies, key=lambda x: x[\"date\"])\n\n\ndef parse_args(argv):\n    use_sample = \"--sample\" in argv\n    recent_days = None\n    for arg in argv[1:]:\n        if arg.startswith(\"--recent-days=\"):\n            recent_days = int(arg.split(\"=\", 1)[1])\n    return use_sample, recent_days\n\n\ndef run(use_sample=False, recent_days=None):\n    if use_sample:\n        results, anomaly_date = build_sample_data()\n        print(\"Running against sample data (--sample mode).\")\n        print(\n            f\"This data represents 30 days of billing ending yesterday, \"\n            f\"with a realistic EC2 anomaly on {anomaly_date}.n\"\n        )\n    else:\n        print(\"Fetching 30 days of daily AWS costs by service...\")\n        print(\"Note: today is excluded \u2014 Cost Explorer has a 24-hour billing lag.n\")\n        results = get_daily_costs(days=30)\n\n    if recent_days is not None:\n        since = datetime.today().date() - timedelta(days=recent_days)\n        print(\n            f\"Checking for spikes in the last {recent_days} days only \"\n            f\"(on or after {since}), each vs its prior 7-day average.n\"\n        )\n\n    services = build_service_timeseries(results)\n    anomalies = detect_anomalies(services, recent_days=recent_days)\n\n    if not anomalies:\n        print(\"No anomalies detected.\")\n        print(\"nNote: this script flags statistical outliers against your own baseline.\")\n        print(\"A consistently elevated spend level will not trigger \u2014 only sudden increases.\")\n        return\n\n    print(f\"{'=' * 60}\")\n    print(f\"ANOMALIES DETECTED: {len(anomalies)}\")\n    print(f\"{'=' * 60}n\")\n\n    for a in anomalies:\n        print(f\"Service:      {a['service']}\")\n        print(f\"Date:         {a['date']}\")\n        print(f\"Actual cost:  ${a['actual']}\")\n        print(f\"Baseline avg: ${a['baseline_avg']} (prior 7-day average)\")\n        print(f\"Threshold:    ${a['threshold']}\")\n        print(f\"Overage:      {a['pct_above']}% above baseline\")\n        print()\n\n    print(\"=\" * 60)\n    print(\"A note on AWS cost attribution:\")\n    print(\"The service label in Cost Explorer is assigned by AWS, not by the resource\")\n    print(\"that caused the cost. An EC2 spike may be caused by EBS snapshot copies,\")\n    print(\"cross-region data transfer, or autoscaling events that AWS categorizes under\")\n    print(\"EC2 in billing \u2014 not a running EC2 instance you can find in the console.\")\n    print()\n    print(\"Before investigating the flagged service directly, ask:\")\n    print(\"What changed in my infrastructure on or before the flagged date?\")\n    print(\"Work backward from the operational change, not forward from the billing label.\")\n\n\nif __name__ == \"__main__\":\n    use_sample, recent_days = parse_args(sys.argv)\n    run(use_sample=use_sample, recent_days=recent_days)\n<\/code><\/pre>\n<h3 id=\"heading-how-the-script-works\">\u0627\u0633\u06a9\u0631\u067e\u0679 \u06a9\u06cc\u0633\u06d2 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/h3>\n<p><code>get_daily_costs<\/code>    \u06af\u0632\u0634\u062a\u06c1 30 \u062f\u0646\u0648\u06ba \u06a9\u0627 AWS \u0628\u0644\u0646\u06af \u0688\u06cc\u0679\u0627 \u062d\u0627\u0635\u0644 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<p><code>build_service_timeseries<\/code>    AWS \u0633\u06d2 \u062e\u0627\u0645 \u0688\u06cc\u0679\u0627 \u0644\u06cc\u06ba \u0627\u0648\u0631 \u0627\u0633\u06d2 \u062f\u0648\u0628\u0627\u0631\u06c1 \u062a\u0631\u062a\u06cc\u0628 \u062f\u06cc\u06ba\u06d4 AWS \u0688\u06cc\u0679\u0627 \u06a9\u0648 \u067e\u06c1\u0644\u06d2 \u062a\u0627\u0631\u06cc\u062e \u06a9\u06d2 \u0644\u062d\u0627\u0638 \u0633\u06d2 \u0627\u0648\u0631 \u067e\u06be\u0631 \u0633\u0631\u0648\u0633 \u06a9\u06d2 \u0644\u062d\u0627\u0638 \u0633\u06d2 \u06af\u0631\u0648\u067e \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u06cc\u06c1 \u062e\u0635\u0648\u0635\u06cc\u062a \u0627\u0633 \u06a9\u0627 \u0631\u062e \u0645\u0648\u0691 \u062f\u06cc\u062a\u06cc \u06c1\u06d2 \u0627\u0648\u0631 \u06c1\u0631 \u0633\u0631\u0648\u0633 \u06a9\u0648 \u0631\u0648\u0632\u0627\u0646\u06c1 \u06a9\u06d2 \u0627\u062e\u0631\u0627\u062c\u0627\u062a \u06a9\u06cc \u0627\u067e\u0646\u06cc \u0641\u06c1\u0631\u0633\u062a \u0631\u06a9\u06be\u0646\u06d2 \u06a9\u06cc \u0627\u062c\u0627\u0632\u062a \u062f\u06cc\u062a\u06cc \u06c1\u06d2 \u062c\u0648 \u0627\u0633\u06d2 \u067e\u062a\u06c1 \u0644\u06af\u0627\u0646\u06d2 \u06a9\u06d2 \u0645\u0631\u062d\u0644\u06d2 \u06a9\u06d2 \u062f\u0648\u0631\u0627\u0646 \u0686\u0644\u0646\u0627 \u0686\u0627\u06c1\u06cc\u06d2\u06d4<\/p>\n<p><code>detect_anomalies<\/code>    \u06cc\u06c1 \u0648\u06c1 \u062c\u06af\u06c1 \u06c1\u06d2 \u062c\u06c1\u0627\u06ba \u062d\u0642\u06cc\u0642\u06cc \u062a\u0635\u062f\u06cc\u0642 \u06c1\u0648\u062a\u06cc \u06c1\u06d2\u06d4 \u06c1\u0631 \u0633\u0631\u0648\u0633 \u06a9\u06d2 \u0644\u06cc\u06d2\u060c \u0627\u067e\u0646\u06d2 \u06cc\u0648\u0645\u06cc\u06c1 \u0627\u062e\u0631\u0627\u062c\u0627\u062a \u06a9\u0627 \u067e\u0686\u06be\u0644\u06d2 \u0633\u0627\u062a \u062f\u0646\u0648\u06ba \u0633\u06d2 \u0645\u0648\u0627\u0632\u0646\u06c1 \u06a9\u0631\u06cc\u06ba\u06d4 \u0627\u06af\u0631 \u06a9\u0644 \u06a9\u06d2 \u0627\u062e\u0631\u0627\u062c\u0627\u062a \u067e\u0686\u06be\u0644\u06d2 \u06c1\u0641\u062a\u06d2 \u06a9\u06d2 \u0645\u0642\u0627\u0628\u0644\u06d2 \u0645\u06cc\u06ba \u0646\u0645\u0627\u06cc\u0627\u06ba \u0637\u0648\u0631 \u067e\u0631 \u0632\u06cc\u0627\u062f\u06c1 \u06c1\u06cc\u06ba\u060c \u062a\u0648 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0627\u0633 \u06a9\u0648 \u062c\u06be\u0646\u0688\u0627 \u062f\u06cc\u062a\u0627 \u06c1\u06d2\u06d4 \u0628\u0633\u06d4<\/p>\n<p><code>--recent-days=7<\/code>    \u0637\u0631\u06cc\u0642\u06c1 <em>&quot;\u0628\u0631\u0627\u06c1 \u06a9\u0631\u0645 \u0635\u0631\u0641 \u067e\u0686\u06be\u0644\u06d2 7 \u062f\u0646\u0648\u06ba \u06a9\u06cc \u0628\u06d2 \u0636\u0627\u0628\u0637\u06af\u06cc\u0627\u06ba \u062f\u06a9\u06be\u0627\u0626\u06cc\u06ba\u06d4&#8221;<\/em> \u0686\u0648\u0646\u06a9\u06c1 \u06c1\u0645\u06cc\u06ba \u0645\u0648\u0627\u0632\u0646\u06c1 \u06a9\u0627 \u062d\u0633\u0627\u0628 \u0644\u06af\u0627\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u0633 \u062a\u0627\u0631\u06cc\u062e \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u06c1\u06d2\u060c \u0627\u0633 \u0644\u06cc\u06d2 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0627\u0628 \u0628\u06be\u06cc 30 \u062f\u0646 \u06a9\u06d2 \u0688\u06cc\u0679\u0627 \u0645\u06cc\u06ba \u06a9\u06be\u06cc\u0646\u0686\u062a\u0627 \u06c1\u06d2\u060c \u0644\u06cc\u06a9\u0646 \u0646\u062a\u0627\u0626\u062c \u06a9\u0648 \u0645\u0637\u0644\u0648\u0628\u06c1 \u0648\u0646\u0688\u0648 \u0645\u06cc\u06ba \u0641\u0644\u0679\u0631 \u06a9\u06cc\u0627 \u062c\u0627\u062a\u0627 \u06c1\u06d2\u06d4 \u067e\u06cc\u0631 \u06a9\u06cc \u0635\u0628\u062d \u0641\u0648\u0631\u06cc \u0686\u06cc\u06a9 \u0627\u067e \u06a9\u06d2 \u0644\u06cc\u06d2 \u0628\u06c1\u062a \u0627\u0686\u06be\u0627 \u06c1\u06d2\u06d4<\/p>\n<p><code>--sample<\/code>    \u06cc\u06c1 \u0622\u067e \u06a9\u06d2 AWS \u0627\u06a9\u0627\u0624\u0646\u0679 \u06a9\u0648 \u0686\u06be\u0648\u0626\u06d2 \u0628\u063a\u06cc\u0631 \u0686\u0644\u062a\u0627 \u06c1\u06d2\u06d4 \u06c1\u0645 \u06a9\u0644 \u06a9\u06cc \u062a\u0627\u0631\u06cc\u062e\u0648\u06ba \u0645\u06cc\u06ba \u0627\u0633\u067e\u0627\u0626\u06a9\u0633 \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0628\u0644\u0679 \u0627\u0646 \u062c\u0639\u0644\u06cc \u062f\u0639\u0648\u0648\u06ba \u06a9\u0627 \u0688\u06cc\u0679\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u060c \u0644\u06c1\u0630\u0627 \u067e\u062a\u06c1 \u0644\u06af\u0627\u0646\u06d2 \u06a9\u0648 \u06c1\u0645\u06cc\u0634\u06c1 \u0645\u062a\u062d\u0631\u06a9 \u06a9\u06cc\u0627 \u062c\u0627\u062a\u0627 \u06c1\u06d2\u06d4 \u0627\u0635\u0644\u06cc \u0688\u06cc\u0679\u0627 \u0633\u06d2 \u0645\u0646\u0633\u0644\u06a9 \u06c1\u0648\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u0686\u06cc\u06a9 \u06a9\u0631\u06cc\u06ba \u06a9\u06c1 \u0622\u0624\u0679 \u067e\u0679 \u06a9\u06cc\u0633\u0627 \u0644\u06af\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<h3 id=\"heading-what-the-output-looks-like\">\u0622\u0624\u0679 \u067e\u0679 \u0646\u062a\u06cc\u062c\u06c1<\/h3>\n<p>\u0686\u0644 \u0631\u06c1\u0627 \u06c1\u06d2 <code>--sample<\/code> (\u0627\u0633\u067e\u0627\u0626\u06a9 \u06a9\u06cc \u062a\u0627\u0631\u06cc\u062e\u06cc\u06ba \u06a9\u0644 \u06a9\u06cc \u0627\u0635\u0644 \u062a\u0627\u0631\u06cc\u062e \u06a9\u06d2 \u0637\u0648\u0631 \u067e\u0631 \u062f\u06a9\u06be\u0627\u0626\u06cc \u062c\u0627\u062a\u06cc \u06c1\u06cc\u06ba\u060c \u0627\u06cc\u06a9 \u0645\u0642\u0631\u0631\u06c1 \u0642\u062f\u0631 \u0646\u06c1\u06cc\u06ba\u06d4)<\/p>\n<pre><code class=\"language-plaintext\">Running against sample data (--sample mode).\n30 days of billing ending yesterday, with an EC2 spike on 2026-05-14.\n\n============================================================\nANOMALIES DETECTED: 1\n============================================================\n\nService:      Amazon EC2\nDate:         2026-05-14\nActual cost:  $18.5\nBaseline avg: $1.2143 (prior 7-day average)\nThreshold:    $1.3939\nOverage:      1423.4% above baseline\n\n============================================================\nA note on AWS cost attribution:\nThe service label in Cost Explorer is assigned by AWS, not by the resource\nthat caused the cost. An EC2 spike may be caused by EBS snapshot copies,\ncross-region data transfer, or autoscaling events that AWS categorizes under\nEC2 in billing - not a running EC2 instance you can find in the console.\n\nBefore investigating the flagged service directly, ask:\nWhat changed in my infrastructure on or before the flagged date?\nWork backward from the operational change, not forward from the billing label.\n<\/code><\/pre>\n<p>\u0646\u0645\u0648\u0646\u06d2 \u06a9\u0627 \u0688\u06cc\u0679\u0627 \u0645\u062a\u062d\u0631\u06a9 \u0637\u0648\u0631 \u067e\u0631 \u0622\u062c \u06a9\u06cc \u062a\u0627\u0631\u06cc\u062e \u062a\u06cc\u0627\u0631 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u060c \u0627\u0633 \u0644\u06cc\u06d2 \u0646\u0645\u0628\u0631 \u0627\u0648\u067e\u0631 \u0633\u06d2 \u06a9\u0686\u06be \u0645\u062e\u062a\u0644\u0641 \u06c1\u06cc\u06ba\u06d4 \u0627\u0633\u067e\u0627\u0626\u06a9\u0633 \u06c1\u0645\u06cc\u0634\u06c1 \u06a9\u0644 \u0638\u0627\u06c1\u0631 \u06c1\u0648\u062a\u06d2 \u06c1\u06cc\u06ba\u060c \u0627\u0648\u0631 \u0627\u0631\u062f \u06af\u0631\u062f \u06a9\u06d2 \u0628\u06cc\u0633 \u0644\u0627\u0626\u0646 \u0646\u0645\u0628\u0631 \u0627\u0633 \u062a\u0627\u0631\u06cc\u062e \u06a9\u06d2 \u0644\u062d\u0627\u0638 \u0633\u06d2 \u062a\u0628\u062f\u06cc\u0644 \u06c1\u0648\u062a\u06d2 \u06c1\u06cc\u06ba \u062c\u0628 \u0622\u067e \u0627\u0646\u06c1\u06cc\u06ba \u0686\u0644\u0627\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<h3 id=\"heading-the-decision-the-script-cant-make-for-you\">\u0648\u06c1 \u0641\u06cc\u0635\u0644\u06d2 \u062c\u0648 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0646\u06c1\u06cc\u06ba \u06a9\u0631 \u0633\u06a9\u062a\u0627<\/h3>\n<p>\u0627\u0633\u062a\u062b\u0646\u0627 EC2 \u0644\u0627\u0626\u0646 \u0645\u06cc\u06ba \u06c1\u06d2\u060c \u062c\u06c1\u0627\u06ba \u0645\u06cc\u0631\u06cc \u062c\u0628\u0644\u062a EC2 \u0645\u062b\u0627\u0644\u0648\u06ba \u06a9\u0648 \u0686\u0644\u0627\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u06c1\u06d2\u06d4 \u062a\u0627\u06c1\u0645\u060c \u062c\u06cc\u0633\u0627 \u06a9\u06c1 \u0622\u0624\u0679 \u067e\u0679 \u062e\u0628\u0631\u062f\u0627\u0631 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u060c \u0627\u0646\u062a\u0633\u0627\u0628 AWS \u06a9\u0627 \u0627\u0646\u062a\u062e\u0627\u0628 \u06c1\u06d2\u060c \u0622\u067e \u06a9\u0627 \u0646\u06c1\u06cc\u06ba\u06d4<\/p>\n<p>EC2 \u06a9\u0646\u0633\u0648\u0644 \u06a9\u06be\u0648\u0644\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2\u060c \u0627\u0633 \u062f\u0646 \u06a9\u06cc \u062a\u0639\u06cc\u0646\u0627\u062a\u06cc \u06a9\u06cc \u062a\u0627\u0631\u06cc\u062e \u0686\u06cc\u06a9 \u06a9\u0631\u06cc\u06ba\u06d4 \u06a9\u06cc\u0627 \u062a\u0642\u0633\u06cc\u0645 \u06a9\u06cc\u0627 \u06af\u06cc\u0627\u061f \u06a9\u06cc\u0627 \u0646\u06cc\u0627 \u0645\u0627\u062d\u0648\u0644 \u067e\u06cc\u062f\u0627 \u06c1\u0648\u0627 \u06c1\u06d2\u061f \u06a9\u06cc\u0627 \u0622\u0679\u0648 \u0627\u0633\u06a9\u06cc\u0644\u0631 \u0648\u0627\u0642\u0639\u0627\u062a \u06a9\u0648 \u0628\u0631\u0637\u0631\u0641 \u06a9\u06cc\u0627 \u06af\u06cc\u0627 \u06c1\u06d2\u061f \u0622\u067e\u0631\u06cc\u0634\u0646\u0644 \u062a\u0628\u062f\u06cc\u0644\u06cc\u0648\u06ba \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0634\u0631\u0648\u0639 \u06a9\u0631\u062a\u06d2 \u06c1\u0648\u0626\u06d2 \u0628\u0644\u0646\u06af \u0688\u06cc\u0679\u0627 \u067e\u0631 \u062a\u06be\u0631\u06cc\u0688 \u067e\u0631 \u0639\u0645\u0644 \u06a9\u0631\u06cc\u06ba\u06d4 \u0627\u0633 \u06a9\u06cc \u0648\u062c\u06c1 \u06cc\u06c1 \u06c1\u06d2 \u06a9\u06c1 \u0628\u0644\u0646\u06af \u0644\u06cc\u0628\u0644 \u0633\u06d2 \u0634\u0631\u0648\u0639 \u06a9\u0631\u0646\u0627 \u0627\u0648\u0631 \u067e\u06cc\u0686\u06be\u06d2 \u06a9\u06cc \u0637\u0631\u0641 \u06a9\u0627\u0645 \u06a9\u0631\u0646\u0627 \u0633\u0633\u062a \u0627\u0648\u0631 \u0627\u06a9\u062b\u0631 \u06af\u0645\u0631\u0627\u06c1 \u06a9\u0646 \u06c1\u0648\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<h3 id=\"heading-break-it-on-purpose\">\u062c\u0627\u0646 \u0628\u0648\u062c\u06be \u06a9\u0631 \u062a\u0648\u0691 \u062f\u0648<\/h3>\n<pre><code class=\"language-bash\"># See the spike immediately with no AWS account needed\npython detect_cost_anomaly.py --sample\n\n# Run against your real account\npython detect_cost_anomaly.py\n\n# Only show anomalies from the last 7 days, good for a quick this-week check\npython detect_cost_anomaly.py --recent-days=7\n\n# Combine both flags - sample data filtered to the last 7 days\npython detect_cost_anomaly.py --sample --recent-days=7\n<\/code><\/pre>\n<p><strong>\u0627\u06af\u0631 \u06a9\u0648\u0626\u06cc \u062d\u0642\u06cc\u0642\u06cc \u0627\u06a9\u0627\u0624\u0646\u0679 &quot;\u06a9\u0648\u0626\u06cc \u0628\u06d2 \u0636\u0627\u0628\u0637\u06af\u06cc \u0646\u06c1\u06cc\u06ba \u067e\u0627\u06cc\u0627&#8221; \u0644\u0648\u0679\u0627\u062a\u0627 \u06c1\u06d2 \u062a\u0648 \u06cc\u06c1 \u0646\u0627\u06a9\u0627\u0645\u06cc \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4<\/strong> \u0627\u0633 \u06a9\u0627 \u0645\u0637\u0644\u0628 \u06cc\u06c1 \u06c1\u06d2 \u06a9\u06c1 \u062e\u0631\u0686 \u06a9\u0631\u0646\u0627 \u0645\u0633\u062a\u0642\u0644 \u06c1\u06d2\u06d4 \u0635\u0627\u0641 \u0627\u06a9\u0627\u0624\u0646\u0679 \u0635\u0627\u0641 \u0622\u0624\u0679 \u067e\u0679 \u0648\u0627\u067e\u0633 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0628\u0627\u0644\u06a9\u0644 \u0648\u06c1\u06cc \u06a9\u0631 \u0631\u06c1\u06cc \u06c1\u06d2 \u062c\u0648 \u0627\u0633\u06d2 \u06a9\u0631\u0646\u0627 \u0686\u0627\u06c1\u06cc\u06d2 \u062a\u06be\u0627\u06d4<\/p>\n<p>\u062c\u0628 \u0622\u067e \u06a9\u06d2 \u0627\u06a9\u0627\u0624\u0646\u0679 \u0645\u06cc\u06ba \u062d\u0642\u06cc\u0642\u06cc \u0648\u0627\u0642\u0639\u0627\u062a \u0631\u0648\u0646\u0645\u0627 \u06c1\u0648\u062a\u06d2 \u06c1\u06cc\u06ba\u060c \u062c\u06cc\u0633\u06d2 \u06a9\u06c1 \u0622\u0679\u0648 \u0627\u0633\u06a9\u06cc\u0644\u0631\u0632 \u0686\u0644 \u0631\u06c1\u06d2 \u06c1\u06cc\u06ba\u060c \u0628\u06be\u0648\u0644\u06d2 \u06c1\u0648\u0626\u06d2 \u0645\u0627\u062d\u0648\u0644\u060c \u06cc\u0627 \u063a\u06cc\u0631 \u0645\u062a\u0648\u0642\u0639 \u0688\u06cc\u0679\u0627 \u06a9\u06cc \u0645\u0646\u062a\u0642\u0644\u06cc\u060c \u062a\u0648 \u06c1\u0645 \u0627\u0646\u06c1\u06cc\u06ba \u0622\u067e \u06a9\u06d2 \u0627\u0646\u0648\u0627\u0626\u0633 \u0628\u06be\u06cc\u062c\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u06c1\u06cc \u067e\u06a9\u0691 \u0644\u06cc\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<h2 id=\"heading-use-case-2-log-correlation-across-services\">\u06a9\u06cc\u0633 2 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u06cc\u06ba &#8211; \u06a9\u0631\u0627\u0633 \u0633\u0631\u0648\u0633 \u0644\u0627\u06af \u0627\u0631\u062a\u0628\u0627\u0637<\/h2>\n<p><strong>\u0645\u0627\u062d\u0648\u0644:<\/strong> \u0645\u06a9\u0645\u0644 \u0637\u0648\u0631 \u067e\u0631 \u0645\u0642\u0627\u0645\u06cc &#8211; \u0688\u0648\u06a9\u0631 \u06a9\u0645\u067e\u0648\u0632\u060c \u062a\u06cc\u0646 \u0627\u0632\u06af\u0631 \u062e\u062f\u0645\u0627\u062a<br \/><strong>\u0632\u0628\u0627\u0646:<\/strong> \u0627\u0632\u06af\u0631<\/p>\n<h3 id=\"heading-the-production-problem\">\u067e\u06cc\u062f\u0627\u0648\u0627\u0631 \u06a9\u06d2 \u0645\u0633\u0627\u0626\u0644<\/h3>\n<p>\u0635\u0627\u0631\u0641 \u06a9\u06cc \u0627\u0637\u0644\u0627\u0639 \u06c1\u06d2 \u06a9\u06c1 \u0627\u062f\u0627\u0626\u06cc\u06af\u06cc \u0646\u0627\u06a9\u0627\u0645 \u06c1\u0648\u06af\u0626\u06cc\u06d4 \u0644\u0627\u06af\u0646\u06af \u0679\u0648\u0644 \u06a9\u06be\u0648\u0644\u06cc\u06ba \u0627\u0648\u0631 \u0627\u0633\u06d2 \u062a\u0644\u0627\u0634 \u06a9\u0631\u06cc\u06ba\u06d4 \u062a\u0635\u062f\u06cc\u0642 \u06a9\u06cc \u062e\u062f\u0645\u062a \u0646\u06d2 \u0627\u06cc\u06a9 \u06a9\u0627\u0645\u06cc\u0627\u0628 \u062a\u0635\u062f\u06cc\u0642 \u0631\u06cc\u06a9\u0627\u0631\u0688 \u06a9\u06cc \u06c1\u06d2\u06d4 \u0644\u06cc\u062c\u0631 \u0633\u0631\u0648\u0633 \u0646\u06d2 \u0627\u06cc\u06a9 \u06a9\u0627\u0645\u06cc\u0627\u0628 \u0679\u0631\u0627\u0646\u0632\u06cc\u06a9\u0634\u0646 \u0631\u06cc\u06a9\u0627\u0631\u0688 \u06a9\u06cc\u060c \u0644\u06cc\u06a9\u0646 \u0646\u0648\u0679\u06cc\u0641\u06a9\u06cc\u0634\u0646 \u0633\u0631\u0648\u0633\u060c \u062c\u0633\u06d2 \u0627\u062f\u0627\u0626\u06cc\u06af\u06cc \u06a9\u06cc \u062a\u0635\u062f\u06cc\u0642\u06cc \u0627\u06cc \u0645\u06cc\u0644 \u0628\u06be\u06cc\u062c\u0646\u06cc \u0686\u0627\u06c1\u06cc\u06d2 \u062a\u06be\u06cc\u060c \u0646\u06d2 \u06a9\u0686\u06be \u0628\u06be\u06cc \u0631\u06cc\u06a9\u0627\u0631\u0688 \u0646\u06c1\u06cc\u06ba \u06a9\u06cc\u0627\u06d4<\/p>\n<p>\u062f\u0648 \u062e\u062f\u0645\u0627\u062a \u0646\u06d2 \u06a9\u0627\u0645\u06cc\u0627\u0628\u06cc \u06a9\u06cc \u0627\u0637\u0644\u0627\u0639 \u062f\u06cc\u060c \u0644\u06cc\u06a9\u0646 \u0627\u06cc\u06a9 \u062e\u0627\u0645\u0648\u0634 \u0631\u06c1\u0627\u06d4 \u0627\u062f\u0627\u0626\u06cc\u06af\u06cc \u0627\u0628 \u0628\u06be\u06cc \u0646\u0627\u06a9\u0627\u0645 \u06c1\u0648 \u06af\u0626\u06cc \u0627\u0648\u0631 3 \u0644\u0627\u06af\u0632 \u06c1\u06cc\u06ba \u0644\u06cc\u06a9\u0646 \u06a9\u0648\u0626\u06cc \u0648\u0627\u0636\u062d \u062c\u0648\u0627\u0628 \u0646\u06c1\u06cc\u06ba \u06a9\u06c1 \u06cc\u06c1 \u0633\u0644\u0633\u0644\u06c1 \u06a9\u06c1\u0627\u06ba \u0679\u0648\u0679\u0627 \u062a\u06be\u0627\u06d4<\/p>\n<h3 id=\"heading-whats-actually-happening-at-the-system-level\">\u0646\u0638\u0627\u0645 \u06a9\u06cc \u0633\u0637\u062d \u067e\u0631 \u0627\u0635\u0644 \u0645\u06cc\u06ba \u06a9\u06cc\u0627 \u06c1\u0648 \u0631\u06c1\u0627 \u06c1\u06d2\u061f<\/h3>\n<p><strong>\u06cc\u06c1 \u06a9\u06cc\u0627 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2:<\/strong> \u06cc\u06c1 \u0644\u0627\u06af \u0627\u06cc\u06af\u0631\u06cc\u06af\u06cc\u0634\u0646 \u0679\u0648\u0644 \u0627\u0646\u0633\u0679\u0627\u0644 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u06af\u0627\u0626\u06cc\u0688 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4 \u0633\u0628 \u0633\u06d2 \u067e\u06c1\u0644\u06d2\u060c \u06cc\u06c1 \u0627\u0646 \u0688\u06cc\u0679\u0627 \u0688\u06be\u0627\u0646\u0686\u06d2 \u06a9\u06d2 \u0628\u0627\u0631\u06d2 \u0645\u06cc\u06ba \u06c1\u06d2 \u062c\u0648 \u0644\u0627\u06af \u06a9\u0648 \u0627\u0631\u062a\u0628\u0627\u0637 \u06a9\u0648 \u0641\u0639\u0627\u0644 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba \u0627\u0648\u0631 \u06a9\u06cc\u0627 \u06c1\u0648\u062a\u0627 \u06c1\u06d2 \u062c\u0628 \u0648\u06c1 \u0688\u06be\u0627\u0646\u0686\u06d2 \u0627\u06cc\u06a9 \u0633\u0631\u0648\u0633 \u06a9\u06d2 \u062e\u0631\u0627\u0628\u06cc \u06a9\u06d2 \u0631\u0627\u0633\u062a\u06d2 \u0645\u06cc\u06ba \u0679\u0648\u0679 \u062c\u0627\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u0627\u06cc\u06a9 \u06c1\u06cc \u0633\u0631\u0648\u0633 \u0648\u0627\u0644\u06d2 \u0633\u0633\u0679\u0645\u0632 \u0645\u06cc\u06ba \u0688\u06cc\u0628\u06af \u06a9\u0631\u0646\u0627 \u0622\u0633\u0627\u0646 \u06c1\u06d2\u06d4 \u0627\u06cc\u06a9 \u0633\u0631\u0648\u0633\u060c \u0627\u06cc\u06a9 \u0644\u0627\u06af \u0641\u0627\u0626\u0644\u060c \u0627\u06cc\u06a9 \u0679\u0627\u0626\u0645 \u0644\u0627\u0626\u0646\u06d4 \u062a\u0627\u06c1\u0645\u060c \u0627\u06af\u0631 \u0635\u0627\u0631\u0641 \u06a9\u06cc \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u0645\u062a\u0639\u062f\u062f \u062e\u062f\u0645\u0627\u062a \u0633\u06d2 \u06af\u0632\u0631\u062a\u06cc \u06c1\u06d2\u060c \u062a\u0648 \u0622\u067e \u06a9\u0648 \u062a\u0645\u0627\u0645 \u0644\u0627\u06af\u0632 \u06a9\u0648 \u0622\u067e\u0633 \u0645\u06cc\u06ba \u062c\u0648\u0691\u0646\u06d2 \u06a9\u0627 \u0637\u0631\u06cc\u0642\u06c1 \u062f\u0631\u06a9\u0627\u0631 \u06c1\u0648\u06af\u0627\u06d4 \u0627\u0633 \u0644\u0646\u06a9 \u06a9\u0648 \u0679\u0631\u06cc\u06a9\u0646\u06af \u0622\u0626\u06cc \u0688\u06cc \u06a9\u06c1\u0627 \u062c\u0627\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u0627\u0633\u06d2 \u06a9\u0633\u06cc \u0633\u0631\u06a9\u0627\u0631\u06cc \u062f\u0641\u062a\u0631 \u0645\u06cc\u06ba \u0679\u06a9\u0679 \u0646\u0645\u0628\u0631 \u06a9\u06cc \u0637\u0631\u062d \u0633\u0645\u062c\u06be\u06cc\u06ba\u06d4 \u062c\u0628 \u0622\u067e \u0627\u0646\u062f\u0631 \u062c\u0627\u0626\u06cc\u06ba \u06af\u06d2 \u062a\u0648 \u0622\u067e \u06a9\u0648 A247 \u062c\u06cc\u0633\u0627 \u0646\u0645\u0628\u0631 \u0646\u0638\u0631 \u0622\u0626\u06d2 \u06af\u0627\u06d4 \u06a9\u0648\u0626\u06cc \u0628\u06be\u06cc \u0688\u06cc\u0633\u06a9 \u062c\u0648 \u0622\u067e \u06a9\u06d2 \u06a9\u06cc\u0633 \u06a9\u0648 \u0633\u0646\u0628\u06be\u0627\u0644\u062a\u0627 \u06c1\u06d2 \u0622\u067e \u06a9\u06cc \u0641\u0627\u0626\u0644 \u0645\u06cc\u06ba A247 \u0646\u0648\u0679 \u06a9\u0631\u06d2 \u06af\u0627\u06d4 \u062c\u0628 \u06a9\u0648\u0626\u06cc \u0645\u0633\u0626\u0644\u06c1 \u067e\u06cc\u062f\u0627 \u06c1\u0648\u062a\u0627 \u06c1\u06d2\u060c \u0645\u06cc\u0646\u06cc\u062c\u0631\u0632 \u062a\u0645\u0627\u0645 \u0631\u06cc\u06a9\u0627\u0631\u0688\u0632 \u06a9\u0648 A247 \u0645\u06cc\u06ba \u06a9\u06be\u06cc\u0646\u0686\u062a\u06d2 \u06c1\u06cc\u06ba \u062a\u0627\u06a9\u06c1 \u06cc\u06c1 \u062f\u06cc\u06a9\u06be\u0627 \u062c\u0627 \u0633\u06a9\u06d2 \u06a9\u06c1 \u06c1\u0631 \u0645\u06cc\u0632 \u067e\u0631 \u0627\u0648\u0631 \u062a\u0631\u062a\u06cc\u0628 \u0633\u06d2 \u06a9\u06cc\u0627 \u06c1\u0648\u0627 \u06c1\u06d2\u06d4 \u06cc\u06c1 \u0679\u0631\u06cc\u06a9\u0646\u06af \u0622\u0626\u06cc \u0688\u06cc \u06c1\u06d2\u06d4 \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u067e\u0631 \u06a9\u0627\u0631\u0631\u0648\u0627\u0626\u06cc \u06a9\u0631\u0646\u06d2 \u0648\u0627\u0644\u06cc \u062a\u0645\u0627\u0645 \u0633\u0631\u0648\u0633\u0632 \u06a9\u06d2 \u0630\u0631\u06cc\u0639\u06d2 \u0627\u0634\u062a\u0631\u0627\u06a9 \u06a9\u0631\u062f\u06c1 \u0627\u06cc\u06a9 \u0646\u0645\u0628\u0631\u06d4<\/p>\n<p>\u0688\u06cc\u0645\u0648 \u0645\u06cc\u06ba\u060c \u062c\u0628 \u06a9\u0648\u0626\u06cc \u0627\u062f\u0627\u0626\u06cc\u06af\u06cc \u0622\u062a\u06cc \u06c1\u06d2\u060c \u062a\u0648\u062b\u06cc\u0642 \u06a9\u06cc \u062e\u062f\u0645\u062a \u0627\u062f\u0627\u0626\u06cc\u06af\u06cc \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u06cc\u06a9 \u0645\u0646\u0641\u0631\u062f ID \u0628\u0646\u0627\u062a\u06cc \u06c1\u06d2\u06d4 \u0627\u0633 \u0627\u062f\u0627\u0626\u06cc\u06af\u06cc \u06a9\u06d2 \u0644\u06cc\u06d2 \u062a\u0635\u062f\u06cc\u0642\u060c \u0644\u06cc\u062c\u0631\u060c \u0627\u0648\u0631 \u0627\u0637\u0644\u0627\u0639\u0627\u062a \u06a9\u0648 \u0631\u06cc\u06a9\u0627\u0631\u0688 \u06a9\u0631\u0646\u06d2 \u0648\u0627\u0644\u06cc \u062a\u0645\u0627\u0645 \u0644\u0627\u06af \u0644\u0627\u0626\u0646\u06cc\u06ba \u0627\u06cc\u06a9 \u06c1\u06cc ID \u067e\u0631 \u0645\u0634\u062a\u0645\u0644 \u06c1\u0648\u06ba \u06af\u06cc\u06d4 \u0627\u06af\u0631 \u06a9\u0686\u06be \u0679\u0648\u0679 \u062c\u0627\u0626\u06d2 \u062a\u0648 \u062f\u0648\u0691\u0648 <code>correlate.py<\/code> \u0627\u0633 ID \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u06d2 \u06c1\u0648\u0626\u06d2\u060c \u06c1\u0645 \u062a\u06cc\u0646\u0648\u06ba \u062e\u062f\u0645\u0627\u062a \u0633\u06d2 \u062a\u0645\u0627\u0645 \u0645\u062a\u0639\u0644\u0642\u06c1 \u0644\u0627\u06af \u0644\u0627\u0626\u0646\u06cc\u06ba \u062a\u0644\u0627\u0634 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba \u0627\u0648\u0631 \u0627\u0646\u06c1\u06cc\u06ba \u0648\u0642\u062a \u06a9\u06d2 \u0645\u0637\u0627\u0628\u0642 \u062a\u0631\u062a\u06cc\u0628 \u062f\u06cc\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<pre><code class=\"language-plaintext\">python correlate.py pay-abc123\n<\/code><\/pre>\n<p>\u0644\u0627\u06af \u062f\u0631\u062c \u0630\u06cc\u0644 \u06c1\u06d2: \u062a\u0645\u0627\u0645 \u0644\u0627\u0626\u0646\u06cc\u06ba \u0627\u06cc\u06a9 \u062c\u06cc\u0633\u06cc \u06c1\u06cc\u06ba\u06d4 <code>trace_id<\/code>:<\/p>\n<pre><code class=\"language-json\">{\"timestamp\": \"2026-05-01T14:23:01.234Z\", \"trace_id\": \"pay-abc123\", \"service\": \"auth\", \"event\": \"user_authenticated\", \"level\": \"INFO\", \"user_id\": \"u_789\", \"duration_ms\": 12}\n{\"timestamp\": \"2026-05-01T14:23:01.891Z\", \"trace_id\": \"pay-abc123\", \"service\": \"ledger\", \"event\": \"transaction_recorded\", \"level\": \"INFO\", \"amount\": 50.0, \"currency\": \"USD\"}\n{\"timestamp\": \"2026-05-01T14:23:02.103Z\", \"trace_id\": \"pay-abc123\", \"service\": \"notification\", \"event\": \"email_queued\", \"level\": \"INFO\", \"recipient\": \"user@example.com\"}\n<\/code><\/pre>\n<p>\u0627\u0628 \u06cc\u06c1\u0627\u06ba \u0645\u0633\u0626\u0644\u06c1 \u06c1\u06d2\u06d4 \u0627\u0637\u0644\u0627\u0639 \u06a9\u06cc \u062e\u062f\u0645\u062a \u0627\u06cc \u0645\u06cc\u0644 \u0641\u0631\u0627\u06c1\u0645 \u06a9\u0646\u0646\u062f\u06c1 \u06a9\u0646\u06a9\u0634\u0646 \u06a9\u06d2 \u0679\u0627\u0626\u0645 \u0622\u0624\u0679 \u067e\u0631 \u067e\u06c1\u0646\u0686 \u06af\u0626\u06cc \u06c1\u06d2\u06d4 \u0688\u0648\u06cc\u0644\u067e\u0631 \u062c\u0633 \u0646\u06d2 \u0627\u06cc\u0631\u0631 \u06c1\u06cc\u0646\u0688\u0644\u0631 \u0644\u06a9\u06be\u0627 \u062a\u06be\u0627 \u0648\u06c1 \u0679\u0631\u06cc\u0633 \u0622\u0626\u06cc \u0688\u06cc \u0634\u0627\u0645\u0644 \u06a9\u0631\u0646\u0627 \u0628\u06be\u0648\u0644 \u06af\u06cc\u0627 \u062a\u06be\u0627\u060c \u0644\u06c1\u0630\u0627 \u0645\u0646\u0627\u0633\u0628 \u0644\u0627\u06af \u0644\u0627\u0626\u0646 \u06a9\u06d2 \u0628\u062c\u0627\u0626\u06d2\u060c \u0648\u06c1 \u0644\u06a9\u06be\u062a\u0627 \u06c1\u06d2:<\/p>\n<pre><code class=\"language-plaintext\">2026-05-01T14:23:02.415Z ERROR Connection timeout to email provider smtp.example.com:587\n<\/code><\/pre>\n<p>\u0627\u06cc\u06a9 \u062e\u0631\u0627\u0628\u06cc \u067e\u06cc\u0634 \u0622 \u06af\u0626\u06cc\u06d4 \u0644\u0627\u06af \u0644\u0627\u0626\u0646 \u0645\u0648\u062c\u0648\u062f \u06c1\u06d2\u06d4 \u0644\u06cc\u06a9\u0646 \u06a9\u06cc\u0648\u0646\u06a9\u06c1 \u0627\u06cc\u0633\u06cc \u06a9\u0648\u0626\u06cc \u0628\u0627\u062a \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4 <code>trace_id<\/code>\u060c <code>correlate.py<\/code> \u0627\u0633\u06d2 \u0646\u06c1\u06cc\u06ba \u0645\u0644 \u0633\u06a9\u062a\u0627\u06d4<\/p>\n<p>\u0627\u0637\u0644\u0627\u0639\u0627\u062a \u0627\u0628 \u0628\u06be\u06cc \u0622\u067e \u06a9\u06cc \u0679\u0627\u0626\u0645 \u0644\u0627\u0626\u0646 \u0645\u06cc\u06ba \u0638\u0627\u06c1\u0631 \u06c1\u0648\u06ba \u06af\u06cc \u0627\u0648\u0631 \u0622\u067e \u062f\u06cc\u06a9\u06be \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba: <code>email_send_attempt<\/code> &#8211; \u0644\u06cc\u06a9\u0646 <code>email_queued<\/code> \u0627\u0633\u06d2 \u06a9\u0628\u06be\u06cc \u06a9\u0627\u067e\u06cc \u0646\u06c1 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<pre><code class=\"language-plaintext\">Timeline \u2014 5 events across 3 service(s):\n\n  [2026-05-15T21:59:00.605307+00:00] [AUTH] [INFO] payment_request_received\n  [2026-05-15T21:59:00.606008+00:00] [AUTH] [INFO] user_authenticated\n  [2026-05-15T21:59:00.617331+00:00] [LEDGER] [INFO] transaction_recorded\n  [2026-05-15T21:59:00.630313+00:00] [NOTIFICATION] [INFO] email_send_attempt\n  [2026-05-15T21:59:00.685182+00:00] [AUTH] [INFO] payment_complete\n<\/code><\/pre>\n<p>\u06a9\u0648\u0634\u0634\u06cc\u06ba \u06c1\u0648\u062a\u06cc \u06c1\u06cc\u06ba\u060c \u0644\u06cc\u06a9\u0646 \u0646\u0627\u06a9\u0627\u0645\u06cc \u0646\u06c1\u06cc\u06ba \u06c1\u0648\u062a\u06cc\u06d4 \u0688\u0648\u06cc\u0644\u067e\u0631 \u0627\u06cc\u06a9 \u0641\u06cc\u0644\u0688 \u0628\u06be\u0648\u0644 \u06af\u06cc\u0627\u06d4<\/p>\n<h3 id=\"heading-set-up-the-demo-environment\">\u0688\u06cc\u0645\u0648 \u06a9\u06cc \u062a\u0631\u062a\u06cc\u0628\u0627\u062a<\/h3>\n<p>\u0627\u06af\u0644\u06d2 \u067e\u0631 \u062c\u0627\u0626\u06cc\u06ba\u06d4 <code>02-log-correlation\/<\/code> \u06c1\u0645 \u062a\u06cc\u0646 \u062e\u062f\u0645\u0627\u062a \u0634\u0631\u0648\u0639 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba:<\/p>\n<pre><code class=\"language-plaintext\">cd 02-log-correlation\ndocker compose up -d\n<\/code><\/pre>\n<p>\u0627\u0633 \u0633\u06d2 \u062a\u0635\u062f\u06cc\u0642\u060c \u0644\u06cc\u062c\u0631\u060c \u0627\u0648\u0631 \u0627\u0637\u0644\u0627\u0639 \u06a9\u06cc \u062e\u062f\u0645\u0627\u062a \u0634\u0631\u0648\u0639 \u06c1\u0648\u062a\u06cc \u06c1\u06cc\u06ba\u06d4 \u06a9\u0686\u06be \u0644\u0627\u06af \u0628\u0646\u0627\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u062f\u0627\u0626\u06cc\u06af\u06cc \u06a9\u06cc \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u0686\u0644\u0627\u0626\u06cc\u06ba\u06d4<\/p>\n<pre><code class=\"language-plaintext\">.\/trigger_request.sh\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/umang.pk\/wp-content\/uploads\/2026\/05\/1779904521_566_\u0631\u06cc\u0626\u0644-\u0648\u0631\u0644\u0688-\u0688\u06cc-\u0627\u0648-\u0627\u0648\u067e\u0633-\u0622\u0679\u0648\u0645\u06cc\u0634\u0646-\u06a9\u06d2-\u0644\u06cc\u06d2-\u0628\u0627\u0634-\u0627\u0648\u0631.png\" alt=\"Trigger_request.sh \u0679\u0631\u0645\u06cc\u0646\u0644 \u0622\u0624\u0679 \u067e\u0679 - Traceid \u06a9\u0648 \u0628\u06be\u06cc \u062f\u06a9\u06be\u0627\u062a\u0627 \u06c1\u06d2\u06d4\" style=\"display:block;margin:0 auto\" width=\"600\" height=\"400\" loading=\"lazy\" title=\"\"><\/p>\n<p>\u0627\u0633\u06a9\u0631\u067e\u0679 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u0634\u062f\u06c1 \u0679\u0631\u06cc\u06a9\u0646\u06af ID \u06a9\u0648 \u067e\u0631\u0646\u0679 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u0645\u06a9\u0645\u0644 \u06a9\u0627\u0645 \u06a9\u0631\u0646\u06d2 \u06a9\u0627 \u0631\u0627\u0633\u062a\u06c1 \u062f\u06cc\u06a9\u06be\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2\u060c ID \u06a9\u0648 \u06a9\u0627\u067e\u06cc \u06a9\u0631\u06cc\u06ba \u0627\u0648\u0631 \u0627\u0631\u062a\u0628\u0627\u0637 \u06a9\u0627 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0686\u0644\u0627\u0626\u06cc\u06ba\u06d4<\/p>\n<pre><code class=\"language-plaintext\">python correlate.py pay-5831e1bf\n<\/code><\/pre>\n<p>\u0622\u067e \u06a9\u0648 \u06a9\u0686\u06be \u0627\u0633 \u0637\u0631\u062d \u0646\u0638\u0631 \u0622\u0646\u0627 \u0686\u0627\u06c1\u0626\u06d2 (\u0679\u0631\u06cc\u06a9\u0646\u06af \u0622\u0626\u06cc \u0688\u06cc\u0632 \u0645\u062e\u062a\u0644\u0641 \u06c1\u06cc\u06ba\u060c \u0644\u06cc\u06a9\u0646 \u0633\u0627\u062e\u062a \u0627\u06cc\u06a9 \u062c\u06cc\u0633\u06cc \u06c1\u06d2):<\/p>\n<pre><code class=\"language-plaintext\">Loading logs from .\/logs\/...\nLoaded 6 structured log lines.\n\n============================================================\nTrace ID: pay-5831e1bf\n============================================================\n\nTimeline - 6 events across 3 service(s):\n\n  [2026-05-15T21:42:28.079046+00:00] [AUTH] [INFO] payment_request_received\n    service: auth\n    user_id: u_789\n    amount: 50.0\n  [2026-05-15T21:42:28.080718+00:00] [AUTH] [INFO] user_authenticated\n    service: auth\n    user_id: u_789\n    duration_ms: 12\n  [2026-05-15T21:42:28.145528+00:00] [LEDGER] [INFO] transaction_recorded\n    service: ledger\n    user_id: u_789\n    amount: 50.0\n    currency: USD\n  [2026-05-15T21:42:28.210088+00:00] [NOTIFICATION] [INFO] email_send_attempt\n    service: notification\n    recipient: user@example.com\n  [2026-05-15T21:42:28.347893+00:00] [NOTIFICATION] [INFO] email_queued\n    service: notification\n    recipient: user@example.com\n    amount: 50.0\n  [2026-05-15T21:42:28.378402+00:00] [AUTH] [INFO] payment_complete\n    service: auth\n    user_id: u_789\n    amount: 50.0\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/umang.pk\/wp-content\/uploads\/2026\/05\/1779904521_708_\u0631\u06cc\u0626\u0644-\u0648\u0631\u0644\u0688-\u0688\u06cc-\u0627\u0648-\u0627\u0648\u067e\u0633-\u0622\u0679\u0648\u0645\u06cc\u0634\u0646-\u06a9\u06d2-\u0644\u06cc\u06d2-\u0628\u0627\u0634-\u0627\u0648\u0631.png\" alt=\"\u0679\u0631\u0645\u06cc\u0646\u0644 \u0622\u0624\u0679 \u067e\u0679 \u0627\u062f\u0627\u0626\u06cc\u06af\u06cc \u06a9\u0627 \u067e\u0648\u0631\u0627 \u0639\u0645\u0644 \u062f\u06a9\u06be\u0627 \u0631\u06c1\u0627 \u06c1\u06d2\u06d4\" style=\"display:block;margin:0 auto\" width=\"600\" height=\"400\" loading=\"lazy\" title=\"\"><\/p>\n<p>\u06cc\u06c1 \u0627\u062f\u0627\u0626\u06cc\u06af\u06cc \u06a9\u0627 \u067e\u0648\u0631\u0627 \u0633\u0641\u0631 \u06c1\u06d2\u060c \u0628\u0634\u0645\u0648\u0644 \u062a\u0635\u062f\u06cc\u0642\u060c \u0644\u06cc\u062c\u0631\u060c \u0627\u0648\u0631 \u0627\u0637\u0644\u0627\u0639\u0627\u062a \u0628\u0627\u0644\u06a9\u0644 \u0627\u0633\u06cc \u062a\u0631\u062a\u06cc\u0628 \u0645\u06cc\u06ba \u062c\u0633 \u0645\u06cc\u06ba \u0648\u06c1 \u0648\u0627\u0642\u0639 \u06c1\u0648\u0626\u06d2 \u06c1\u06cc\u06ba\u06d4 \u0627\u0628 \u062f\u06cc\u06a9\u06be\u062a\u06d2 \u06c1\u06cc\u06ba \u06a9\u06c1 \u0627\u0633\u06a9\u0631\u067e\u0679 \u06a9\u06cc\u0633\u06d2 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<h3 id=\"heading-the-script\">\u0633\u06a9\u0631\u067e\u0679<\/h3>\n<pre><code class=\"language-python\"># correlate.py\nimport json\nimport os\nimport sys\n\nSERVICES = [\"auth\", \"ledger\", \"notification\"]\nLOG_DIR = \".\/logs\"\n\n\ndef load_logs(log_dir):\n    \"\"\"\n    Read each service's log file and parse every line as JSON.\n    Lines that fail JSON parsing are printed as warnings.\n    They are not silently dropped - a plain-text error line in a service\n    that should emit structured logs is itself evidence worth seeing.\n    \"\"\"\n    all_lines = []\n\n    for service in SERVICES:\n        log_file = os.path.join(log_dir, f\"{service}.log\")\n\n        if not os.path.exists(log_file):\n            print(f\"  WARNING: No log file for '{service}' at {log_file}\")\n            continue\n\n        with open(log_file) as f:\n            for line_num, line in enumerate(f, 1):\n                line = line.strip()\n                if not line:\n                    continue\n                try:\n                    parsed = json.loads(line)\n                    parsed[\"_source\"] = service\n                    all_lines.append(parsed)\n                except json.JSONDecodeError:\n                    # This line exists in the log but cannot be correlated.\n                    print(f\"  WARNING: {service}.log line {line_num} is not structured JSON:\")\n                    print(f\"           {line[:100]}\")\n                    print(f\"           This line will NOT appear in any trace-based search.\")\n\n    return all_lines\n\n\ndef correlate(trace_id, all_lines):\n    \"\"\"\n    Find every log line with this trace_id and sort by timestamp.\n    The sorted result is the reconstructed timeline of the request.\n    \"\"\"\n    matched = [line for line in all_lines if line.get(\"trace_id\") == trace_id]\n    matched.sort(key=lambda x: x.get(\"timestamp\", \"\"))\n    return matched\n\n\ndef find_missing_services(matched):\n    \"\"\"\n    Check which services produced zero trace-tagged lines for this request.\n    A missing service is not just an absence - it is a signal.\n    Either the request never reached that service, or an error path swallowed\n    the trace ID. Both are worth investigating.\n    \"\"\"\n    services_seen = {line[\"_source\"] for line in matched}\n    return [s for s in SERVICES if s not in services_seen]\n\n\ndef print_timeline(trace_id, matched, missing):\n    print(f\"n{'=' * 60}\")\n    print(f\"Trace ID: {trace_id}\")\n    print(f\"{'=' * 60}\")\n\n    if not matched:\n        print(\"nNo structured log lines found with this trace ID.\")\n        print(\"Either the trace ID is wrong, or no service emitted\")\n        print(\"a structured log line for this request.\")\n        return\n\n    services_count = len({line[\"_source\"] for line in matched})\n    print(f\"nTimeline - {len(matched)} events across {services_count} service(s):n\")\n\n    for line in matched:\n        ts = line.get(\"timestamp\", \"unknown\")\n        service = line.get(\"_source\", \"unknown\").upper()\n        event = line.get(\"event\", \"unknown event\")\n        level = line.get(\"level\", \"INFO\")\n        extras = {k: v for k, v in line.items()\n                  if k not in (\"timestamp\", \"trace_id\", \"event\", \"level\", \"_source\")}\n\n        print(f\"  [{ts}] [{service}] [{level}] {event}\")\n        for k, v in extras.items():\n            print(f\"    {k}: {v}\")\n\n    if missing:\n        print(f\"n{'=' * 60}\")\n        print(\"MISSING TELEMETRY\")\n        print(f\"{'=' * 60}\")\n        print(f\"These services produced no trace-tagged events for trace {trace_id}:n\")\n        for s in missing:\n            print(f\"  - {s}\")\n        print()\n        print(\"This means one of three things:\")\n        print(\"  1. The request never reached this service.\")\n        print(\"  2. The service received it but an error path swallowed the trace ID,\")\n        print(\"     leaving a plain-text log line that trace correlation cannot find.\")\n        print(\"  3. This service's log file was not included in this run.\")\n        print()\n        print(\"Check the raw log file for a plain-text error line around the same timestamp.\")\n        print(\"If one exists, that is your root cause - and a structured logging gap to fix.\")\n\n\ndef run(trace_id):\n    print(f\"Loading logs from {LOG_DIR}\/...\")\n    all_lines = load_logs(LOG_DIR)\n    print(f\"Loaded {len(all_lines)} structured log lines.n\")\n\n    matched = correlate(trace_id, all_lines)\n    missing = find_missing_services(matched)\n    print_timeline(trace_id, matched, missing)\n\n\nif __name__ == \"__main__\":\n    if len(sys.argv) < 2:\n        print(\"Usage: python correlate.py <trace_id>\")\n        print(\"Example: python correlate.py pay-abc123\")\n        sys.exit(1)\n    run(sys.argv[1])\n<\/trace_id><\/code><\/pre>\n<h3 id=\"heading-how-the-script-works\">\u0627\u0633\u06a9\u0631\u067e\u0679 \u06a9\u06cc\u0633\u06d2 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/h3>\n<p><code>load_logs<\/code>    \u06c1\u0631 \u0633\u0631\u0648\u0633 \u0633\u06d2 \u0644\u0627\u06af \u0641\u0627\u0626\u0644\u06cc\u06ba \u067e\u0691\u06be\u06cc\u06ba\u06d4 \u06c1\u0631 \u0644\u0627\u0626\u0646 JSON \u06c1\u0648\u0646\u06cc \u0686\u0627\u06c1\u06cc\u06d2\u06d4 \u0627\u06af\u0631 \u0642\u0637\u0627\u0631 JSON \u0646\u06c1\u06cc\u06ba \u06c1\u06d2 \u062a\u0648\u060c \u0627\u06cc\u06a9 \u0627\u0646\u062a\u0628\u0627\u06c1 \u0639\u0627\u0645 \u0637\u0648\u0631 \u067e\u0631 \u062e\u0631\u0627\u0628\u06cc \u06a9\u06d2 \u0644\u0627\u06af \u0645\u06cc\u06ba \u067e\u0631\u0646\u0679 \u06a9\u06cc\u0627 \u062c\u0627\u0626\u06d2 \u06af\u0627\u060c \u0645\u0637\u0644\u0628 \u06cc\u06c1 \u06c1\u06d2 \u06a9\u06c1 \u0679\u0631\u06cc\u06a9\u0646\u06af ID \u063a\u0627\u0626\u0628 \u06c1\u06d2 \u0627\u0648\u0631 \u0627\u0633\u06d2 \u0679\u0631\u06cc\u06a9 \u0646\u06c1\u06cc\u06ba \u06a9\u06cc\u0627 \u062c\u0627 \u0633\u06a9\u062a\u0627\u06d4<\/p>\n<p><code>correlate<\/code>    \u062f\u06cc \u06af\u0626\u06cc \u0679\u0631\u06cc\u0633 ID \u0633\u06d2 \u0645\u0645\u0627\u062b\u0644 \u062a\u0645\u0627\u0645 \u0644\u0627\u06af\u0632 \u062a\u0644\u0627\u0634 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u0627\u0648\u0631 \u0627\u0646\u06c1\u06cc\u06ba \u0648\u0642\u062a \u06a9\u06d2 \u0645\u0637\u0627\u0628\u0642 \u062a\u0631\u062a\u06cc\u0628 \u062f\u06cc\u062a\u0627 \u06c1\u06d2\u06d4 \u06cc\u06c1 \u067e\u0648\u0631\u06cc \u0633\u0631\u0648\u0633 \u0645\u06cc\u06ba \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u06a9\u06d2 \u067e\u0648\u0631\u06d2 \u0628\u06c1\u0627\u0624 \u06a9\u0648 \u062f\u0648\u0628\u0627\u0631\u06c1 \u0644\u06a9\u06be\u06d2 \u06af\u0627\u06d4<\/p>\n<p><code>find_missing_services<\/code>    \u0686\u06cc\u06a9 \u06a9\u0631\u06cc\u06ba \u06a9\u06c1 \u06a9\u0633 \u0633\u0631\u0648\u0633 \u0645\u06cc\u06ba \u0627\u0633 \u0679\u0631\u06cc\u06a9\u0646\u06af \u0622\u0626\u06cc \u0688\u06cc \u06a9\u06d2 \u0644\u06cc\u06d2 \u06a9\u0648\u0626\u06cc \u0644\u0627\u06af \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4 \u06cc\u06c1 \u0622\u067e \u06a9\u0648 \u0628\u062a\u0627\u0626\u06d2 \u06af\u0627 \u06a9\u06c1 \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u06a9\u06c1\u0627\u06ba \u0631\u06a9\u06cc \u06c1\u06d2 \u06cc\u0627 \u0679\u0631\u06cc\u06a9\u0646\u06af \u0622\u0626\u06cc \u0688\u06cc \u06a9\u06c1\u0627\u06ba \u06af\u0645 \u06c1\u0648 \u06af\u0626\u06cc \u06c1\u06d2\u06d4<\/p>\n<p><code>print_timeline<\/code>    \u067e\u0648\u0631\u06cc \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u06a9\u06cc \u0679\u0627\u0626\u0645 \u0644\u0627\u0626\u0646 \u062a\u0631\u062a\u06cc\u0628 \u0633\u06d2 \u062f\u06a9\u06be\u0627\u062a\u0627 \u06c1\u06d2\u06d4 \u06cc\u06c1 \u06cc\u06c1 \u0628\u06be\u06cc \u062f\u06a9\u06be\u0627\u062a\u0627 \u06c1\u06d2 \u06a9\u06c1 \u0627\u06af\u0631 \u06a9\u0648\u0626\u06cc \u0686\u06cc\u0632 \u0635\u062d\u06cc\u062d \u0637\u0631\u06cc\u0642\u06d2 \u0633\u06d2 \u0644\u0627\u06af \u0627\u0646 \u0646\u06c1\u06cc\u06ba \u06c1\u0648\u0626\u06cc \u06c1\u06d2 \u062a\u0648 \u06a9\u0648\u0646 \u0633\u06cc \u062e\u062f\u0645\u0627\u062a \u063a\u0627\u0626\u0628 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u0627\u06cc\u06a9 \u062d\u0642\u06cc\u0642\u06cc Kubernetes \u0645\u0627\u062d\u0648\u0644 \u0645\u06cc\u06ba \u0627\u0633\u06d2 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u06d2 \u0648\u0642\u062a \u0630\u06c1\u0646 \u0645\u06cc\u06ba \u0631\u06a9\u06be\u0646\u06d2 \u06a9\u06cc \u0627\u06cc\u06a9 \u0686\u06cc\u0632:<br \/>Kubernetes \u0645\u06cc\u06ba <code>kubectl logs<\/code> \u0635\u0631\u0641 \u0641\u06cc \u0627\u0644\u062d\u0627\u0644 \u0686\u0644\u0646\u06d2 \u0648\u0627\u0644\u06d2 \u06a9\u0646\u0679\u06cc\u0646\u0631\u0632 \u062f\u06a9\u06be\u0627\u062a\u0627 \u06c1\u06d2\u06d4<br \/>\u0627\u06cc\u06a9 \u0628\u0627\u0631 \u062c\u0628 \u0622\u067e \u06a9\u0627 \u067e\u0648\u0688 \u062f\u0648\u0628\u0627\u0631\u06c1 \u0634\u0631\u0648\u0639 \u06c1\u0648 \u062c\u0627\u0626\u06d2 \u062a\u0648\u060c \u0622\u067e \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba:<\/p>\n<pre><code class=\"language-plaintext\">kubectl logs <pod-name> --previous\n<\/pod-name><\/code><\/pre>\n<p>\u062a\u0627\u06c1\u0645\u060c \u06cc\u06c1 \u0635\u0631\u0641 \u0622\u062e\u0631\u06cc \u0631\u06cc \u0627\u0633\u0679\u0627\u0631\u0679 \u067e\u0631 \u0644\u0627\u06af\u0648 \u06c1\u0648\u062a\u0627 \u06c1\u06d2\u06d4 \u0627\u06af\u0631 \u0622\u067e Loki \u06cc\u0627 CloudWatch \u062c\u06cc\u0633\u0627 \u0644\u0627\u06af\u0646\u06af \u0633\u0633\u0679\u0645 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u0646\u06c1\u06cc\u06ba \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u060c \u062a\u0648 \u0622\u067e \u06a9\u06d2 \u067e\u0631\u0627\u0646\u06d2 \u0644\u0627\u06af\u0632 \u063a\u0627\u0626\u0628 \u06c1\u0648 \u062c\u0627\u0626\u06cc\u06ba \u06af\u06d2\u06d4<\/p>\n<h3 id=\"heading-what-the-output-looks-like-after-breaking-it\">\u062a\u0648\u0691\u0646\u06d2 \u06a9\u06d2 \u0628\u0639\u062f \u0622\u0624\u0679 \u067e\u0679<\/h3>\n<p>\u0627\u0633 \u0633\u06cc\u06a9\u0634\u0646 \u06a9\u0627 \u0645\u0642\u0635\u062f \u06cc\u06c1 \u0628\u062a\u0627\u0646\u0627 \u06c1\u06d2 \u06a9\u06c1 \u06a9\u06cc\u0627 \u06c1\u0648\u062a\u0627 \u06c1\u06d2 \u062c\u0628 \u06a9\u0648\u0626\u06cc \u0633\u0631\u0648\u0633 \u062e\u0627\u0645\u0648\u0634\u06cc \u0633\u06d2 \u0646\u0627\u06a9\u0627\u0645 \u06c1\u0648 \u062c\u0627\u062a\u06cc \u06c1\u06d2\u060c \u06cc\u0639\u0646\u06cc \u062c\u0628 \u0644\u0627\u06af \u0645\u06cc\u06ba \u06a9\u0648\u0626\u06cc \u062e\u0631\u0627\u0628\u06cc \u06c1\u0648\u062a\u06cc \u06c1\u06d2\u060c \u0644\u06cc\u06a9\u0646 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0627\u0633\u06d2 \u062a\u0644\u0627\u0634 \u0646\u06c1\u06cc\u06ba \u06a9\u0631 \u067e\u0627\u062a\u0627 \u06a9\u06cc\u0648\u0646\u06a9\u06c1 \u0688\u0648\u06cc\u0644\u067e\u0631 \u0627\u06cc\u06a9 \u0641\u06cc\u0644\u0688 \u0628\u06be\u0648\u0644 \u062c\u0627\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p><code>break_it.sh<\/code>    \u06cc\u06c1 \u0646\u0648\u0679\u06cc\u0641\u06a9\u06cc\u0634\u0646 \u0633\u0631\u0648\u0633 \u06a9\u0648 \u0627\u06cc \u0645\u06cc\u0644 \u0628\u06be\u06cc\u062c\u0646\u06d2 \u06a9\u06cc \u06a9\u0648\u0634\u0634 \u06a9\u0631\u0646\u06d2 \u067e\u0631 \u0646\u0627\u06a9\u0627\u0645 \u06c1\u0648\u0646\u06d2 \u067e\u0631 \u0645\u062c\u0628\u0648\u0631 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u060c \u0627\u0648\u0631 \u0686\u0648\u0646\u06a9\u06c1 \u0627\u06cc\u0631\u0631 \u06c1\u06cc\u0646\u0688\u0644\u0631 \u06a9\u0648 \u0679\u0631\u06cc\u06a9\u0646\u06af \u0622\u0626\u06cc \u0688\u06cc \u06a9\u06d2 \u0628\u063a\u06cc\u0631 \u0644\u06a9\u06be\u0627 \u06af\u06cc\u0627 \u062a\u06be\u0627\u060c \u0627\u0633 \u0644\u06cc\u06d2 \u0646\u0627\u06a9\u0627\u0645\u06cc \u0633\u0627\u062f\u06c1 \u0645\u062a\u0646 \u0645\u06cc\u06ba \u0644\u0627\u06af \u0627\u0646 \u06c1\u0648\u062a\u06cc \u06c1\u06d2 \u062c\u0633\u06d2 \u0627\u0635\u0644 \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u0633\u06d2 \u062f\u0648\u0628\u0627\u0631\u06c1 \u0644\u0646\u06a9 \u0646\u06c1\u06cc\u06ba \u06a9\u06cc\u0627 \u062c\u0627 \u0633\u06a9\u062a\u0627\u06d4<\/p>\n<p>\u0686\u0644\u0627\u0626\u06cc\u06ba:<\/p>\n<pre><code class=\"language-plaintext\">.\/break_it.sh\n<\/code><\/pre>\n<p>\u06cc\u06c1 \u067e\u06be\u0631 \u0627\u06cc\u06a9 \u0646\u0626\u06cc \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u06a9\u0648 \u0645\u062a\u062d\u0631\u06a9 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<pre><code class=\"language-plaintext\">.\/trigger_request.sh\n<\/code><\/pre>\n<p>\u067e\u0631\u0646\u0679 \u0634\u062f\u06c1 \u0679\u0631\u06cc\u06a9\u0646\u06af \u0622\u0626\u06cc \u0688\u06cc \u06a9\u0648 \u06a9\u0627\u067e\u06cc \u06a9\u0631\u06cc\u06ba \u0627\u0648\u0631 \u067e\u06be\u0631 \u0627\u0633\u06d2 \u062c\u0648\u0691\u06cc\u06ba\u06d4<\/p>\n<pre><code class=\"language-plaintext\">python correlate.py pay-xxxxxxxx\n<\/code><\/pre>\n<p>\u0622\u067e \u06a9\u0686\u06be \u0627\u0633 \u0637\u0631\u062d \u062f\u06cc\u06a9\u06be \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba:<\/p>\n<pre><code class=\"language-plaintext\">Loading logs from .\/logs\/...\n  WARNING: notification.log line 10 is not structured JSON:\n           2026-05-15T21:59:00.681583+00:00 ERROR Connection timeout to email\n           provider http:\/\/mock-email:80\/ after 0.001s - failed to send\n           confirmation to user@example.com\n           This line will NOT appear in any trace-based search.\nLoaded 29 structured log lines.\n\n============================================================\nTrace ID: pay-6cf69a8c\n============================================================\n\nTimeline - 5 events across 3 service(s):\n\n  [2026-05-15T21:59:00.605307+00:00] [AUTH] [INFO] payment_request_received\n  [2026-05-15T21:59:00.606008+00:00] [AUTH] [INFO] user_authenticated\n  [2026-05-15T21:59:00.617331+00:00] [LEDGER] [INFO] transaction_recorded\n  [2026-05-15T21:59:00.630313+00:00] [NOTIFICATION] [INFO] email_send_attempt\n  [2026-05-15T21:59:00.685182+00:00] [AUTH] [INFO] payment_complete\n<\/code><\/pre>\n<p>\u0627\u0633 \u06a9\u0648 \u063a\u0648\u0631 \u0633\u06d2 \u062f\u06cc\u06a9\u06be\u06cc\u06ba\u06d4 \u0627\u0637\u0644\u0627\u0639\u0627\u062a \u0679\u0627\u0626\u0645 \u0644\u0627\u0626\u0646 \u067e\u0631 \u06c1\u06cc\u06ba \u0627\u0648\u0631 \u0644\u0627\u06af \u0627\u0646 \u06c1\u06cc\u06ba\u06d4 <code>email_send_attempt<\/code>. \u0644\u06cc\u06a9\u0646 <code>email_queued<\/code> \u06cc\u06c1 \u063a\u0627\u0626\u0628 \u06c1\u06d2\u06d4 \u0627\u0633 \u06a9\u0627 \u0645\u0637\u0644\u0628 \u06c1\u06d2 \u06a9\u06c1 \u0627\u06cc \u0645\u06cc\u0644 \u0627\u0635\u0644 \u0645\u06cc\u06ba \u0646\u06c1\u06cc\u06ba \u0628\u06be\u06cc\u062c\u06cc \u06af\u0626\u06cc \u062a\u06be\u06cc\u060c \u062c\u0648 \u06a9\u06c1 \u063a\u0644\u0637\u06cc \u06c1\u06d2 \u062c\u0648 \u0628\u062a\u0627\u062a\u06cc \u06c1\u06d2 \u06a9\u06c1 \u06cc\u06c1 \u0622\u067e \u06a9\u06cc \u0679\u0627\u0626\u0645 \u0644\u0627\u0626\u0646 \u067e\u0631 \u0628\u0627\u0644\u06a9\u0644 \u06a9\u06cc\u0648\u06ba \u0646\u06c1\u06cc\u06ba \u062f\u06a9\u06be\u0627\u0626\u06cc \u062f\u06cc\u062a\u06cc \u06c1\u06d2\u06d4 \u06cc\u06c1 \u0633\u0628 \u0633\u06d2 \u0627\u0648\u067e\u0631 \u0648\u0627\u0631\u0646\u0646\u06af \u0645\u06cc\u06ba \u067e\u0648\u0634\u06cc\u062f\u06c1 \u06c1\u06d2\u060c \u0627\u0648\u0631 \u0622\u067e \u06a9\u0648 \u0628\u062a\u0627\u062a\u0627 \u06c1\u06d2 \u06a9\u06c1 \u0627\u0633\u06a9\u0631\u067e\u0679 \u06a9\u0648 \u0627\u06cc\u06a9 \u0644\u0627\u0626\u0646 \u0645\u0644\u06cc \u06c1\u06d2 \u062c\u0633 \u06a9\u0627 \u062a\u062c\u0632\u06cc\u06c1 \u0646\u06c1\u06cc\u06ba \u06a9\u06cc\u0627 \u062c\u0627 \u0633\u06a9\u062a\u0627\u06d4<\/p>\n<p>\u06cc\u06c1\u06cc \u0645\u0633\u0626\u0644\u06c1 \u06c1\u06d2\u06d4 \u0645\u06cc\u06ba \u06a9\u0648\u0634\u0634\u06cc\u06ba \u062f\u06cc\u06a9\u06be\u062a\u0627 \u06c1\u0648\u06ba\u060c \u0644\u06cc\u06a9\u0646 \u0645\u06cc\u06ba \u0646\u0627\u06a9\u0627\u0645\u06cc\u0627\u06ba \u0646\u06c1\u06cc\u06ba \u062f\u06cc\u06a9\u06be\u062a\u0627\u06d4<\/p>\n<p>\u0686\u0644\u0627\u0626\u06cc\u06ba <code>cat logs\/notification.log<\/code> \u0646\u06cc\u0686\u06d2 \u062a\u06a9 \u0633\u06a9\u0631\u0648\u0644 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<pre><code class=\"language-plaintext\">{\"timestamp\": \"2026-05-15T21:59:00.630313+00:00\", \"trace_id\": \"pay-6cf69a8c\",\n \"service\": \"notification\", \"event\": \"email_send_attempt\", ...}\n2026-05-15T21:59:00.681583+00:00 ERROR Connection timeout to email provider\nhttp:\/\/mock-email:80\/ after 0.001s - failed to send confirmation to user@example.com\n<\/code><\/pre>\n<p>\u0646\u0648\u0679 \u06a9\u06cc \u062f\u0648 \u0633\u0637\u0631\u06cc\u06ba: \u067e\u06c1\u0644\u06cc \u0633\u0637\u0631 \u0645\u06cc\u06ba \u0679\u0631\u06cc\u06a9\u0646\u06af ID \u06c1\u0648\u062a\u06cc \u06c1\u06d2 \u062c\u0633\u06d2 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0646\u06d2 \u0679\u0627\u0626\u0645 \u0644\u0627\u0626\u0646 \u0645\u06cc\u06ba \u067e\u0627\u06cc\u0627 \u0627\u0648\u0631 \u062f\u06a9\u06be\u0627\u06cc\u0627\u06d4 \u062f\u0648\u0633\u0631\u0627 \u0627\u06cc\u0633\u0627 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0646\u06d2 \u0627\u0633\u06d2 \u0627\u0646\u062a\u0628\u0627\u06c1 \u06a9\u06d2 \u0637\u0648\u0631 \u067e\u0631 \u0646\u0634\u0627\u0646 \u0632\u062f \u06a9\u06cc\u0627 \u0627\u0648\u0631 \u0627\u0633\u06d2 \u0686\u06be\u0648\u0691 \u062f\u06cc\u0627\u06d4 \u063a\u0644\u0637\u06cc \u06a9\u0648\u0634\u0634 \u06a9\u06d2 0.075 \u0633\u06cc\u06a9\u0646\u0688 \u0628\u0639\u062f \u06c1\u0648\u0626\u06cc\u06d4 \u0644\u0627\u06af \u0641\u0627\u0626\u0644 \u0645\u06cc\u06ba \u062f\u0648\u0646\u0648\u06ba \u0644\u0627\u0626\u0646\u06cc\u06ba \u06c1\u06cc\u06ba\u06d4 \u0679\u0627\u0626\u0645 \u0644\u0627\u0626\u0646 \u067e\u0631 \u0635\u0631\u0641 \u0627\u06cc\u06a9 \u06c1\u06d2\u06d4<\/p>\n<p>\u0648\u06c1 \u06a9\u06cc\u0627 \u06c1\u06d2 <em>&quot;\u063a\u06cc\u0631 \u0645\u0631\u0626\u06cc \u0646\u0627\u06a9\u0627\u0645\u06cc&#8221;<\/em> \u0627\u06cc\u0633\u0627 \u0644\u06af\u062a\u0627 \u06c1\u06d2 \u06a9\u06c1 \u06cc\u06c1 \u067e\u06cc\u062f\u0627\u0648\u0627\u0631 \u0645\u06cc\u06ba \u06c1\u06d2\u06d4 \u0627\u062f\u0627\u0626\u06cc\u06af\u06cc \u067e\u0631 \u06a9\u0627\u0631\u0631\u0648\u0627\u0626\u06cc \u06c1\u0648 \u0686\u06a9\u06cc \u06c1\u06d2\u06d4 \u06a9\u0648\u0626\u06cc \u062a\u0635\u062f\u06cc\u0642\u06cc \u0627\u06cc \u0645\u06cc\u0644 \u0646\u06c1\u06cc\u06ba \u0628\u06be\u06cc\u062c\u06cc \u06af\u0626\u06cc\u06d4 \u063a\u0644\u0637\u06cc \u0648\u06c1\u06cc\u06ba \u0644\u0627\u06af \u0641\u0627\u0626\u0644 \u0645\u06cc\u06ba \u06c1\u06d2\u06d4 <code>Connection timeout to email provider after 0.001s<\/code> \u062a\u0627\u06c1\u0645\u060c \u0645\u0646\u062f\u0631\u062c\u06c1 \u0628\u0627\u0644\u0627 \u0627\u0631\u062a\u0628\u0627\u0637 \u06a9\u06cc \u067e\u06cc\u062f\u0627\u0648\u0627\u0631 \u0627\u06cc\u06a9 \u0679\u0627\u0626\u0645 \u0644\u0627\u0626\u0646 \u06a9\u0648 \u0638\u0627\u06c1\u0631 \u06a9\u0631\u062a\u06cc \u06c1\u06d2\u06d4 <code>email_send_attempt<\/code> \u067e\u06be\u0631 \u0633\u06cc\u062f\u06be\u06d2 \u0627\u0646\u062f\u0631 \u06a9\u0648\u062f\u06cc\u06ba\u06d4 <code>payment_complete<\/code> \u062f\u0631\u0645\u06cc\u0627\u0646 \u0645\u06cc\u06ba \u06a9\u0686\u06be \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4 \u06a9\u0648\u0626\u06cc \u063a\u0644\u0637\u06cc \u0646\u06c1\u06cc\u06ba\u060c \u06a9\u0648\u0626\u06cc \u0646\u0627\u06a9\u0627\u0645\u06cc\u060c \u06a9\u0648\u0626\u06cc \u062e\u0644\u0627 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4 \u0627\u06cc\u0633\u0627 \u0644\u06af\u062a\u0627 \u06c1\u06d2 \u06a9\u06c1 \u0633\u0628 \u06a9\u0686\u06be \u06a9\u0627\u0645 \u06a9\u0631 \u06af\u06cc\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u06cc\u06c1\u0627\u06ba \u0627\u0635\u0644\u0627\u062d\u0627\u062a \u06c1\u06cc\u06ba: <code>02-log-correlation\/services\/notification\/main.py<\/code>. \u0679\u0648\u0679\u0627 \u06c1\u0648\u0627 \u0627\u06cc\u0631\u0631 \u06c1\u06cc\u0646\u0688\u0644\u0631 \u06cc\u06c1 \u06c1\u06d2:<\/p>\n<pre><code class=\"language-python\">except httpx.TimeoutException:\n    emit_plain(f\"Connection timeout to email provider {EMAIL_PROVIDER_URL}\")\n    return {\"status\": \"ok\"}\n<\/code><\/pre>\n<p>\u0627\u0648\u0631 \u06cc\u06c1\u0627\u06ba \u062a\u0631\u0645\u06cc\u0645 \u0634\u062f\u06c1 \u0648\u0631\u0698\u0646 \u06c1\u06d2\u06d4 \u0635\u0631\u0641 \u062a\u0628\u062f\u06cc\u0644\u06cc \u06af\u0632\u0631 \u0631\u06c1\u06cc \u06c1\u06d2\u06d4 <code>req.trace_id<\/code> ~ \u0645\u06cc\u06ba <code>emit<\/code> \u06a9\u0627\u0644 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0628\u062c\u0627\u0626\u06d2 <code>emit_plain<\/code>:<\/p>\n<pre><code class=\"language-python\">except httpx.TimeoutException:\n    emit(req.trace_id, \"email_timeout\", level=\"ERROR\",\n         provider=EMAIL_PROVIDER_URL)\n    return {\"status\": \"ok\"}\n<\/code><\/pre>\n<p>\u062c\u0628 \u06a9\u0648\u0626\u06cc \u062a\u0628\u062f\u06cc\u0644\u06cc \u06a9\u06cc \u062c\u0627\u0626\u06d2 \u06af\u06cc\u060c \u0679\u0627\u0626\u0645 \u0622\u0624\u0679 \u0627\u06cc\u0631\u0631 \u0628\u0627\u0642\u06cc \u0633\u0628 \u06a9\u06cc \u0637\u0631\u062d \u0679\u0627\u0626\u0645 \u0644\u0627\u0626\u0646 \u067e\u0631 \u0638\u0627\u06c1\u0631 \u06c1\u0648\u06af\u0627\u06d4<\/p>\n<pre><code class=\"language-plaintext\">  [2026-05-15T21:59:00.681583+00:00] [NOTIFICATION] [ERROR] email_timeout\n    provider: http:\/\/mock-email:80\/\n<\/code><\/pre>\n<p>\u0627\u06cc\u06a9 \u06a9\u0645\u0627\u0646\u0688\u060c \u0627\u06cc\u06a9 \u0679\u0631\u06cc\u06a9\u0646\u06af \u0622\u0626\u06cc \u0688\u06cc\u060c \u067e\u0648\u0631\u06cc \u062a\u0635\u0648\u06cc\u0631\u06d4<\/p>\n<h3 id=\"heading-the-decision-the-script-cant-make-for-you\">\u0648\u06c1 \u0641\u06cc\u0635\u0644\u06d2 \u062c\u0648 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0646\u06c1\u06cc\u06ba \u06a9\u0631 \u0633\u06a9\u062a\u0627<\/h3>\n<p>\u0627\u0631\u062a\u0628\u0627\u0637 \u06a9\u0627 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0627\u0637\u0644\u0627\u0639\u0627\u062a \u06a9\u0648 \u062e\u0627\u0644\u06cc \u06a9\u06d2 \u0637\u0648\u0631 \u067e\u0631 \u0634\u0646\u0627\u062e\u062a \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u0627\u06af\u0631 \u0622\u067e \u0627\u0635\u0644 \u0645\u062a\u0646 \u06a9\u0648 \u0686\u06cc\u06a9 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u060c <code>notification.log<\/code>\u062f\u0631\u062e\u0648\u0627\u0633\u062a \u0633\u0631\u0648\u0633 \u062a\u06a9 \u067e\u06c1\u0646\u0686 \u06af\u0626\u06cc \u0627\u0648\u0631 \u062a\u0635\u062f\u06cc\u0642 \u0627\u0648\u0631 \u0644\u06cc\u0646 \u062f\u06cc\u0646 \u062f\u0648\u0646\u0648\u06ba \u06a9\u06cc \u0631\u06cc\u06a9\u0627\u0631\u0688\u0646\u06af \u06a9\u0627\u0645\u06cc\u0627\u0628 \u0631\u06c1\u06cc\u060c \u0644\u06cc\u06a9\u0646 \u0645\u062c\u06be\u06d2 \u0627\u06cc\u06a9 \u0633\u0627\u062f\u06c1 \u0679\u06cc\u06a9\u0633\u0679 \u0679\u0627\u0626\u0645 \u0622\u0624\u0679 \u0627\u06cc\u0631\u0631 \u0645\u0644\u0627 \u062c\u0633 \u0645\u06cc\u06ba \u0628\u062a\u0627\u06cc\u0627 \u06af\u06cc\u0627 \u06a9\u06c1 \u0627\u06cc \u0645\u06cc\u0644 \u0646\u0627\u06a9\u0627\u0645 \u06c1\u0648 \u06af\u0626\u06cc\u06d4<\/p>\n<p>\u0622\u06cc\u0627 \u0646\u0648\u0679\u06cc\u0641\u06a9\u06cc\u0634\u0646 \u06a9\u06cc \u0646\u0627\u06a9\u0627\u0645\u06cc \u0627\u062f\u0627\u0626\u06cc\u06af\u06cc \u06a9\u06cc \u0646\u0627\u06a9\u0627\u0645\u06cc \u06a9\u0627 \u0645\u06a9\u0645\u0644 \u0627\u0646\u062d\u0635\u0627\u0631 \u0627\u0633 \u0628\u0627\u062a \u067e\u0631 \u06c1\u06d2 \u06a9\u06c1 \u0633\u0633\u0679\u0645 \u06a9\u0648 \u06a9\u0633 \u0637\u0631\u062d \u0688\u06cc\u0632\u0627\u0626\u0646 \u06a9\u06cc\u0627 \u06af\u06cc\u0627 \u06c1\u06d2\u06d4 \u0627\u06af\u0631 \u0646\u0648\u0679\u06cc\u0641\u06a9\u06cc\u0634\u0646 \u0646\u0631\u0645 \u0627\u0646\u062d\u0635\u0627\u0631 \u06c1\u06d2\u060c \u062a\u0648 \u0627\u0633 \u063a\u0644\u0637\u06cc \u06a9\u0648 \u0635\u0627\u0631\u0641 \u06a9\u0648 \u0627\u062f\u0627\u0626\u06cc\u06af\u06cc \u06a9\u06cc \u0646\u0627\u06a9\u0627\u0645\u06cc \u06a9\u06d2 \u0637\u0648\u0631 \u067e\u0631 \u0646\u06c1\u06cc\u06ba \u062f\u06a9\u06be\u0627\u06cc\u0627 \u062c\u0627\u0646\u0627 \u0686\u0627\u06c1\u06cc\u06d2\u060c \u0644\u06cc\u06a9\u0646 \u0633\u0633\u0679\u0645 \u06a9\u06d2 \u0688\u06cc\u0632\u0627\u0626\u0646 \u0645\u06cc\u06ba \u06a9\u0686\u06be \u0627\u0648\u0631 \u063a\u0644\u0637 \u06c1\u06d2\u06d4 \u0627\u06af\u0631 \u06cc\u06c1 \u0627\u06cc\u06a9 \u0633\u062e\u062a \u0627\u0646\u062d\u0635\u0627\u0631 \u06c1\u06d2\u060c \u062a\u0648 \u0644\u06cc\u0646 \u062f\u06cc\u0646 \u06a9\u0648 \u062e\u0648\u062f \u06c1\u06cc \u0648\u0627\u067e\u0633 \u06a9\u0631 \u062f\u06cc\u0646\u0627 \u0686\u0627\u06c1\u06cc\u06d2\u06d4 \u0627\u0633\u06a9\u0631\u067e\u0679 \u06a9\u0648 \u067e\u062a\u06c1 \u0686\u0644 \u062c\u0627\u0626\u06d2 \u06af\u0627 \u06a9\u06c1 \u0645\u0633\u0626\u0644\u06c1 \u06a9\u06c1\u0627\u06ba \u06c1\u06d2\u060c \u0644\u06cc\u06a9\u0646 \u062f\u0631\u0633\u062a \u062c\u0648\u0627\u0628 \u0622\u067e \u06a9\u06d2 \u0688\u06cc\u0632\u0627\u0626\u0646 \u067e\u0631 \u0645\u0646\u062d\u0635\u0631 \u06c1\u0648\u06af\u0627\u06d4<\/p>\n<h3 id=\"heading-break-it-on-purpose\">\u062c\u0627\u0646 \u0628\u0648\u062c\u06be \u06a9\u0631 \u062a\u0648\u0691 \u062f\u0648<\/h3>\n<ol>\n<li>\n<p>\u0686\u0644\u0627\u0626\u06cc\u06ba <code>.\/break_it.sh<\/code> &#8211; \u0646\u0648\u0679\u06cc\u0641\u06a9\u06cc\u0634\u0646 \u0633\u0631\u0648\u0633 \u06a9\u0648 \u0627\u06cc\u06a9 \u0645\u0648\u0688 \u0645\u06cc\u06ba \u0631\u06a9\u06be\u06cc\u06ba \u062c\u06c1\u0627\u06ba \u0627\u06cc\u0631\u0631 \u06c1\u06cc\u0646\u0688\u0644\u0631 \u0679\u0631\u06cc\u06a9\u0646\u06af \u0622\u0626\u06cc \u0688\u06cc \u06a9\u0648 \u0636\u0627\u0626\u0639 \u06a9\u0631 \u062f\u06cc\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<\/li>\n<li>\n<p>\u0686\u0644\u0627\u0626\u06cc\u06ba <code>.\/trigger_request.sh<\/code> \u0646\u0626\u06cc \u0627\u062f\u0627\u0626\u06cc\u06af\u06cc \u06a9\u06cc \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u0628\u0646\u0627\u0646\u06d2 \u0627\u0648\u0631 \u0627\u06cc\u06a9 \u0646\u06cc\u0627 \u0679\u0631\u06cc\u06a9\u0646\u06af ID \u062d\u0627\u0635\u0644 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2<\/p>\n<\/li>\n<li>\n<p>\u0686\u0644\u0627\u0626\u06cc\u06ba <code>python correlate.py <new trace=\"\" id=\"\"\/><\/code> &#8211; \u0679\u0627\u0626\u0645 \u0644\u0627\u0626\u0646 \u0633\u06d2 \u0627\u0637\u0644\u0627\u0639\u0627\u062a \u063a\u0627\u0626\u0628 \u06c1\u06cc\u06ba\u06d4<\/p>\n<\/li>\n<li>\n<p>\u0686\u0644\u0627\u0626\u06cc\u06ba <code>cat logs\/notification.log<\/code> &#8211; \u0679\u0627\u0626\u0645 \u0622\u0624\u0679 \u06a9\u06cc \u063a\u0644\u0637\u06cc\u0627\u06ba \u0628\u0631\u0627\u06c1 \u0631\u0627\u0633\u062a \u0627\u0633\u06a9\u0631\u067e\u0679 \u0645\u06cc\u06ba \u0679\u0631\u06cc\u06a9\u0646\u06af ID \u06a9\u06d2 \u0628\u063a\u06cc\u0631 \u06c1\u0648\u062a\u06cc \u06c1\u06cc\u06ba\u06d4<\/p>\n<\/li>\n<\/ol>\n<h2 id=\"heading-use-case-3-infrastructure-drift-detection\">\u06a9\u06cc\u0633 3 \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u06cc\u06ba &#8211; \u0627\u0646\u0641\u0631\u0627\u0633\u0679\u0631\u06a9\u0686\u0631 \u0688\u0631\u0641\u0679 \u06a9\u0627 \u067e\u062a\u06c1 \u0644\u06af\u0627\u0646\u0627<\/h2>\n<p><strong>\u0645\u0627\u062d\u0648\u0644:<\/strong> AWS \u0641\u0631\u06cc \u0679\u0627\u0626\u0631 (1 \u0633\u06cc\u06a9\u06cc\u0648\u0631\u0679\u06cc \u06af\u0631\u0648\u067e) + \u0679\u06cc\u0631\u0627\u0641\u0627\u0631\u0645<br \/><strong>\u0632\u0628\u0627\u0646:<\/strong> \u0627\u0632\u06af\u0631<\/p>\n<h3 id=\"heading-the-production-problem\">\u067e\u06cc\u062f\u0627\u0648\u0627\u0631 \u06a9\u06d2 \u0645\u0633\u0627\u0626\u0644<\/h3>\n<p>\u0645\u062c\u06be\u06d2 \u0627\u067e\u0646\u06d2 Terraform \u067e\u0644\u0627\u0646 \u0645\u06cc\u06ba \u06a9\u0648\u0626\u06cc \u062a\u0628\u062f\u06cc\u0644\u06cc \u0646\u0638\u0631 \u0646\u06c1\u06cc\u06ba \u0622 \u0631\u06c1\u06cc \u06c1\u06d2\u06d4 \u062a\u0639\u06cc\u0646\u0627\u062a\u06cc\u0627\u06ba \u06a9\u0644 \u06a9\u06cc \u0646\u0633\u0628\u062a \u0645\u062e\u062a\u0644\u0641 \u0637\u0631\u06cc\u0642\u06d2 \u0633\u06d2 \u06a9\u0627\u0645 \u06a9\u0631 \u0631\u06c1\u06cc \u06c1\u06cc\u06ba\u060c \u0627\u0648\u0631 \u0627\u06af\u0631 \u0622\u067e \u0622\u0633 \u067e\u0627\u0633 \u0633\u06d2 \u067e\u0648\u0686\u06be\u06cc\u06ba \u06af\u06d2\u060c \u062a\u0648 \u0622\u062e\u0631\u06a9\u0627\u0631 \u06a9\u0648\u0626\u06cc \u06cc\u0627\u062f \u06a9\u0631\u06d2 \u06af\u0627\u06d4 \u0627\u06cc\u06a9 \u0633\u0627\u062a\u06be\u06cc \u06a9\u0627\u0631\u06a9\u0646 \u0646\u06d2 \u0627\u0633\u0679\u06cc\u062c\u0646\u06af \u0679\u06cc\u0633\u0679\u0648\u06ba \u06a9\u0648 \u063a\u06cc\u0631 \u0645\u0633\u062f\u0648\u062f \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u067e\u0686\u06be\u0644\u06d2 \u06c1\u0641\u062a\u06d2 AWS \u06a9\u0646\u0633\u0648\u0644 \u0645\u06cc\u06ba \u0633\u06cc\u06a9\u06cc\u0648\u0631\u0679\u06cc \u06af\u0631\u0648\u067e \u0645\u06cc\u06ba \u0641\u0648\u0631\u06cc \u062f\u0633\u062a\u06cc \u062a\u0628\u062f\u06cc\u0644\u06cc \u06a9\u06cc\u06d4 \u0627\u0646\u06c1\u0648\u06ba \u0646\u06d2 \u0648\u0627\u067e\u0633 \u062c\u0627\u0646\u06d2 \u0627\u0648\u0631 \u0679\u06cc\u0631\u0627\u0641\u0627\u0631\u0645 \u06a9\u06d2 \u0630\u0631\u06cc\u0639\u06d2 \u0627\u0633\u06d2 \u0644\u0627\u06af\u0648 \u06a9\u0631\u0646\u06d2 \u06a9\u06cc \u06a9\u0648\u0634\u0634 \u06a9\u06cc\u060c \u0644\u06cc\u06a9\u0646 \u0627\u0633 \u06a9\u06d2 \u0628\u0627\u0631\u06d2 \u0645\u06cc\u06ba \u0628\u06be\u0648\u0644 \u06af\u0626\u06d2\u06d4<\/p>\n<p>\u0679\u06cc\u0631\u0627\u0641\u0627\u0631\u0645 \u0627\u0633\u0679\u06cc\u0679 \u0641\u0627\u0626\u0644\u0632 \u0627\u0648\u0631 \u0627\u0635\u0644 AWS \u0627\u0646\u0641\u0631\u0627\u0633\u0679\u0631\u06a9\u0686\u0631 \u062a\u0628 \u0633\u06d2 \u062e\u0627\u0645\u0648\u0634\u06cc \u0633\u06d2 \u0645\u062a\u0641\u0642 \u0646\u06c1\u06cc\u06ba \u06c1\u06cc\u06ba\u06d4 \u06cc\u06c1 \u0632\u0648\u0631 \u0633\u06d2 \u0646\u06c1\u06cc\u06ba \u0679\u0648\u0679\u062a\u0627 \u0627\u0648\u0631 \u0646\u06c1 \u06c1\u06cc \u0627\u0644\u0627\u0631\u0645 \u06a9\u0627 \u0633\u0628\u0628 \u0628\u0646\u062a\u0627 \u06c1\u06d2\u06d4 \u0679\u06cc\u0631\u0627\u0641\u0627\u0631\u0645 \u06a9\u0648 \u0627\u0633 \u0648\u0642\u062a \u062a\u06a9 \u0645\u0639\u0644\u0648\u0645 \u0646\u06c1\u06cc\u06ba \u06c1\u0648\u06af\u0627 \u062c\u0628 \u062a\u06a9 \u06a9\u06c1 \u06a9\u0648\u0626\u06cc \u0627\u0633\u06d2 \u0646\u06c1 \u0686\u0644\u0627\u0626\u06d2\u06d4 <code>terraform plan<\/code> \u0645\u06cc\u06ba \u0646\u06d2 \u0686\u06cc\u06a9 \u06a9\u06cc\u0627\u060c \u0644\u06cc\u06a9\u0646 \u0627\u0633 \u0645\u0646\u0638\u0631 \u0646\u0627\u0645\u06d2 \u0645\u06cc\u06ba \u06a9\u0633\u06cc \u0646\u06d2 \u0646\u06c1\u06cc\u06ba \u06a9\u06cc\u0627\u06d4<\/p>\n<p>\u0627\u0633\u06d2 \u0627\u0646\u0641\u0631\u0627\u0633\u0679\u0631\u06a9\u0686\u0631 \u0688\u0631\u0641\u0679 \u06a9\u06c1\u0627 \u062c\u0627\u062a\u0627 \u06c1\u06d2\u060c \u0627\u0648\u0631 \u06cc\u06c1 \u0627\u0633 \u0633\u06d2 \u06a9\u06c1\u06cc\u06ba \u0632\u06cc\u0627\u062f\u06c1 \u0639\u0627\u0645 \u06c1\u06d2 \u062c\u062a\u0646\u0627 \u06a9\u06c1 \u0632\u06cc\u0627\u062f\u06c1 \u062a\u0631 \u0679\u06cc\u0645\u06cc\u06ba \u062a\u0633\u0644\u06cc\u0645 \u06a9\u0631\u062a\u06cc \u06c1\u06cc\u06ba\u06d4<\/p>\n<h3 id=\"heading-whats-actually-happening-at-the-system-level\">\u0646\u0638\u0627\u0645 \u06a9\u06cc \u0633\u0637\u062d \u067e\u0631 \u0627\u0635\u0644 \u0645\u06cc\u06ba \u06a9\u06cc\u0627 \u06c1\u0648 \u0631\u06c1\u0627 \u06c1\u06d2\u061f<\/h3>\n<p><strong>\u06cc\u06c1 \u06a9\u06cc\u0627 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2:<\/strong> \u06cc\u06c1 \u0628\u06be\u0627\u06af\u0646\u06d2 \u06a9\u06cc \u0637\u0631\u062d \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4 <code>terraform plan<\/code>. \u0645\u0646\u0635\u0648\u0628\u06c1 \u0638\u0627\u06c1\u0631 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u06a9\u06c1 Terraform \u06a9\u06cc\u0627 \u06c1\u06d2\u06d4 <em>\u06c1\u0648 \u062c\u0627\u0626\u06d2 \u06af\u0627<\/em> \u062a\u0628\u062f\u06cc\u0644\u06cc \u06cc\u06c1 \u0627\u0633\u06a9\u0631\u067e\u0679 \u062f\u06a9\u06be\u0627\u062a\u0627 \u06c1\u06d2\u06d4 <em>\u067e\u06c1\u0644\u06d2 \u06c1\u06cc<\/em> AWS \u0645\u06cc\u06ba Terraform \u06a9\u0648 \u062c\u0627\u0646\u06d2 \u0628\u063a\u06cc\u0631 \u062a\u0628\u062f\u06cc\u0644\u06cc \u06a9\u06cc \u06af\u0626\u06cc\u06d4<\/p>\n<p>\u0627\u0633\u06a9\u0631\u067e\u0679 \u062e\u0648\u062f \u0679\u06cc\u0631\u0627\u0641\u0627\u0631\u0645 \u06a9\u0645\u0627\u0646\u0688\u0632 \u0646\u06c1\u06cc\u06ba \u0686\u0644\u0627\u062a\u06cc \u06c1\u06d2\u06d4 \u067e\u06c1\u0644\u06d2 \u0633\u06d2 \u062a\u06cc\u0627\u0631 \u06a9\u0631\u062f\u06c1 \u0679\u06cc\u0631\u0627\u0641\u0627\u0631\u0645 \u0627\u0633\u0679\u06cc\u0679 \u0641\u0627\u0626\u0644 \u06a9\u0648 \u067e\u0691\u06be\u06cc\u06ba\u06d4 \u0688\u06cc\u0645\u0648 \u0645\u06cc\u06ba\u060c Terraform \u0627\u0633 \u0641\u0627\u0626\u0644 \u06a9\u0648 \u062a\u062e\u0644\u06cc\u0642 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u062d\u0642\u06cc\u0642\u06cc \u062f\u0646\u06cc\u0627 \u0645\u06cc\u06ba\u060c \u06cc\u06c1 \u067e\u06c1\u0644\u06d2 \u0633\u06d2 \u06c1\u06cc \u0639\u0627\u0645 \u06a9\u0627\u0645 \u06a9\u06d2 \u0628\u06c1\u0627\u0624 \u0645\u06cc\u06ba \u0645\u0648\u062c\u0648\u062f \u06c1\u06d2\u06d4<\/p>\n<p>\u0679\u06cc\u0631\u0627\u0641\u0627\u0631\u0645 \u06a9\u06cc \u0627\u0633\u0679\u06cc\u0679 \u0641\u0627\u0626\u0644 \u06a9\u0648 \u0627\u06cc\u06a9 \u0631\u0633\u06cc\u062f \u06a9\u06d2 \u0637\u0648\u0631 \u067e\u0631 \u0633\u0648\u0686\u06cc\u06ba\u06d4 Terraform \u0628\u0627\u0644\u06a9\u0644 \u0648\u06c1\u06cc \u0686\u06cc\u0632 \u0631\u06cc\u06a9\u0627\u0631\u0688 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u062c\u0628 \u0622\u067e \u0633\u06cc\u06a9\u06cc\u0648\u0631\u0679\u06cc \u06af\u0631\u0648\u067e \u0628\u0646\u0627\u062a\u06d2 \u06c1\u06cc\u06ba: \u0642\u0648\u0627\u0639\u062f\u060c \u0628\u0646\u062f\u0631\u06af\u0627\u06c1\u06cc\u06ba\u060c \u0627\u0648\u0631 CIDRs\u06d4 \u0648\u06c1 \u0631\u0633\u06cc\u062f \u0622\u067e \u06a9\u06cc \u0627\u0633\u0679\u06cc\u0679 \u0641\u0627\u0626\u0644 \u06c1\u06d2\u06d4<\/p>\n<p>\u0627\u0633\u06a9\u0631\u067e\u0679 \u0627\u0633 \u0631\u0633\u06cc\u062f \u06a9\u0627 \u0627\u0633 \u0631\u0633\u06cc\u062f \u0633\u06d2 \u0645\u0648\u0627\u0632\u0646\u06c1 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u062c\u0648 \u0627\u0635\u0644 \u0645\u06cc\u06ba AWS \u06a9\u06d2 \u067e\u0627\u0633 \u06c1\u06d2\u06d4 \u0627\u06af\u0631 \u06a9\u0648\u0626\u06cc AWS \u06a9\u0646\u0633\u0648\u0644 \u067e\u0631 \u062c\u0627\u062a\u0627 \u06c1\u06d2 \u0627\u0648\u0631 \u06a9\u0648\u0626\u06cc \u0627\u06cc\u0633\u0627 \u0642\u0627\u0639\u062f\u06c1 \u0634\u0627\u0645\u0644 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u062c\u0648 \u0631\u0633\u06cc\u062f \u0645\u06cc\u06ba \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u060c \u062a\u0648 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0627\u0633\u06d2 \u0628\u0691\u06be\u06d2 \u06c1\u0648\u0626\u06d2 \u06a9\u06d2 \u0637\u0648\u0631 \u067e\u0631 \u0646\u0634\u0627\u0646 \u0632\u062f \u06a9\u0631\u06d2 \u06af\u0627\u06d4<\/p>\n<p>\u0628\u0644\u0627\u0626\u0646\u0688 \u0627\u0633\u067e\u0627\u0679 \u06cc\u06c1 \u06c1\u06d2 \u06a9\u06c1 \u0627\u06af\u0631 \u06a9\u0648\u0626\u06cc \u06a9\u0646\u0633\u0648\u0644 \u0645\u06cc\u06ba \u0628\u0627\u0644\u06a9\u0644 \u0646\u06cc\u0627 \u0633\u06cc\u06a9\u06cc\u0648\u0631\u0679\u06cc \u06af\u0631\u0648\u067e \u0628\u0646\u0627\u062a\u0627 \u06c1\u06d2 \u0627\u0648\u0631 Terraform \u06a9\u0648 \u0628\u0627\u0644\u06a9\u0644 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u0646\u06c1\u06cc\u06ba \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u062a\u0648 \u0627\u0633 \u06a9\u06cc \u06a9\u0648\u0626\u06cc \u0631\u0633\u06cc\u062f \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4 \u0627\u0633\u06a9\u0631\u067e\u0679 \u06a9\u0627 \u0645\u0648\u0627\u0632\u0646\u06c1 \u06a9\u0633\u06cc \u0627\u06cc\u0633\u06cc \u0686\u06cc\u0632 \u0633\u06d2 \u0646\u06c1\u06cc\u06ba \u06a9\u06cc\u0627 \u062c\u0627 \u0633\u06a9\u062a\u0627 \u062c\u0633\u06d2 \u0622\u067e \u0646\u06d2 \u06a9\u0628\u06be\u06cc \u0646\u06c1\u06cc\u06ba \u062f\u06cc\u06a9\u06be\u0627\u06d4 \u06cc\u06c1 \u0635\u0627\u0641 \u0637\u0648\u0631 \u067e\u0631 \u0648\u0627\u067e\u0633 \u0622\u062a\u0627 \u06c1\u06d2 \u0627\u0648\u0631 \u06af\u0631\u0648\u067e \u0622\u067e \u06a9\u06d2 \u0627\u06a9\u0627\u0624\u0646\u0679 \u0645\u06cc\u06ba \u0646\u06c1\u06cc\u06ba \u067e\u0627\u06cc\u0627 \u062c\u0627\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u0688\u06cc\u0645\u0648 \u062f\u0648\u0646\u0648\u06ba \u06a9\u0648 \u062f\u06a9\u06be\u0627\u062a\u0627 \u06c1\u06d2\u06d4 \u067e\u06c1\u0644\u06d2\u060c \u0645\u0639\u0644\u0648\u0645 \u0648\u0633\u0627\u0626\u0644 \u06a9\u0648 \u0631\u0648\u06a9\u06cc\u06ba\u06d4 \u067e\u06be\u0631 <code>--invisible<\/code> \u0645\u0646\u0638\u0631 \u0646\u0627\u0645\u06c1 Terraform \u06a9\u06d2 \u0628\u0627\u06c1\u0631 \u06a9\u0686\u06be \u0628\u0627\u0644\u06a9\u0644 \u0646\u06cc\u0627 \u0628\u0646\u0627\u062a\u0627 \u06c1\u06d2\u060c \u0627\u0648\u0631 \u0627\u0628 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0635\u0627\u0641 \u0637\u0648\u0631 \u067e\u0631 \u0648\u0627\u067e\u0633 \u0622\u062a\u0627 \u06c1\u06d2 \u0686\u0627\u06c1\u06d2 \u0627\u06a9\u0627\u0624\u0646\u0679 \u0645\u06cc\u06ba \u0627\u0636\u0627\u0641\u06cc \u0633\u06cc\u06a9\u06cc\u0648\u0631\u0679\u06cc \u06af\u0631\u0648\u067e \u0645\u0648\u062c\u0648\u062f \u06c1\u0648\u06ba\u06d4<\/p>\n<h3 id=\"heading-set-up-the-demo-environment\">\u0688\u06cc\u0645\u0648 \u06a9\u06cc \u062a\u0631\u062a\u06cc\u0628\u0627\u062a<\/h3>\n<p>\u0627\u06af\u0644\u06d2 \u067e\u0631 \u062c\u0627\u0626\u06cc\u06ba\u06d4 <code>03-drift-detection\/<\/code> \u0633\u0627\u062a\u06be\u06cc \u0630\u062e\u06cc\u0631\u06c1 \u0633\u06d2:<\/p>\n<pre><code class=\"language-plaintext\">cd 03-drift-detection\npip install -r requirements.txt\n<\/code><\/pre>\n<p>\u062a\u0631\u062a\u06cc\u0628\u0627\u062a \u0686\u0644\u0627\u0626\u06cc\u06ba\u06d4 \u06cc\u06c1 \u062d\u0642\u06cc\u0642\u06cc Terraform \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u060c \u0627\u06cc\u06a9 \u0645\u0630\u0627\u0642 \u0646\u06c1\u06cc\u06ba.<\/p>\n<pre><code class=\"language-plaintext\">.\/setup.sh\n<\/code><\/pre>\n<p>\u06cc\u06c1 \u0686\u0644\u062a\u0627 \u06c1\u06d2\u06d4 <code>terraform init<\/code> \u0627\u0648\u0631 <code>terraform apply<\/code>\u0627\u06cc\u06a9 \u062d\u0642\u06cc\u0642\u06cc AWS \u0633\u06cc\u06a9\u06cc\u0648\u0631\u0679\u06cc \u06af\u0631\u0648\u067e \u0628\u0646\u0627\u0626\u06cc\u06ba\u06d4<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/umang.pk\/wp-content\/uploads\/2026\/05\/1779904521_398_\u0631\u06cc\u0626\u0644-\u0648\u0631\u0644\u0688-\u0688\u06cc-\u0627\u0648-\u0627\u0648\u067e\u0633-\u0622\u0679\u0648\u0645\u06cc\u0634\u0646-\u06a9\u06d2-\u0644\u06cc\u06d2-\u0628\u0627\u0634-\u0627\u0648\u0631.png\" alt=\"AWS \u0688\u06cc\u0634 \u0628\u0648\u0631\u0688 \u0627\u0633\u06a9\u0631\u06cc\u0646 \u0634\u0627\u0679 \u0628\u0646\u0627\u06cc\u0627 \u06af\u06cc\u0627 \u0633\u06cc\u06a9\u06cc\u0648\u0631\u0679\u06cc \u06af\u0631\u0648\u067e \u062f\u06a9\u06be\u0627 \u0631\u06c1\u0627 \u06c1\u06d2\u06d4\" style=\"display:block;margin:0 auto\" width=\"600\" height=\"400\" loading=\"lazy\" title=\"\"><\/p>\n<p>\u0645\u06cc\u06ba \u062d\u0642\u06cc\u0642\u06cc \u0645\u0635\u0646\u0648\u0639\u0627\u062a \u0628\u06be\u06cc \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u0627 \u06c1\u0648\u06ba\u06d4 <code>terraform.tfstate<\/code> \u0641\u0627\u0626\u0644 \u06cc\u06c1 \u062f\u06cc\u06a9\u06be\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u06a9\u06c1 Terraform \u0627\u0635\u0644 \u0645\u06cc\u06ba \u06a9\u06cc\u0627 \u067e\u06cc\u062f\u0627 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u060c \u0627\u0633\u06d2 \u0679\u06cc\u06a9\u0633\u0679 \u0627\u06cc\u0688\u06cc\u0679\u0631 \u0645\u06cc\u06ba \u06a9\u06be\u0648\u0644\u06cc\u06ba\u06d4 \u06cc\u06c1 JSON \u06c1\u06d2\u060c \u06cc\u06c1 \u067e\u0691\u06be\u0646\u06d2 \u06a9\u06d2 \u0642\u0627\u0628\u0644 \u06c1\u06d2\u060c \u0627\u0648\u0631 \u06cc\u06c1 \u062d\u0642\u06cc\u0642\u06cc \u06c1\u06d2\u06d4<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/umang.pk\/wp-content\/uploads\/2026\/05\/1779904521_19_\u0631\u06cc\u0626\u0644-\u0648\u0631\u0644\u0688-\u0688\u06cc-\u0627\u0648-\u0627\u0648\u067e\u0633-\u0622\u0679\u0648\u0645\u06cc\u0634\u0646-\u06a9\u06d2-\u0644\u06cc\u06d2-\u0628\u0627\u0634-\u0627\u0648\u0631.png\" alt=\"IDE \u0641\u0648\u0644\u0688\u0631 \u06a9\u06d2 \u0688\u06be\u0627\u0646\u0686\u06d2 \u06a9\u0627 \u0627\u0633\u06a9\u0631\u06cc\u0646 \u0634\u0627\u0679 \u062c\u0633 \u0645\u06cc\u06ba \u062f\u06a9\u06be\u0627\u06cc\u0627 \u062c\u0627 \u0631\u06c1\u0627 \u06c1\u06d2 \u06a9\u06c1 terraform.tfstate \u0641\u0627\u0626\u0644 \u0628\u0646\u0627\u0626\u06cc \u062c\u0627 \u0631\u06c1\u06cc \u06c1\u06d2\u06d4\" style=\"display:block;margin:0 auto\" width=\"600\" height=\"400\" loading=\"lazy\" title=\"\"><\/p>\n<p>\u0633\u06cc\u0679 \u0627\u067e \u0645\u06a9\u0645\u0644 \u06c1\u0648\u0646\u06d2 \u06a9\u06d2 \u0628\u0639\u062f\u060c \u0627\u0633\u06a9\u0631\u067e\u0679 \u06a9\u0648 \u0686\u0644\u0627\u0626\u06cc\u06ba\u06d4<\/p>\n<pre><code class=\"language-plaintext\">python detect_drift.py terraform.tfstate\n<\/code><\/pre>\n<p>\u0622\u067e \u06a9\u0648 \u062f\u0631\u062c \u0630\u06cc\u0644 \u06a9\u06cc \u0637\u0631\u062d \u06a9\u0686\u06be \u0646\u0638\u0631 \u0622\u0626\u06d2 \u06af\u0627\u060c \u0644\u06cc\u06a9\u0646 \u0627\u0635\u0644 \u0633\u06cc\u06a9\u0648\u0631\u0679\u06cc \u06af\u0631\u0648\u067e ID \u0645\u062e\u062a\u0644\u0641 \u06c1\u06d2:<\/p>\n<pre><code class=\"language-plaintext\">Loading Terraform state from: terraform.tfstate\n\nChecking: sg-0a1b2c3d4e5f6a7b8\n\n  OK - No drift detected.\n<\/code><\/pre>\n<p>\u0644\u06cc\u0628 \u0632\u0646\u062f\u06c1 \u06c1\u06d2 \u0627\u0648\u0631 \u0645\u0639\u0627\u06c1\u062f\u06d2 \u06a9\u06d2 \u062f\u0648\u0646\u0648\u06ba \u0641\u0631\u06cc\u0642 \u0645\u062a\u0641\u0642 \u06c1\u06cc\u06ba\u06d4 \u0627\u0628 \u062f\u06cc\u06a9\u06be\u062a\u06d2 \u06c1\u06cc\u06ba \u0627\u0633\u06a9\u0631\u067e\u0679 \u06a9\u06cc\u0627 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<h3 id=\"heading-the-script-code-files\">\u0627\u0633\u06a9\u0631\u067e\u0679 (\u06a9\u0648\u0688 \u0641\u0627\u0626\u0644)<\/h3>\n<pre><code class=\"language-python\"># detect_drift.py\nimport boto3\nimport json\nimport sys\n\n\ndef load_tfstate(path):\n    \"\"\"\n    The Terraform state file is plain JSON - open it in any text editor\n    and you will see a 'resources' array listing everything Terraform knows about.\n    This function reads that file and returns the parsed contents.\n    \"\"\"\n    with open(path) as f:\n        return json.load(f)\n\n\ndef get_security_groups_from_state(tfstate):\n    \"\"\"\n    Walk through the resources array and collect every security group entry.\n    Each resource has a 'type', a 'name', and an 'instances' array holding\n    the attribute values Terraform recorded when it last ran.\n    We extract the resource ID and the ingress (inbound) rules.\n    \"\"\"\n    resources = {}\n    for resource in tfstate.get(\"resources\", []):\n        if resource[\"type\"] == \"aws_security_group\":\n            for instance in resource.get(\"instances\", []):\n                sg_id = instance[\"attributes\"][\"id\"]\n                resources[sg_id] = {\n                    \"ingress\": instance[\"attributes\"].get(\"ingress\", [])\n                }\n    return resources\n\n\ndef get_security_group_from_aws(sg_id):\n    \"\"\"\n    Call the AWS EC2 API to fetch the live current state of this security group.\n    Under the hood, boto3 constructs an authenticated HTTPS request, signs it with\n    your AWS credentials, sends it to the EC2 API endpoint in your configured region,\n    and parses the response. The response contains far more data than we need -\n    we extract only the inbound rules.\n    \"\"\"\n    ec2 = boto3.client(\"ec2\")\n    response = ec2.describe_security_groups(GroupIds=[sg_id])\n    sg = response[\"SecurityGroups\"][0]\n    return {\"ingress\": sg.get(\"IpPermissions\", [])}\n\n\ndef normalize_state_rules(rules):\n    \"\"\"\n    Terraform stores ingress rules in its own format.\n    We normalize them into a set of tuples for easy comparison.\n    Each tuple is: (from_port, to_port, protocol, cidr_block)\n    \"\"\"\n    normalized = set()\n    for rule in rules:\n        for cidr in rule.get(\"cidr_blocks\", []):\n            normalized.add((\n                rule.get(\"from_port\", 0),\n                rule.get(\"to_port\", 0),\n                rule.get(\"protocol\", \"-1\"),\n                cidr\n            ))\n    return normalized\n\n\ndef normalize_aws_rules(rules):\n    \"\"\"\n    AWS returns ingress rules in a different format from Terraform's.\n    We normalize them into the same tuple shape so the comparison works.\n    \"\"\"\n    normalized = set()\n    for rule in rules:\n        from_port = rule.get(\"FromPort\", 0)\n        to_port = rule.get(\"ToPort\", 0)\n        protocol = rule.get(\"IpProtocol\", \"-1\")\n        for ip_range in rule.get(\"IpRanges\", []):\n            normalized.add((from_port, to_port, protocol, ip_range[\"CidrIp\"]))\n    return normalized\n\n\ndef detect_drift(tfstate_path):\n    print(f\"Loading Terraform state from: {tfstate_path}\")\n    tfstate = load_tfstate(tfstate_path)\n    state_sgs = get_security_groups_from_state(tfstate)\n\n    if not state_sgs:\n        print(\"No security groups found in state file. Nothing to compare.\")\n        return\n\n    drift_found = False\n\n    for sg_id, state_data in state_sgs.items():\n        print(f\"nChecking: {sg_id}\")\n\n        try:\n            aws_data = get_security_group_from_aws(sg_id)\n        except Exception as e:\n            print(f\"  ERROR: Could not fetch {sg_id} from AWS - {e}\")\n            print(f\"  Check your IAM permissions: ec2:DescribeSecurityGroups is required.\")\n            continue\n\n        state_rules = normalize_state_rules(state_data[\"ingress\"])\n        aws_rules = normalize_aws_rules(aws_data[\"ingress\"])\n\n        # Rules in AWS that Terraform does not know about (manual additions)\n        added_in_aws = aws_rules - state_rules\n        # Rules Terraform expects that no longer exist in AWS (manual deletions)\n        removed_from_aws = state_rules - aws_rules\n\n        if added_in_aws:\n            drift_found = True\n            print(\"  DRIFT - Rules present in AWS but missing from state file:\")\n            for rule in added_in_aws:\n                print(f\"    Port {rule[0]}-{rule[1]} | Protocol: {rule[2]} | CIDR: {rule[3]}\")\n\n        if removed_from_aws:\n            drift_found = True\n            print(\"  DRIFT - Rules in state file but removed from AWS:\")\n            for rule in removed_from_aws:\n                print(f\"    Port {rule[0]}-{rule[1]} | Protocol: {rule[2]} | CIDR: {rule[3]}\")\n\n        if not added_in_aws and not removed_from_aws:\n            print(\"  OK - No drift detected.\")\n\n    print(\"n\" + \"=\" * 60)\n    if drift_found:\n        print(\"Drift detected. See above for details.\")\n    else:\n        print(\"No drift detected in monitored resources.\")\n\n    print(\"nIMPORTANT: This script only checks resources tracked in your state file.\")\n    print(\"Resources created manually in AWS without Terraform are invisible to this check.\")\n    print(\"A clean output here does not mean your AWS account is clean - it means\")\n    print(\"the resources you are watching match what Terraform last recorded.\")\n\n\nif __name__ == \"__main__\":\n    tfstate_path = sys.argv[1] if len(sys.argv) > 1 else \"terraform.tfstate\"\n    detect_drift(tfstate_path)\n<\/code><\/pre>\n<h3 id=\"heading-how-the-script-works\">\u0627\u0633\u06a9\u0631\u067e\u0679 \u06a9\u06cc\u0633\u06d2 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/h3>\n<p><code>load_tfstate<\/code>    \u06a9\u06be\u0648\u0644\u062a\u0627 \u06c1\u06d2 <code>terraform.tfstate<\/code> \u0627\u0648\u0631 \u0627\u0633\u06d2 \u067e\u0691\u06be\u06cc\u06ba\u06d4 \u0686\u0644\u0627\u0626\u06cc\u06ba <code>cat terraform.tfstate<\/code> \u0633\u06cc\u0679 \u0627\u067e \u06a9\u06d2 \u0628\u0639\u062f\u060c \u0622\u067e \u062f\u06cc\u06a9\u06be\u06cc\u06ba \u06af\u06d2 \u06a9\u06c1 \u06cc\u06c1 \u0635\u0631\u0641 \u0627\u06cc\u06a9 \u0679\u06cc\u06a9\u0633\u0679 \u0641\u0627\u0626\u0644 \u06c1\u06d2 \u0627\u0648\u0631 \u062c\u0648 \u06a9\u0686\u06be Terraform \u0622\u067e \u06a9\u06d2 \u0627\u0646\u0641\u0631\u0627\u0633\u0679\u0631\u06a9\u0686\u0631 \u06a9\u06d2 \u0628\u0627\u0631\u06d2 \u0645\u06cc\u06ba \u062c\u0627\u0646\u062a\u0627 \u06c1\u06d2 \u0648\u06c1 \u06cc\u06c1\u0627\u06ba \u0645\u062d\u0641\u0648\u0638 \u06c1\u06d2\u06d4<\/p>\n<p><code>get_security_groups_from_state<\/code>    \u0627\u0633 \u0641\u0627\u0626\u0644 \u0633\u06d2\u060c \u06c1\u0645\u06cc\u06ba \u062a\u0645\u0627\u0645 \u0633\u06cc\u06a9\u06cc\u0648\u0631\u0679\u06cc \u06af\u0631\u0648\u067e\u0633\u060c AWS \u06a9\u06d2 \u0630\u0631\u06cc\u0639\u06d2 \u062a\u0641\u0648\u06cc\u0636 \u06a9\u0631\u062f\u06c1 IDs\u060c \u0627\u0648\u0631 Terraform \u06a9\u06d2 \u0644\u06a9\u06be\u06d2 \u06c1\u0648\u0626\u06d2 \u0622\u062e\u0631\u06cc \u0627\u0646 \u0628\u0627\u0624\u0646\u0688 \u0627\u0635\u0648\u0644 \u0645\u0644\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 \u0645\u062a\u0648\u0642\u0639 \u0642\u062f\u0631\u06cc\u06ba \u06c1\u06cc\u06ba:<\/p>\n<p><code>get_security_group_from_aws<\/code>    AWS API \u06a9\u0648 \u06a9\u0627\u0644 \u06a9\u0631\u06cc\u06ba \u0627\u0648\u0631 \u0627\u0633\u06cc \u0633\u06cc\u06a9\u06cc\u0648\u0631\u0679\u06cc \u06af\u0631\u0648\u067e \u06a9\u06d2 \u0644\u06cc\u06d2 \u0645\u0648\u062c\u0648\u062f\u06c1 \u0627\u0646 \u0628\u0627\u0624\u0646\u0688 \u0642\u0648\u0627\u0646\u06cc\u0646 \u062d\u0627\u0635\u0644 \u06a9\u0631\u06cc\u06ba\u06d4 \u06cc\u06c1 \u0627\u0635\u0644 \u0642\u062f\u0631 \u06c1\u06d2\u06d4 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0645\u06cc\u06ba \u0627\u0628 \u0627\u06cc\u06a9 \u06c1\u06cc \u0645\u0648\u0627\u062f \u06a9\u06d2 \u062f\u0648 \u0648\u0631\u0698\u0646 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p><code>normalize_state_rules<\/code>    \u0627\u0648\u0631 <code>normalize_aws_rules<\/code> \u06cc\u06c1 \u0645\u0648\u062c\u0648\u062f \u06c1\u06d2 \u06a9\u06cc\u0648\u0646\u06a9\u06c1 Terraform \u0627\u0648\u0631 AWS \u0627\u06cc\u06a9 \u062c\u06cc\u0633\u06d2 \u0627\u0635\u0648\u0644\u0648\u06ba \u06a9\u0648 \u0642\u062f\u0631\u06d2 \u0645\u062e\u062a\u0644\u0641 \u0641\u0627\u0631\u0645\u06cc\u0679\u0633 \u0645\u06cc\u06ba \u0627\u0633\u0679\u0648\u0631 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 \u0645\u0648\u0627\u0632\u0646\u06c1 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u06a9\u06cc\u0648\u0646\u06a9\u06c1 \u06cc\u06c1 \u062f\u0648\u0646\u0648\u06ba \u0627\u0641\u0639\u0627\u0644 \u0627\u06cc\u06a9 \u06c1\u06cc \u0642\u0633\u0645 \u0645\u06cc\u06ba \u062a\u0628\u062f\u06cc\u0644 \u06c1\u0648\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u0645\u0648\u0627\u0632\u0646\u06c1 \u0622\u062e\u0631\u06cc \u0645\u0631\u062d\u0644\u06c1 \u06c1\u06d2\u06d4 \u0627\u06cc\u06a9 \u0627\u0635\u0648\u0644 \u062f\u0633\u062a\u06cc \u0637\u0648\u0631 \u067e\u0631 \u0634\u0627\u0645\u0644 \u06a9\u06cc\u0627 \u06af\u06cc\u0627 \u062c\u0648 AWS \u0645\u06cc\u06ba \u0645\u0648\u062c\u0648\u062f \u06c1\u06d2 \u0644\u06cc\u06a9\u0646 \u0631\u06cc\u0627\u0633\u062a\u06cc \u0641\u0627\u0626\u0644 \u0645\u06cc\u06ba \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4 \u0648\u06c1 \u0642\u0648\u0627\u0639\u062f \u062c\u0648 \u0627\u0633\u0679\u06cc\u0679 \u0641\u0627\u0626\u0644 \u0645\u06cc\u06ba \u06c1\u06cc\u06ba \u0644\u06cc\u06a9\u0646 AWS \u0645\u06cc\u06ba \u0646\u06c1\u06cc\u06ba \u06c1\u06cc\u06ba \u062f\u0633\u062a\u06cc \u0637\u0648\u0631 \u067e\u0631 \u062d\u0630\u0641 \u06a9\u0631\u062f\u06cc\u0626\u06d2 \u06af\u0626\u06d2 \u06c1\u06cc\u06ba\u06d4 \u0627\u0633\u06a9\u0631\u067e\u0679 \u062f\u0648\u0646\u0648\u06ba \u06a9\u0648 \u067e\u0631\u0646\u0679 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<h3 id=\"heading-what-the-output-looks-like\">\u0622\u0624\u0679 \u067e\u0679 \u0646\u062a\u06cc\u062c\u06c1<\/h3>\n<p>\u0635\u0627\u0641\u060c \u0628\u06c1\u0627\u0624 \u0633\u06d2 \u067e\u0627\u06a9 \u0639\u0645\u0644\u062f\u0631\u0622\u0645\u062f:<\/p>\n<pre><code class=\"language-plaintext\">Loading Terraform state from: terraform.tfstate\n\nChecking: sg-0a1b2c3d4e5f6a7b8\n\n  OK - No drift detected.\n\n============================================================\nNo drift detected in monitored resources.\n\nIMPORTANT: This script only checks resources tracked in your state file.\nResources created manually in AWS without Terraform are invisible to this check.\nA clean output here does not mean your AWS account is clean - it means\nthe resources you are watching match what Terraform last recorded.\n<\/code><\/pre>\n<p>\u0688\u0631\u0641\u0679 \u0627\u0646\u062c\u06cc\u06a9\u0634\u0646 \u06a9\u06d2 \u0628\u0639\u062f:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/umang.pk\/wp-content\/uploads\/2026\/05\/1779904521_267_\u0631\u06cc\u0626\u0644-\u0648\u0631\u0644\u0688-\u0688\u06cc-\u0627\u0648-\u0627\u0648\u067e\u0633-\u0622\u0679\u0648\u0645\u06cc\u0634\u0646-\u06a9\u06d2-\u0644\u06cc\u06d2-\u0628\u0627\u0634-\u0627\u0648\u0631.png\" alt=\"AWS \u0688\u06cc\u0634 \u0628\u0648\u0631\u0688 \u0627\u0633\u06a9\u0631\u06cc\u0646 \u0634\u0627\u0679 \u0628\u0646\u0627\u0626\u06d2 \u06af\u0626\u06d2 \u0633\u06cc\u06a9\u06cc\u0648\u0631\u0679\u06cc \u06af\u0631\u0648\u067e \u0627\u0646 \u0628\u0627\u0624\u0646\u0688 \u0631\u0648\u0644\u0632 \u062f\u06a9\u06be\u0627 \u0631\u06c1\u0627 \u06c1\u06d2\u06d4\" style=\"display:block;margin:0 auto\" width=\"600\" height=\"400\" loading=\"lazy\" title=\"\"><\/p>\n<pre><code class=\"language-plaintext\">Loading Terraform state from: terraform.tfstate\n\nChecking: sg-0a1b2c3d4e5f6a7b8\n\n  DRIFT - Rules present in AWS but missing from state file:\n    Port 22-22 | Protocol: tcp | CIDR: 0.0.0.0\/0\n\n============================================================\nDrift detected. See above for details.\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/umang.pk\/wp-content\/uploads\/2026\/05\/1779904521_164_\u0631\u06cc\u0626\u0644-\u0648\u0631\u0644\u0688-\u0688\u06cc-\u0627\u0648-\u0627\u0648\u067e\u0633-\u0622\u0679\u0648\u0645\u06cc\u0634\u0646-\u06a9\u06d2-\u0644\u06cc\u06d2-\u0628\u0627\u0634-\u0627\u0648\u0631.png\" alt=\"\u0688\u0631\u0641\u0679 \u0627\u0646\u062c\u06cc\u06a9\u0634\u0646 \u0644\u06af\u0627\u0646\u06d2 \u06a9\u06d2 \u0628\u0639\u062f \u0679\u0631\u0645\u06cc\u0646\u0644 \u0622\u0624\u0679 \u067e\u0679 \u06a9\u0627 \u0627\u0633\u06a9\u0631\u06cc\u0646 \u0634\u0627\u0679 \" style=\"display:block;margin:0 auto\" width=\"600\" height=\"400\" loading=\"lazy\" drift title=\"\"><\/p>\n<h3 id=\"heading-the-decision-the-script-cant-make-for-you\">\u0648\u06c1 \u0641\u06cc\u0635\u0644\u06d2 \u062c\u0648 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0646\u06c1\u06cc\u06ba \u06a9\u0631 \u0633\u06a9\u062a\u0627<\/h3>\n<p>\u0627\u0633\u06a9\u0631\u067e\u0679 \u0628\u0691\u06be\u06d2 \u06a9\u06cc \u062a\u0644\u0627\u0634 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u060c \u062c\u0648 \u06a9\u06c1 \u0627\u06cc\u06a9 \u0627\u0646\u062f\u0631\u0648\u0646\u06cc \u0627\u0635\u0648\u0644 \u06c1\u06d2 \u062c\u0633 \u06a9\u06d2 \u0628\u0627\u0631\u06d2 \u0645\u06cc\u06ba \u0679\u06cc\u0631\u0627\u0641\u0627\u0631\u0645 \u0646\u06c1\u06cc\u06ba \u062c\u0627\u0646\u062a\u0627 \u06c1\u06d2\u06d4 \u062c\u0628\u0644\u062a \u062f\u0648\u0691 \u06a9\u0631 \u0641\u0648\u0631\u06cc \u0637\u0648\u0631 \u067e\u0631 \u0648\u0627\u067e\u0633 \u0622\u0646\u0627 \u06c1\u06d2: <code>terraform apply<\/code>\u0644\u06cc\u06a9\u0646 \u0627\u0633 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u0627\u06cc\u06a9 \u0633\u0648\u0627\u0644 \u067e\u0648\u0686\u06be \u0644\u06cc\u06ba\u06d4 \u06a9\u06cc\u0627 \u06cc\u06c1 \u062a\u0628\u062f\u06cc\u0644\u06cc \u0627\u06cc\u06a9 \u06c1\u0646\u06af\u0627\u0645\u06cc \u06c1\u0627\u0679 \u0641\u06a9\u0633 \u062a\u06be\u06cc\u061f \u06a9\u0633\u06cc \u0646\u06d2 \u0633\u0645\u062c\u06be\u0648\u062a\u06c1 \u0634\u062f\u06c1 \u0633\u0631\u0648\u0633 \u06a9\u0648 \u0628\u062d\u0627\u0644 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 2 \u0628\u062c\u06d2 \u062f\u0633\u062a\u06cc \u0637\u0648\u0631 \u067e\u0631 \u0628\u0646\u062f\u0631\u06af\u0627\u06c1 \u06a9\u06be\u0648\u0644\u06cc \u06c1\u0648 \u06af\u06cc \u062c\u0628 \u06a9\u06c1 \u0645\u0646\u0627\u0633\u0628 \u062d\u0644 \u0645\u0648\u062c\u0648\u062f \u062a\u06be\u0627\u06d4 \u0627\u0648\u0631 \u062e\u0648\u062f\u06a9\u0627\u0631 \u067e\u0631 \u0648\u0627\u067e\u0633 \u0622\u0646\u0627 \u0627\u0646 \u0686\u06cc\u0632\u0648\u06ba \u06a9\u0648 \u0628\u06be\u06cc \u06a9\u0627\u0644\u0639\u062f\u0645 \u06a9\u0631 \u0633\u06a9\u062a\u0627 \u06c1\u06d2 \u062c\u0648 \u0622\u067e \u0646\u06d2 \u062c\u0627\u0646 \u0628\u0648\u062c\u06be \u06a9\u0631 \u0627\u067e\u0646\u06cc \u0633\u0631\u0648\u0633 \u06a9\u0648 \u062c\u0627\u0631\u06cc \u0631\u06a9\u06be\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0631\u06a9\u06be\u06cc \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u0628\u06c1\u0627\u0624 \u06a9\u0627 \u067e\u062a\u06c1 \u0644\u06af\u0627\u0646\u0627 \u0622\u067e \u06a9\u0648 \u0628\u062a\u0627\u062a\u0627 \u06c1\u06d2 \u06a9\u06c1 \u0686\u06cc\u0632\u06cc\u06ba \u0645\u062e\u062a\u0644\u0641 \u06c1\u06cc\u06ba\u06d4 \u06cc\u06c1 \u0622\u067e \u06a9\u0648 \u06cc\u06c1 \u0646\u06c1\u06cc\u06ba \u0628\u062a\u0627\u062a\u0627 \u06a9\u06c1 \u06a9\u0648\u0646 \u0633\u0627 \u0648\u0631\u0698\u0646 \u062f\u0631\u0633\u062a \u06c1\u06d2\u060c \u0627\u0648\u0631 \u0627\u0633 \u06a9\u06cc \u0686\u06be\u0627\u0646 \u0628\u06cc\u0646 \u06a9\u0631\u0646\u0627 \u0627\u0633\u06a9\u0631\u067e\u0679 \u06a9\u06d2 \u0686\u0644\u0646\u06d2 \u06a9\u06d2 \u0628\u0639\u062f \u06c1\u0648\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<h3 id=\"heading-break-it-on-purpose\">\u062c\u0627\u0646 \u0628\u0648\u062c\u06be \u06a9\u0631 \u062a\u0648\u0691 \u062f\u0648<\/h3>\n<ol>\n<li>\n<p>\u0686\u0644\u0627\u0626\u06cc\u06ba <code>.\/break_it.sh<\/code>. \u06cc\u06c1 \u0628\u0631\u0627\u06c1 \u0631\u0627\u0633\u062a AWS CLI \u06a9\u06d2 \u0630\u0631\u06cc\u0639\u06d2 SSH \u0627\u0646 \u0628\u0627\u0624\u0646\u0688 \u0631\u0648\u0644 (\u067e\u0648\u0631\u0679 22) \u06a9\u0648 \u0634\u0627\u0645\u0644 \u06a9\u0631\u06a9\u06d2 \u062f\u0633\u062a\u06cc \u06a9\u0646\u0633\u0648\u0644 \u06a9\u06cc \u062a\u0628\u062f\u06cc\u0644\u06cc \u06a9\u06cc \u0646\u0642\u0644 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<\/li>\n<li>\n<p>\u0686\u0644\u0627\u0626\u06cc\u06ba <code>python detect_drift.py terraform.tfstate<\/code>. \u0622\u0644\u06af\u0627\u0626\u06d2 \u0622\u0624\u0679 \u067e\u0679 \u0645\u06cc\u06ba \u0638\u0627\u06c1\u0631 \u06c1\u0648\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<\/li>\n<li>\n<p>\u0686\u0644\u0627\u0626\u06cc\u06ba <code>.\/break_it.sh --invisible<\/code> \u0627\u06cc\u06a9 \u0646\u06cc\u0627 \u0633\u06cc\u06a9\u06cc\u0648\u0631\u0679\u06cc \u06af\u0631\u0648\u067e \u0628\u0646\u0627\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u0633\u06a9\u0631\u067e\u0679 \u06a9\u0648 \u062f\u0648\u0628\u0627\u0631\u06c1 \u0686\u0644\u0627\u0626\u06cc\u06ba \u062c\u0648 \u0622\u067e \u06a9\u06cc \u0627\u0633\u0679\u06cc\u0679 \u0641\u0627\u0626\u0644 \u0645\u06cc\u06ba \u0628\u0627\u0644\u06a9\u0644 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4 \u06cc\u06c1\u0627\u06ba \u062a\u06a9 \u06a9\u06c1 \u0627\u06af\u0631 \u0622\u067e \u06a9\u06d2 \u0627\u06a9\u0627\u0624\u0646\u0679 \u0645\u06cc\u06ba \u0646\u0626\u06d2 \u0648\u0633\u0627\u0626\u0644 \u0645\u0648\u062c\u0648\u062f \u06c1\u06cc\u06ba\u060c \u062a\u0648 \u0648\u06c1 \u0635\u0627\u0641 \u0637\u0648\u0631 \u067e\u0631 \u0648\u0627\u067e\u0633 \u06a9\u0631 \u062f\u06cc\u06d2 \u062c\u0627\u0626\u06cc\u06ba \u06af\u06d2 \u062a\u0627\u06a9\u06c1 \u06a9\u0648\u0631\u06cc\u062c \u0645\u06cc\u06ba \u06a9\u0648\u0626\u06cc \u0628\u06be\u06cc \u0641\u0631\u0642 \u0646\u0645\u0627\u06cc\u0627\u06ba \u06c1\u0648 \u062c\u0627\u0626\u06d2\u06d4<\/p>\n<\/li>\n<li>\n<p>\u0686\u0644\u0627\u0626\u06cc\u06ba <code>.\/teardown.sh<\/code>. \u0627\u06cc\u06a9 \u0628\u0627\u0631 \u0645\u06a9\u0645\u0644 \u06c1\u0648\u0646\u06d2 \u06a9\u06d2 \u0628\u0639\u062f\u060c \u062f\u0631\u062c \u0630\u06cc\u0644 \u0686\u0644\u06cc\u06ba \u06af\u06d2: <code>terraform destroy<\/code> \u0633\u06cc\u06a9\u06cc\u0648\u0631\u0679\u06cc \u06af\u0631\u0648\u067e \u06a9\u0648 \u062d\u0630\u0641 \u06a9\u0631\u06cc\u06ba \u0627\u0648\u0631 \u062a\u0645\u0627\u0645 AWS \u0648\u0633\u0627\u0626\u0644 \u06a9\u0648 \u0635\u0627\u0641 \u06a9\u0631\u06cc\u06ba\u06d4 \u0627\u0633 \u06a9\u06d2 \u0628\u0639\u062f \u0622\u067e \u0633\u06d2 \u06a9\u0648\u0626\u06cc \u0686\u0627\u0631\u062c \u0646\u06c1\u06cc\u06ba \u0644\u06cc\u0627 \u062c\u0627\u0626\u06d2 \u06af\u0627\u06d4<\/p>\n<\/li>\n<\/ol>\n<h2 id=\"heading-use-case-4-secrets-rotation-with-zero-downtime\">\u06a9\u06cc\u0633 4 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u06cc\u06ba &#8211; \u0628\u063a\u06cc\u0631 \u0688\u0627\u0624\u0646 \u0679\u0627\u0626\u0645 \u06a9\u06d2 \u062e\u0641\u06cc\u06c1 \u06af\u0631\u062f\u0634<\/h2>\n<p><strong>\u0645\u0627\u062d\u0648\u0644:<\/strong> AWS \u0633\u06cc\u06a9\u0631\u0679\u0633 \u0645\u06cc\u0646\u06cc\u062c\u0631 + \u0645\u0642\u0627\u0645\u06cc \u0642\u0633\u0645 \u06a9\u0627 \u06a9\u0644\u0633\u0679\u0631<br \/><strong>\u0632\u0628\u0627\u0646:<\/strong> \u0627\u0632\u06af\u0631<\/p>\n<h3 id=\"heading-the-production-problem\">\u067e\u06cc\u062f\u0627\u0648\u0627\u0631 \u06a9\u06d2 \u0645\u0633\u0627\u0626\u0644<\/h3>\n<p><strong>\u0627\u0633 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06d2 \u06a9\u06cc\u0633 \u06a9\u06d2 \u0645\u0642\u0627\u0635\u062f:<\/strong> Kubernetes \u06a9\u0627 \u06a9\u06c1\u0646\u0627 \u06c1\u06d2 \u06a9\u06c1 \u067e\u0648\u0688 \u0635\u062d\u062a \u0645\u0646\u062f \u06c1\u06d2\u060c \u0644\u06cc\u06a9\u0646 \u0635\u0627\u0631\u0641\u06cc\u0646 \u06a9\u0648 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u06a9\u06cc \u062e\u0631\u0627\u0628\u06cc \u0645\u0644\u062a\u06cc \u06c1\u06d2. \u0627\u0633\u06a9\u0631\u067e\u0679 \u0627\u0646 \u062e\u0627\u0644\u06cc \u062c\u06af\u06c1\u0648\u06ba \u06a9\u0648 \u067e\u06a9\u0691\u062a\u0627 \u06c1\u06d2 \u0627\u0633 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u06a9\u06c1 \u0635\u0627\u0631\u0641\u06cc\u0646 \u0627\u06cc\u06a9 \u0627\u0636\u0627\u0641\u06cc \u0686\u06cc\u06a9 \u0686\u0644\u0627\u0646\u06d2 \u0633\u06d2 \u0645\u062a\u0627\u062b\u0631 \u06c1\u0648\u06ba \u062c\u0648 Kubernetes \u06a9\u0628\u06be\u06cc \u0646\u06c1\u06cc\u06ba \u0686\u0644\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u06a9\u06cc \u0627\u0633\u0646\u0627\u062f \u06a9\u0648 \u062a\u0628\u062f\u06cc\u0644 \u06a9\u0631\u06cc\u06ba\u06d4 \u067e\u0648\u0688 \u062f\u0648\u0628\u0627\u0631\u06c1 \u0634\u0631\u0648\u0639 \u06c1\u0648 \u062c\u0627\u0626\u06d2 \u06af\u0627. <code>kubectl get pods<\/code> \u06cc\u06c1 \u062f\u0648\u0691\u062a\u0627 \u062f\u06a9\u06be\u0627\u062a\u0627 \u06c1\u06d2\u06d4 \u0635\u0627\u0631\u0641\u06cc\u0646 10 \u0645\u0646\u0679 \u06a9\u06d2 \u0628\u0639\u062f \u0644\u0627\u06af \u0627\u0646 \u0646\u06c1\u06cc\u06ba \u06c1\u0648 \u0633\u06a9\u06cc\u06ba \u06af\u06d2\u06d4<\/p>\n<p>\u0644\u0648\u067e \u0646\u06d2 \u06a9\u0627\u0645 \u06a9\u06cc\u0627\u060c \u0644\u06cc\u06a9\u0646 \u0645\u0633\u0626\u0644\u06c1 \u06cc\u06c1 \u062a\u06be\u0627 \u06a9\u06c1 \u06a9\u0628\u0631\u0646\u06cc\u0679\u0633 \u0646\u06d2 \u0686\u06cc\u06a9 \u06a9\u06cc\u0627 \u06a9\u06c1 \u0622\u06cc\u0627 HTTP \u0633\u0631\u0648\u0631 \u0632\u0646\u062f\u06c1 \u06c1\u06d2\u060c \u0646\u06c1 \u06a9\u06c1 \u06cc\u06c1 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u0633\u06d2 \u062a\u0635\u062f\u06cc\u0642 \u06a9\u0631 \u0633\u06a9\u062a\u0627 \u06c1\u06d2\u06d4 \u06cc\u06c1 \u062f\u0648 \u0645\u062e\u062a\u0644\u0641 \u0686\u06cc\u0632\u06cc\u06ba \u06c1\u06cc\u06ba\u06d4<\/p>\n<h3 id=\"heading-whats-actually-happening\">\u0627\u0635\u0644 \u0645\u06cc\u06ba \u06a9\u06cc\u0627 \u06c1\u0648 \u0631\u06c1\u0627 \u06c1\u06d2\u061f<\/h3>\n<p><strong>\u06cc\u06c1 \u06a9\u06cc\u0627 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2:<\/strong> \u06cc\u06c1 \u0627\u0633 \u0628\u0627\u0631\u06d2 \u0645\u06cc\u06ba \u0646\u06c1\u06cc\u06ba \u06c1\u06d2 \u06a9\u06c1 \u06a9\u0648\u0628\u0631\u0646\u06cc\u0679\u0633 \u0645\u06cc\u06ba \u0631\u0627\u0632 \u06a9\u0648 \u06a9\u06cc\u0633\u06d2 \u0630\u062e\u06cc\u0631\u06c1 \u06a9\u06cc\u0627 \u062c\u0627\u0626\u06d2\u06d4 \u06cc\u06c1 \u0627\u0633 \u06a9\u06d2 \u0628\u0627\u0631\u06d2 \u0645\u06cc\u06ba \u06c1\u06d2 \u06a9\u06c1 \u0631\u0627\u0632\u0648\u06ba \u06a9\u0648 \u062a\u0628\u062f\u06cc\u0644 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0628\u0639\u062f \u06a9\u06cc\u0627 \u06c1\u0648\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u0627\u06af\u0631 \u067e\u0648\u0688 \u067e\u06c1\u0644\u06d2 \u0633\u06d2 \u0686\u0644 \u0631\u06c1\u0627 \u06c1\u06d2\u060c \u062a\u0648 \u06af\u0631\u062f\u0634 \u06c1\u0648\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u0627\u0633 \u0645\u06cc\u06ba \u06a9\u06be\u0644\u06d2\u060c \u062a\u0635\u062f\u06cc\u0642 \u0634\u062f\u06c1 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u06a9\u0646\u06a9\u0634\u0646\u0632 \u06a9\u0627 \u0627\u06cc\u06a9 \u062a\u0627\u0644\u0627\u0628 \u06c1\u0648\u06af\u0627\u06d4 \u06cc\u06c1 \u06a9\u0646\u06a9\u0634\u0646 \u067e\u0627\u0633 \u0648\u0631\u0688 \u06a9\u06cc \u062a\u0628\u062f\u06cc\u0644\u06cc \u06a9\u06d2 \u0628\u0639\u062f \u0628\u06be\u06cc \u0628\u0631\u0642\u0631\u0627\u0631 \u0631\u06c1\u06cc\u06ba \u06af\u06d2 \u06a9\u06cc\u0648\u0646\u06a9\u06c1 \u062a\u0628\u062f\u06cc\u0644\u06cc \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u0627\u0646 \u06a9\u06cc \u062a\u0648\u062b\u06cc\u0642 \u06a9\u06cc \u06af\u0626\u06cc \u062a\u06be\u06cc \u0627\u0648\u0631 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u0627\u0646\u06c1\u06cc\u06ba \u0628\u0627\u06c1\u0631 \u0646\u06c1\u06cc\u06ba \u0646\u06a9\u0627\u0644\u06d2 \u06af\u0627\u06d4 \u062a\u0627\u06c1\u0645\u060c \u0627\u06af\u0631 \u067e\u0648\u0644 \u06a9\u0648 \u0646\u06cc\u0627 \u06a9\u0646\u06a9\u0634\u0646 \u06a9\u06be\u0648\u0644\u0646\u06d2 \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u06c1\u06d2\u060c \u062a\u0648 \u06cc\u06c1 \u0627\u0628 \u0628\u06be\u06cc \u067e\u0631\u0627\u0646\u06d2 \u067e\u0627\u0633 \u0648\u0631\u0688 \u0633\u0645\u06cc\u062a \u0645\u0648\u062c\u0648\u062f\u06c1 \u0645\u0627\u062d\u0648\u0644\u06cc\u0627\u062a\u06cc \u0627\u0633\u0646\u0627\u062f \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u06d2 \u06af\u0627\u06d4 \u0648\u06c1 \u0646\u06cc\u0627 \u06a9\u0646\u06a9\u0634\u0646 \u0641\u0648\u0631\u06cc \u0637\u0648\u0631 \u067e\u0631 \u0646\u0627\u06a9\u0627\u0645 \u06c1\u0648 \u062c\u0627\u0626\u06d2 \u06af\u0627\u06d4<\/p>\n<p>\u062f\u0631\u06cc\u06ba \u0627\u062b\u0646\u0627\u060c Kubernetes \u0627\u06cc\u0633\u06d2 \u067e\u0648\u0688\u0632 \u06a9\u06cc \u062c\u0627\u0646\u0686 \u067e\u0691\u062a\u0627\u0644 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u062c\u0648 HTTP \u06a9\u0648 \u062c\u0648\u0627\u0628 \u062f\u06cc\u062a\u06d2 \u06c1\u06cc\u06ba \u0627\u0648\u0631 \u0627\u0646\u06c1\u06cc\u06ba \u0686\u0644\u0627\u0646\u06d2 \u06a9\u06d2 \u0637\u0648\u0631 \u067e\u0631 \u0646\u0634\u0627\u0646 \u0632\u062f \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u060c \u062c\u0633 \u06a9\u06cc \u0648\u062c\u06c1 \u0633\u06d2 \u0622\u067e \u0628\u063a\u06cc\u0631 \u06a9\u0633\u06cc \u0627\u0634\u0627\u0631\u06d2 \u06a9\u06d2 \u063a\u0644\u0637\u06cc \u067e\u06cc\u062f\u0627 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba \u06a9\u06c1 \u0622\u067e \u06a9\u06d2 \u06a9\u0644\u0633\u0679\u0631 \u0645\u06cc\u06ba \u06a9\u0686\u06be \u063a\u0644\u0637 \u06c1\u06d2\u06d4<\/p>\n<h3 id=\"heading-what-the-healthzdb-endpoint-does\">\u06a9\u06cc\u0627 <code>\/healthz\/db<\/code> \u0627\u062e\u062a\u062a\u0627\u0645\u06cc \u0646\u0642\u0637\u06c1 \u06a9\u06cc\u0627 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/h3>\n<p><code>\/healthz<\/code>    \u0627\u06af\u0631 HTTP \u0633\u0631\u0648\u0631 \u0632\u0646\u062f\u06c1 \u06c1\u06d2\u060c \u062a\u0648 \u06cc\u06c1 200 \u0644\u0648\u0679\u0627\u062a\u0627 \u06c1\u06d2\u06d4 Kubernetes \u0645\u0639\u0627\u0626\u0646\u06c1 \u06a9\u0627 \u0645\u0642\u0635\u062f \u06cc\u06c1\u06cc \u06c1\u06d2\u06d4<\/p>\n<p><code>\/healthz\/db<\/code>    \u0645\u0648\u062c\u0648\u062f\u06c1 \u0627\u0633\u0646\u0627\u062f \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u06d2 \u06c1\u0648\u0626\u06d2 \u0646\u06cc\u0627 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u06a9\u0646\u06a9\u0634\u0646 \u06a9\u06be\u0648\u0644\u06cc\u06ba \u0627\u0648\u0631 \u0686\u0644\u0627\u0626\u06cc\u06ba\u06d4 <code>SELECT 1<\/code>. \u0627\u06af\u0631 \u06cc\u06c1 \u0633\u0627\u0626\u06cc\u06a9\u0644 \u0686\u0644\u0627\u0646\u06d2 \u06a9\u06d2 \u0628\u0639\u062f \u0646\u0627\u06a9\u0627\u0645 \u06c1\u0648\u062c\u0627\u062a\u0627 \u06c1\u06d2\u060c \u062a\u0648 \u067e\u0648\u0688 \u0686\u0644 \u0631\u06c1\u0627 \u06c1\u06d2 \u0644\u06cc\u06a9\u0646 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u06a9\u06cc \u062f\u0631\u062e\u0648\u0627\u0633\u062a\u0648\u06ba \u06a9\u06cc \u062e\u062f\u0645\u062a \u0646\u06c1\u06cc\u06ba \u06a9\u0631\u0633\u06a9\u062a\u0627\u06d4 \u0645\u062a\u0628\u0627\u062f\u0644 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0627\u0633 \u0627\u062e\u062a\u062a\u0627\u0645\u06cc \u0646\u0642\u0637\u06c1 \u06a9\u0648 \u0622\u062e\u0631\u06cc \u0645\u0631\u062d\u0644\u06c1 \u06a9\u06c1\u062a\u0627 \u06c1\u06d2\u06d4 \u0627\u0633 \u06a9\u0627 \u0645\u0637\u0644\u0628 \u06c1\u06d2 \u06a9\u06c1 Kubernetes \u06a9\u06cc \u062a\u0635\u062f\u06cc\u0642 \u0646\u06c1\u06cc\u06ba \u0686\u0644\u06d2 \u06af\u06cc\u06d4<\/p>\n<p>\u06cc\u06c1\u0627\u06ba \u06c1\u06d2 \u0688\u06cc\u0645\u0648 FastAPI \u0627\u06cc\u067e\u0644\u06cc\u06a9\u06cc\u0634\u0646 (\u06a9\u0648\u0688 \u0641\u0627\u0626\u0644) \u06a9\u06cc\u0633\u06cc \u062f\u06a9\u06be\u062a\u06cc \u06c1\u06d2:<\/p>\n<pre><code class=\"language-python\"># app.py (relevant section)\nimport os\nimport asyncpg\nfrom fastapi import FastAPI, HTTPException\n\napp = FastAPI()\n\nDB_HOST = os.environ.get(\"DB_HOST\", \"postgres\")\nDB_PORT = int(os.environ.get(\"DB_PORT\", \"5432\"))\nDB_NAME = os.environ.get(\"DB_NAME\", \"appdb\")\nDB_USERNAME = os.environ.get(\"DB_USERNAME\", \"appuser\")\nDB_PASSWORD = os.environ.get(\"DB_PASSWORD\", \"\")\n\n@app.get(\"\/healthz\")\nasync def healthz():\n    # Always returns 200 if the HTTP server is alive.\n    # This is all the Kubernetes readiness probe checks.\n    return {\"status\": \"ok\"}\n\n@app.get(\"\/healthz\/db\")\nasync def healthz_db():\n    # Opens a fresh connection using the current environment credentials.\n    # If the password was rotated and this pod has not restarted yet,\n    # the environment still has the old password - this connection fails.\n    # \/healthz above would still return 200. Your users would see errors.\n    try:\n        conn = await asyncpg.connect(\n            host=DB_HOST, port=DB_PORT,\n            database=DB_NAME, user=DB_USERNAME, password=DB_PASSWORD,\n        )\n        await conn.execute(\"SELECT 1\")\n        await conn.close()\n        return {\"status\": \"ok\", \"db\": \"authenticated\"}\n\n    except asyncpg.InvalidPasswordError:\n        raise HTTPException(\n            status_code=503,\n            detail=(\n                f\"Authentication failed for '{DB_USERNAME}'. \"\n                \"Password may have been rotated. \"\n                \"Readiness probe does not check this.\"\n            )\n        )\n    except Exception as e:\n        raise HTTPException(status_code=503, detail=f\"Database error: {str(e)}\")\n<\/code><\/pre>\n<p>\u0627\u0646 \u062f\u0648 \u0627\u062e\u062a\u062a\u0627\u0645\u06cc \u0646\u06a9\u0627\u062a \u06a9\u06d2 \u062f\u0631\u0645\u06cc\u0627\u0646 \u0641\u0631\u0642 \u0627\u0633 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06d2 \u0645\u0639\u0627\u0645\u0644\u06d2 \u06a9\u0627 \u067e\u0648\u0631\u0627 \u0633\u0628\u0642 \u06c1\u06d2\u06d4<\/p>\n<h3 id=\"heading-set-up-the-demo-environment\">\u0688\u06cc\u0645\u0648 \u06a9\u06cc \u062a\u0631\u062a\u06cc\u0628\u0627\u062a<\/h3>\n<p>\u0627\u06af\u0644\u06d2 \u067e\u0631 \u062c\u0627\u0626\u06cc\u06ba\u06d4 <code>04-secrets-rotation\/<\/code> \u0633\u06cc\u0679 \u0627\u067e \u0627\u0633\u06a9\u0631\u067e\u0679 \u0686\u0644\u0627\u0626\u06cc\u06ba\u06d4<\/p>\n<pre><code class=\"language-plaintext\">cd 04-secrets-rotation\n.\/setup.sh\n<\/code><\/pre>\n<p>Kind \u06a9\u0644\u0633\u0679\u0631 \u0634\u0631\u0648\u0639 \u06c1\u0648 \u06af\u06cc\u0627 \u06c1\u06d2 \u0627\u0648\u0631 \u0627\u0635\u0644 PostgreSQL \u06a9\u0648 \u062a\u0639\u06cc\u0646\u0627\u062a \u06a9\u0631 \u062f\u06cc\u0627 \u06af\u06cc\u0627 \u06c1\u06d2\u06d4 <code>appuser<\/code> \u0688\u06cc\u0645\u0648 FastAPI \u0627\u06cc\u067e \u06a9\u0648 \u062a\u0639\u06cc\u0646\u0627\u062a \u06a9\u0631\u0646\u06d2 \u0627\u0648\u0631 AWS Secrets Manager \u0645\u06cc\u06ba \u0627\u0628\u062a\u062f\u0627\u0626\u06cc \u0631\u0627\u0632 \u0628\u0646\u0627\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u06cc\u06a9 \u0627\u06a9\u0627\u0624\u0646\u0679 \u067e\u06c1\u0644\u06d2 \u0633\u06d2 \u06c1\u06cc \u0628\u0646\u0627\u06cc\u0627 \u0627\u0648\u0631 \u0645\u0646\u0633\u0644\u06a9 \u06c1\u06d2\u06d4<\/p>\n<p>\u0633\u06cc\u0679 \u0627\u067e \u0645\u06a9\u0645\u0644 \u06c1\u0648\u0646\u06d2 \u06a9\u06d2 \u0628\u0639\u062f\u060c \u0627\u0646\u062d\u0635\u0627\u0631 \u0627\u0646\u0633\u0679\u0627\u0644 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<pre><code class=\"language-plaintext\">pip install boto3 kubernetes\n<\/code><\/pre>\n<p>\u0644\u0648\u067e \u0686\u0644\u0627\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u06cc\u0642\u06cc\u0646\u06cc \u0628\u0646\u0627\u0626\u06cc\u06ba \u06a9\u06c1 \u0633\u0628 \u06a9\u0686\u06be \u0686\u0644 \u0631\u06c1\u0627 \u06c1\u06d2\u06d4<\/p>\n<pre><code class=\"language-plaintext\">kubectl get pods\n<\/code><\/pre>\n<p>\u0622\u067e \u06a9\u0648 \u062f\u06cc\u06a9\u06be\u0646\u0627 \u0686\u0627\u06c1\u0626\u06d2 <code>myapp<\/code> \u0627\u0648\u0631 <code>postgres<\/code> \u062f\u0648\u0646\u0648\u06ba \u067e\u06be\u0644\u06cc\u0627\u06ba \u0686\u0644\u062a\u06cc \u062d\u0627\u0644\u062a \u0645\u06cc\u06ba \u06c1\u06cc\u06ba\u06d4 \u0627\u06af\u0631 \u067e\u0648\u0688 \u0632\u06cc\u0631 \u0627\u0644\u062a\u0648\u0627\u0621 \u06cc\u0627 \u062e\u0631\u0627\u0628\u06cc \u062f\u06a9\u06be\u0627\u062a\u0627 \u06c1\u06d2\u060c 30 \u0633\u06cc\u06a9\u0646\u0688 \u0627\u0646\u062a\u0638\u0627\u0631 \u06a9\u0631\u06cc\u06ba \u0627\u0648\u0631 \u062f\u0648\u0628\u0627\u0631\u06c1 \u0686\u06cc\u06a9 \u06a9\u0631\u06cc\u06ba\u06d4 PostgreSQL \u06a9\u0648 \u0634\u0631\u0648\u0639 \u06a9\u0631\u0646\u06d2 \u0645\u06cc\u06ba \u0627\u06cc\u06a9 \u0644\u0645\u062d\u06c1 \u0644\u06af\u06d2 \u06af\u0627\u06d4<\/p>\n<p>\u0622\u067e \u06cc\u06c1 \u0628\u06be\u06cc \u062a\u0635\u062f\u06cc\u0642 \u06a9\u0631 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba \u06a9\u06c1 \u0622\u067e \u06a9\u0627 \u067e\u0627\u0633 \u0648\u0631\u0688 AWS \u0645\u06cc\u06ba \u0628\u0646\u0627\u06cc\u0627 \u06af\u06cc\u0627 \u062a\u06be\u0627\u06d4 \u06a9\u0646\u0633\u0648\u0644 \u0645\u06cc\u06ba\u060c AWS Secrets Manager \u067e\u0631 \u062c\u0627\u0626\u06cc\u06ba \u0627\u0648\u0631 \u062f\u0631\u062c \u0630\u06cc\u0644 \u06a9\u0648 \u062a\u0644\u0627\u0634 \u06a9\u0631\u06cc\u06ba: <code>myapp\/db-credentials<\/code>:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/umang.pk\/wp-content\/uploads\/2026\/05\/1779904521_664_\u0631\u06cc\u0626\u0644-\u0648\u0631\u0644\u0688-\u0688\u06cc-\u0627\u0648-\u0627\u0648\u067e\u0633-\u0622\u0679\u0648\u0645\u06cc\u0634\u0646-\u06a9\u06d2-\u0644\u06cc\u06d2-\u0628\u0627\u0634-\u0627\u0648\u0631.png\" alt=\"\u0627\u0633\u06a9\u0631\u06cc\u0646 \u0634\u0627\u0679 \u062a\u06cc\u0627\u0631 \u06a9\u0631\u062f\u06c1 AWS \u067e\u0627\u0633 \u0648\u0631\u0688 \u062f\u06a9\u06be\u0627 \u0631\u06c1\u0627 \u06c1\u06d2\u06d4\" style=\"display:block;margin:0 auto\" width=\"600\" height=\"400\" loading=\"lazy\" title=\"\"><\/p>\n<p>\u0627\u06af\u0631 \u0622\u067e CLI \u06a9\u0648 \u062a\u0631\u062c\u06cc\u062d \u062f\u06cc\u062a\u06d2 \u06c1\u06cc\u06ba:<\/p>\n<pre><code class=\"language-plaintext\">aws secretsmanager get-secret-value --secret-id myapp\/db-credentials\n<\/code><\/pre>\n<p>\u0627\u06af\u0631 \u062f\u0648\u0646\u0648\u06ba \u067e\u0648\u0688\u0632 \u0686\u0644 \u0631\u06c1\u06d2 \u06c1\u06cc\u06ba \u0627\u0648\u0631 \u0631\u0627\u0632 \u0645\u0648\u062c\u0648\u062f \u06c1\u06d2\u060c \u062a\u0648 \u0648\u06c1 \u067e\u0648\u0631\u06d2 \u0631\u0627\u0633\u062a\u06d2 \u06a9\u0648 \u0686\u06cc\u06a9 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u06cc\u06a9 \u0644\u0648\u067e \u0686\u0644\u0627\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<pre><code class=\"language-plaintext\">python rotate_secret.py\n<\/code><\/pre>\n<p><strong>\u0627\u06af\u0631 \u067e\u06c1\u0644\u0627 \u06a9\u0644\u06cc\u0646 \u0627\u067e \u0631\u0646 \u067e\u0631 \u0645\u0631\u062d\u0644\u06c1 6 \u0641\u06cc\u0644\u0688 \u062f\u06a9\u06be\u0627\u062a\u0627 \u06c1\u06d2:<\/strong>\u06cc\u06c1 \u062a\u0642\u0631\u06cc\u0628\u0627 \u06c1\u0645\u06cc\u0634\u06c1 \u0627\u06cc\u06a9 \u0648\u0642\u062a \u06a9\u0627 \u0645\u0633\u0626\u0644\u06c1 \u06c1\u06d2. \u0627\u06cc\u067e \u067e\u0648\u0688 \u06a9\u0627\u0645\u06cc\u0627\u0628\u06cc \u06a9\u06d2 \u0633\u0627\u062a\u06be \u062f\u0648\u0628\u0627\u0631\u06c1 \u0634\u0631\u0648\u0639 \u06c1\u0648\u0627\u060c \u0644\u06cc\u06a9\u0646 <code>\/healthz\/db<\/code> \u0646\u06cc\u0627 \u067e\u0648\u0688 \u0627\u067e\u0646\u0627 \u067e\u06c1\u0644\u0627 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u06a9\u0646\u06a9\u0634\u0646 \u0642\u0627\u0626\u0645 \u06a9\u0631\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u06c1\u06cc \u0686\u0644\u0627 \u06af\u06cc\u0627\u06d4 \u062a\u0642\u0631\u06cc\u0628\u0627\u064b 20 \u0633\u06cc\u06a9\u0646\u0688 \u0627\u0646\u062a\u0638\u0627\u0631 \u06a9\u0631\u06cc\u06ba \u0627\u0648\u0631 \u0686\u0644\u0627\u0626\u06cc\u06ba\u06d4 <code>python rotate_secret.py<\/code> \u062f\u0648\u0628\u0627\u0631\u06c1 \u0627\u06af\u0631 \u06cc\u06c1 \u0628\u0627\u0631 \u0628\u0627\u0631 \u0646\u0627\u06a9\u0627\u0645 \u06c1\u0648\u062c\u0627\u062a\u0627 \u06c1\u06d2 \u062a\u0648\u060c \u0686\u0644\u0627\u0626\u06cc\u06ba: <code>kubectl logs deployment\/myapp<\/code> \u062f\u06cc\u06a9\u06be\u06cc\u06ba \u06a9\u06c1 \u0627\u06cc\u067e \u06a9\u06cc\u0627 \u0631\u067e\u0648\u0631\u0679 \u06a9\u0631\u062a\u06cc \u06c1\u06d2\u06d4<\/p>\n<p>\u0622\u067e \u062f\u06cc\u06a9\u06be \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba \u06a9\u06c1 \u062a\u0645\u0627\u0645 6 \u0645\u0631\u0627\u062d\u0644 \u0635\u0641\u0627\u0626\u06cc \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0645\u06a9\u0645\u0644 \u06c1\u0648 \u06af\u0626\u06d2 \u06c1\u06cc\u06ba \u0627\u0648\u0631 \u06c1\u0645 \u0627\u0633 \u06a9\u06d2 \u0633\u0627\u062a\u06be \u062e\u062a\u0645 \u06c1\u0648\u062a\u06d2 \u06c1\u06cc\u06ba:<\/p>\n<pre><code class=\"language-plaintext\">Rotation complete. Credential verified at the application level.\n  AWS Secrets Manager: updated\n  PostgreSQL:          updated (ALTER USER)\n  Kubernetes Secret:   updated\n  Application pod:     restarted, authenticated\n<\/code><\/pre>\n<p>\u0644\u06cc\u0628\u0627\u0631\u0679\u0631\u06cc \u0632\u0646\u062f\u06c1 \u06c1\u06d2 \u0627\u0648\u0631 \u067e\u0648\u0631\u06cc \u0633\u0631\u06a9\u0644\u0631 \u0686\u06cc\u0646 \u0633\u0631\u06d2 \u0633\u06d2 \u0622\u062e\u0631 \u062a\u06a9 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u06cc \u06c1\u06d2\u06d4 \u0627\u0628 \u062f\u06cc\u06a9\u06be\u062a\u06d2 \u06c1\u06cc\u06ba \u0627\u0633\u06a9\u0631\u067e\u0679 \u06a9\u06cc\u0627 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<h3 id=\"heading-the-script-code-files\">\u0627\u0633\u06a9\u0631\u067e\u0679 (\u06a9\u0648\u0688 \u0641\u0627\u0626\u0644)<\/h3>\n<pre><code class=\"language-python\"># rotate_secret.py\nimport boto3\nimport base64\nimport json\nimport subprocess\nimport sys\nfrom kubernetes import client, config\n\n\ndef get_current_secret(secret_name):\n    \"\"\"\n    Fetch the current credential from AWS Secrets Manager.\n    The secret is stored as a JSON string with 'username' and 'password' fields.\n    \"\"\"\n    sm = boto3.client(\"secretsmanager\")\n    response = sm.get_secret_value(SecretId=secret_name)\n    return json.loads(response[\"SecretString\"])\n\n\ndef rotate_in_aws(secret_name, username, new_password):\n    \"\"\"\n    Write the new credential to AWS Secrets Manager.\n    put_secret_value creates a new version - the previous version is\n    not deleted immediately, giving you a short rollback window.\n    \"\"\"\n    sm = boto3.client(\"secretsmanager\")\n    new_value = json.dumps({\"username\": username, \"password\": new_password})\n    sm.put_secret_value(SecretId=secret_name, SecretString=new_value)\n    print(\"  [AWS] Secret updated in Secrets Manager.\")\n\n\ndef update_kubernetes_secret(namespace, k8s_secret_name, username, new_password):\n    \"\"\"\n    Patch the Kubernetes Secret object with the new credential values.\n    Kubernetes requires secret data to be base64-encoded - this is encoding,\n    not encryption. Anyone with access to the Secret object can decode the values.\n    Real encryption at rest requires separate etcd encryption configuration.\n    \"\"\"\n    config.load_kube_config()\n    v1 = client.CoreV1Api()\n\n    secret_data = {\n        \"username\": base64.b64encode(username.encode()).decode(),\n        \"password\": base64.b64encode(new_password.encode()).decode()\n    }\n\n    v1.patch_namespaced_secret(\n        name=k8s_secret_name,\n        namespace=namespace,\n        body={\"data\": secret_data}\n    )\n    print(f\"  [K8s] Kubernetes Secret '{k8s_secret_name}' updated.\")\n\n\ndef rolling_restart(namespace, deployment_name):\n    \"\"\"\n    Trigger a rolling restart of the deployment.\n    Rolling restart means Kubernetes creates one new pod, waits for it to pass\n    its readiness probe, then terminates one old pod - and repeats until all\n    pods have been replaced. Availability is preserved throughout.\n    This is very different from deleting all pods at once.\n    \"\"\"\n    result = subprocess.run(\n        [\"kubectl\", \"rollout\", \"restart\",\n         f\"deployment\/{deployment_name}\", \"-n\", namespace],\n        capture_output=True, text=True\n    )\n    if result.returncode != 0:\n        raise RuntimeError(f\"Rolling restart failed: {result.stderr}\")\n    print(f\"  [K8s] Rolling restart triggered for '{deployment_name}'.\")\n\n\ndef wait_for_rollout(namespace, deployment_name, timeout=120):\n    \"\"\"\n    Block until the rolling restart finishes or times out.\n    'Finished' means all new pods are Running and their readiness probes passed.\n    This does NOT mean the application can authenticate with the new credential.\n    That is what verify_credential checks next.\n    \"\"\"\n    print(f\"  [K8s] Waiting for rollout (timeout: {timeout}s)...\")\n    result = subprocess.run(\n        [\"kubectl\", \"rollout\", \"status\",\n         f\"deployment\/{deployment_name}\",\n         \"-n\", namespace,\n         f\"--timeout={timeout}s\"],\n        capture_output=True, text=True\n    )\n    if result.returncode != 0:\n        raise RuntimeError(f\"Rollout did not complete: {result.stderr}\")\n    print(\"  [K8s] Rollout complete. All pods report Ready.\")\n\n\ndef verify_credential(namespace, deployment_name):\n    \"\"\"\n    This is the check the readiness probe does not make.\n    We exec into the running pod and call \/healthz\/db - an endpoint that\n    makes an actual authenticated query to the database.\n    If this passes: the credential is working at the application level.\n    If this fails after the readiness probe passed: the contract mismatch is confirmed.\n    The pod is Running. The application cannot serve database requests.\n    \"\"\"\n    print(\"  [Verify] Running post-rotation credential check...\")\n\n    result = subprocess.run(\n        [\"kubectl\", \"get\", \"pods\", \"-n\", namespace,\n         \"-l\", f\"app={deployment_name}\",\n         \"-o\", \"jsonpath={.items[0].metadata.name}\"],\n        capture_output=True, text=True\n    )\n    pod_name = result.stdout.strip()\n\n    if not pod_name:\n        print(\"  [Verify] ERROR: No running pod found for this deployment.\")\n        return False\n\n    verify = subprocess.run(\n        [\"kubectl\", \"exec\", pod_name, \"-n\", namespace,\n         \"--\", \"curl\", \"-sf\", \"http:\/\/localhost:8000\/healthz\/db\"],\n        capture_output=True, text=True\n    )\n\n    if verify.returncode != 0:\n        print(\"  [Verify] FAILED - Pod is Running but database authentication failed.\")\n        print(\"           The readiness probe validated HTTP reachability.\")\n        print(\"           The application cannot authenticate with the new credential.\")\n        print(\"           These are two different contracts. Only one was checked automatically.\")\n        return False\n\n    print(\"  [Verify] PASSED - Application confirmed it can authenticate with the new credential.\")\n    return True\n\n\ndef rotate(secret_name, new_password, namespace, k8s_secret_name, deployment_name):\n    print(\"n[Step 1\/6] Reading current secret from AWS Secrets Manager...\")\n    current = get_current_secret(secret_name)\n    username = current[\"username\"]\n\n    print(\"[Step 2\/6] Updating AWS Secrets Manager...\")\n    rotate_in_aws(secret_name, username, new_password)\n\n    print(\"[Step 3\/6] Rotating password at the database level (ALTER USER)...\")\n    rotate_postgres_password(namespace, new_password)\n\n    print(\"[Step 4\/6] Updating Kubernetes Secret object...\")\n    update_kubernetes_secret(namespace, k8s_secret_name, username, new_password)\n\n    print(\"[Step 5\/6] Triggering rolling restart...\")\n    rolling_restart(namespace, deployment_name)\n    wait_for_rollout(namespace, deployment_name)\n\n    print(\"[Step 6\/6] Verifying the new credential works at the application level...\")\n    success = verify_credential(namespace, deployment_name)\n\n    print(\"n\" + \"=\" * 60)\n    if success:\n        print(\"Rotation complete. Credential verified at the application level.\")\n    else:\n        print(\"Rotation incomplete. Readiness probe passed but credential verification failed.\")\n        print(\"Recommended action: force-restart all pods to flush the connection pool,\")\n        print(\"or investigate the database session timeout configuration.\")\n        sys.exit(1)\n\n\nif __name__ == \"__main__\":\n    import secrets as _secrets\n    rotate(\n        secret_name=\"myapp\/db-credentials\",\n        new_password=_secrets.token_urlsafe(16),\n        namespace=\"default\",\n        k8s_secret_name=\"db-credentials\",\n        deployment_name=\"myapp\"\n    )\n<\/code><\/pre>\n<h3 id=\"heading-how-the-script-works\">\u0627\u0633\u06a9\u0631\u067e\u0679 \u06a9\u06cc\u0633\u06d2 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/h3>\n<p><code>get_current_secret<\/code>    \u0646\u06cc\u0627 \u067e\u0627\u0633 \u0648\u0631\u0688 \u0628\u0646\u0627\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2\u060c AWS \u0633\u06cc\u06a9\u0631\u0679\u0633 \u0645\u06cc\u0646\u06cc\u062c\u0631 \u0622\u067e \u06a9\u06d2 \u0645\u0648\u062c\u0648\u062f\u06c1 \u0627\u0633\u0646\u0627\u062f \u06a9\u0648 \u067e\u0691\u06be\u062a\u0627 \u06c1\u06d2 \u062a\u0627\u06a9\u06c1 \u0627\u0633\u06a9\u0631\u067e\u0679 \u06a9\u0648 \u0622\u067e \u06a9\u0627 \u0635\u0627\u0631\u0641 \u0646\u0627\u0645 \u0645\u0639\u0644\u0648\u0645 \u06c1\u0648\u06d4<\/p>\n<p><code>rotate_in_aws<\/code>    \u0633\u06cc\u06a9\u0631\u0679\u0633 \u0645\u06cc\u0646\u06cc\u062c\u0631 \u06a9\u0648 \u0646\u0626\u06cc \u0627\u0633\u0646\u0627\u062f \u0644\u06a9\u06be\u06cc\u06ba\u06d4 \u0686\u0648\u0646\u06a9\u06c1 \u06c1\u0645 \u067e\u0686\u06be\u0644\u06d2 \u0648\u0631\u0698\u0646 \u06a9\u0648 \u0627\u0648\u0648\u0631 \u0631\u0627\u0626\u0679 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0628\u062c\u0627\u0626\u06d2 \u0627\u06cc\u06a9 \u0646\u06cc\u0627 \u0648\u0631\u0698\u0646 \u0628\u0646\u0627\u062a\u06d2 \u06c1\u06cc\u06ba\u060c \u0627\u0633 \u0644\u06cc\u06d2 \u06a9\u0686\u06be \u063a\u0644\u0637 \u06c1\u0648\u0646\u06d2 \u06a9\u06cc \u0635\u0648\u0631\u062a \u0645\u06cc\u06ba \u0648\u0627\u067e\u0633 \u0631\u0648\u0644 \u0628\u06cc\u06a9 \u06a9\u0631\u0646\u06d2 \u06a9\u0627 \u0648\u0642\u062a \u06a9\u0645 \u06c1\u0648\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p><code>_pg_password_literal<\/code>    \u0627\u0648\u0631 <code>rotate_postgres_password<\/code> \u06cc\u06c1 \u0627\u0633 \u0642\u062f\u0645 \u06a9\u0627 \u062e\u06cc\u0627\u0644 \u0631\u06a9\u06be\u062a\u0627 \u06c1\u06d2 \u062c\u0633\u06d2 \u0632\u06cc\u0627\u062f\u06c1 \u062a\u0631 \u0645\u062a\u0628\u0627\u062f\u0644 \u0627\u0633\u06a9\u0631\u067e\u0679\u0633 \u0686\u06be\u0648\u0691 \u062f\u06cc\u062a\u06d2 \u06c1\u06cc\u06ba: \u062f\u0631\u0627\u0635\u0644 PostgreSQL \u0645\u06cc\u06ba \u067e\u0627\u0633 \u0648\u0631\u0688 \u062a\u0628\u062f\u06cc\u0644 \u06a9\u0631\u0646\u0627\u06d4 \u06cc\u06c1 \u0686\u0644\u0627\u0646\u06d2 \u0633\u06d2 \u06a9\u06cc\u0627 \u062c\u0627\u062a\u0627 \u06c1\u06d2: <code>ALTER USER appuser PASSWORD '...'<\/code> \u0628\u0631\u0627\u06c1 \u0631\u0627\u0633\u062a \u067e\u0648\u0633\u0679\u06af\u0631\u06cc \u0627\u06cc\u0633 \u06a9\u06cc\u0648 \u0627\u06cc\u0644 \u067e\u0648\u0688 \u0633\u06d2\u06d4 \u0627\u0633 \u0642\u062f\u0645 \u0633\u06d2 \u067e\u06c1\u0644\u06d2\u060c \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u0627\u0628 \u0628\u06be\u06cc \u0622\u067e \u06a9\u0627 \u067e\u0631\u0627\u0646\u0627 \u067e\u0627\u0633 \u0648\u0631\u0688 \u0642\u0628\u0648\u0644 \u06a9\u0631\u06d2 \u06af\u0627\u06d4 \u0627\u0633 \u0642\u062f\u0645 \u06a9\u06d2 \u0628\u0639\u062f \u0646\u06c1\u06cc\u06ba\u06d4<\/p>\n<p><code>update_kubernetes_secret<\/code>    \u0646\u06cc\u0627 \u067e\u0627\u0633 \u0648\u0631\u0688 \u06a9\u0648\u0628\u0631\u0646\u06cc\u0679\u0633 \u0633\u06cc\u06a9\u0631\u0679 \u0645\u06cc\u06ba \u0631\u06cc\u06a9\u0627\u0631\u0688 \u06a9\u0631\u06cc\u06ba \u062a\u0627\u06a9\u06c1 \u0634\u0631\u0648\u0639 \u06c1\u0648\u0646\u06d2 \u0648\u0627\u0644\u06d2 \u06c1\u0631 \u0646\u0626\u06d2 \u067e\u0648\u0688 \u06a9\u0648 \u0634\u0631\u0648\u0639 \u0633\u06d2 \u06c1\u06cc \u0646\u0626\u06cc \u0627\u0633\u0646\u0627\u062f \u0645\u0644\u06cc\u06ba\u06d4<\/p>\n<p><code>rolling_restart<\/code>    \u0627\u0648\u0631 <code>wait_for_rollout<\/code> \u0627\u06cc\u067e\u0644\u06cc\u06a9\u06cc\u0634\u0646 \u067e\u0648\u0688\u0632 \u06a9\u0648 \u0627\u06cc\u06a9 \u0648\u0642\u062a \u0645\u06cc\u06ba \u062f\u0648\u0628\u0627\u0631\u06c1 \u0634\u0631\u0648\u0639 \u06a9\u0631\u06cc\u06ba \u062a\u0627\u06a9\u06c1 \u06cc\u06c1 \u06cc\u0642\u06cc\u0646\u06cc \u0628\u0646\u0627\u06cc\u0627 \u062c\u0627 \u0633\u06a9\u06d2 \u06a9\u06c1 \u0622\u067e \u06a9\u06cc \u062a\u0639\u06cc\u0646\u0627\u062a\u06cc \u067e\u0648\u0631\u06cc \u062c\u06af\u06c1 \u062f\u0633\u062a\u06cc\u0627\u0628 \u0631\u06c1\u06d2 \u06af\u06cc\u06d4 \u0627\u06cc\u06a9 \u0628\u0627\u0631 \u062c\u0628 \u06cc\u06c1 \u0645\u0631\u062d\u0644\u06c1 \u0645\u06a9\u0645\u0644 \u06c1\u0648 \u062c\u0627\u062a\u0627 \u06c1\u06d2\u060c \u062a\u0645\u0627\u0645 \u067e\u0648\u0688\u0632 \u0686\u0644 \u0631\u06c1\u06d2 \u06c1\u06cc\u06ba \u0627\u0648\u0631 \u062a\u06cc\u0627\u0631\u06cc \u06a9\u06cc \u062c\u0627\u0646\u0686 \u06af\u0632\u0631 \u0686\u06a9\u06cc \u06c1\u06d2\u06d4 \u0644\u06cc\u06a9\u0646 \u0630\u06c1\u0646 \u0645\u06cc\u06ba \u0631\u06a9\u06be\u06cc\u06ba \u06a9\u06c1 &quot;\u062f\u0648\u0691\u0646\u06d2&#8221; \u06a9\u0627 \u0645\u0637\u0644\u0628 \u0635\u0631\u0641 \u06a9\u0686\u06be \u06c1\u06d2\u06d4 <code>\/healthz<\/code> \u06cc\u06c1 200 \u0648\u0627\u067e\u0633 \u0622\u06cc\u0627\u060c \u062c\u0648 \u0627\u0633 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06d2 \u0645\u0639\u0627\u0645\u0644\u06d2 \u0645\u06cc\u06ba \u0645\u0633\u0626\u0644\u06c1 \u06c1\u06d2\u06d4<\/p>\n<p><code>verify_credential<\/code>    \u06cc\u06c1 \u0627\u06cc\u06a9 \u0627\u0636\u0627\u0641\u06cc \u0642\u062f\u0645 \u06c1\u06d2 \u062c\u0633\u06d2 Kubernetes \u06a9\u0628\u06be\u06cc \u0627\u0646\u062c\u0627\u0645 \u0646\u06c1\u06cc\u06ba \u062f\u06cc\u062a\u0627 \u06c1\u06d2\u06d4 \u0646\u0626\u06cc \u067e\u0648\u0688 \u06a9\u06d2 \u0627\u0646\u062f\u0631 \u067e\u06c1\u0646\u0686\u06cc\u06ba \u0627\u0648\u0631 \u0627\u0633\u06d2 \u06a9\u0627\u0644 \u06a9\u0631\u06cc\u06ba\u06d4 <code>\/healthz\/db<\/code>\u06cc\u06c1 \u067e\u0648\u0688 \u06a9\u06d2 \u0645\u0648\u062c\u0648\u062f\u06c1 \u0645\u0627\u062d\u0648\u0644 \u0633\u06d2 \u0627\u0633\u0646\u0627\u062f \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u062a\u06d2 \u06c1\u0648\u0626\u06d2 \u0627\u06cc\u06a9 \u062d\u0642\u06cc\u0642\u06cc \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u06a9\u0646\u06a9\u0634\u0646 \u06a9\u06be\u0648\u0644\u062a\u0627 \u06c1\u06d2\u06d4 \u0627\u06af\u0631 \u06cc\u06c1 \u06af\u0632\u0631 \u062c\u0627\u062a\u0627 \u06c1\u06d2 \u062a\u0648\u060c \u06af\u0631\u062f\u0634 \u0627\u0635\u0644 \u0645\u06cc\u06ba \u0645\u06a9\u0645\u0644 \u06c1\u06d2. \u0627\u06af\u0631 \u06cc\u06c1 \u062a\u06cc\u0627\u0631\u06cc \u06a9\u06cc \u062a\u062d\u0642\u06cc\u0642\u0627\u062a \u0633\u06d2 \u06af\u0632\u0631\u0646\u06d2 \u06a9\u06d2 \u0628\u0639\u062f \u0646\u0627\u06a9\u0627\u0645 \u06c1\u0648\u062c\u0627\u062a\u0627 \u06c1\u06d2\u060c \u062a\u0648 \u0622\u067e \u0646\u06d2 \u0627\u06cc\u06a9 \u062e\u0644\u0627 \u06a9\u06cc \u0646\u0634\u0627\u0646\u062f\u06c1\u06cc \u06a9\u06cc \u06c1\u06d2\u06d4 \u0627\u0633 \u06a9\u0627 \u0645\u0637\u0644\u0628 \u06c1\u06d2 \u06a9\u06c1 \u067e\u0648\u0688 \u0635\u062d\u062a \u0645\u0646\u062f \u062f\u06a9\u06be\u0627\u0626\u06cc \u062f\u06cc\u062a\u0627 \u06c1\u06d2 \u0644\u06cc\u06a9\u0646 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u06a9\u06cc \u062f\u0631\u062e\u0648\u0627\u0633\u062a\u0648\u06ba \u067e\u0631 \u06a9\u0627\u0631\u0631\u0648\u0627\u0626\u06cc \u0646\u06c1\u06cc\u06ba \u06a9\u0631 \u0633\u06a9\u062a\u0627\u06d4<\/p>\n<h3 id=\"heading-what-the-output-looks-like\">\u0622\u0624\u0679 \u067e\u0679 \u0646\u062a\u06cc\u062c\u06c1<\/h3>\n<p>\u06a9\u0627\u0645\u06cc\u0627\u0628 \u06af\u0631\u062f\u0634:<\/p>\n<pre><code class=\"language-plaintext\">[Step 1\/6] Reading current secret from AWS Secrets Manager...\n[Step 2\/6] Updating AWS Secrets Manager...\n  [AWS] Secrets Manager updated.\n[Step 3\/6] Rotating password at the database level (ALTER USER)...\n  [DB]  Running ALTER USER on PostgreSQL...\n  [DB]  Password changed at the database level.\n        New connections now require the new password.\n        Existing pool connections remain valid until they close.\n[Step 4\/6] Updating Kubernetes Secret object...\n  [K8s] Kubernetes Secret 'db-credentials' updated.\n[Step 5\/6] Triggering rolling restart...\n  [K8s] Rolling restart triggered for 'myapp'.\n  [K8s] Waiting for rollout (timeout: 120s)...\n  [K8s] Rollout complete. All pods report Ready.\n[Step 6\/6] Verifying the new credential works at the application level...\n  [Verify] Running post-rotation credential check...\n  [Verify] PASSED - Application confirmed it can authenticate with the new credential.\n\n============================================================\nRotation complete. Credential verified at the application level.\n  AWS Secrets Manager: updated\n  PostgreSQL:          updated (ALTER USER)\n  Kubernetes Secret:   updated\n  Application pod:     restarted, authenticated\n<\/code><\/pre>\n<p>\u0644\u06cc\u0628\u0627\u0631\u0679\u0631\u06cc \u0632\u0646\u062f\u06c1 \u06c1\u06d2 \u0627\u0648\u0631 \u067e\u0648\u0631\u06cc \u0633\u0631\u06a9\u0644\u0631 \u0686\u06cc\u0646 \u0633\u0631\u06d2 \u0633\u06d2 \u0622\u062e\u0631 \u062a\u06a9 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u06cc \u06c1\u06d2\u06d4<\/p>\n<p>\u06a9\u0633\u06cc \u0628\u06be\u06cc \u0686\u06cc\u0632 \u06a9\u0648 \u0631\u0648\u06a9\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u06cc\u0642\u06cc\u0646\u06cc \u0628\u0646\u0627\u0626\u06cc\u06ba \u06a9\u06c1 \u067e\u06be\u0644\u06cc \u0635\u062d\u062a \u0645\u0646\u062f \u06c1\u06d2\u06d4<\/p>\n<pre><code class=\"language-plaintext\">kubectl get pods\n<\/code><\/pre>\n<p>\u0622\u067e \u06a9\u0648 \u062f\u06cc\u06a9\u06be\u0646\u0627 \u0686\u0627\u06c1\u0626\u06d2 <code>myapp<\/code> \u0686\u0644\u0646\u06d2 \u06a9\u06cc \u062d\u06cc\u062b\u06cc\u062a\u06d4 \u06cc\u06c1 \u0628\u0646\u06cc\u0627\u062f\u06cc \u0628\u0627\u062a\u06cc\u06ba \u06c1\u06cc\u06ba\u06d4 \u0633\u0628 \u06a9\u0686\u06be \u062a\u0648\u0642\u0639 \u06a9\u06d2 \u0645\u0637\u0627\u0628\u0642 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u0627\u0628 \u06c1\u0645 \u0627\u0633\u06d2 \u062a\u0648\u0691 \u062f\u06cc\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/umang.pk\/wp-content\/uploads\/2026\/05\/1779904521_795_\u0631\u06cc\u0626\u0644-\u0648\u0631\u0644\u0688-\u0688\u06cc-\u0627\u0648-\u0627\u0648\u067e\u0633-\u0622\u0679\u0648\u0645\u06cc\u0634\u0646-\u06a9\u06d2-\u0644\u06cc\u06d2-\u0628\u0627\u0634-\u0627\u0648\u0631.png\" alt=\"\u0679\u0631\u0645\u06cc\u0646\u0644 \u0627\u0633\u06a9\u0631\u06cc\u0646 \u0634\u0627\u0679 &#039;kubectl get pods&#039; \u06a9\u0627 \u0622\u0624\u0679 \u067e\u0679 \u062f\u06a9\u06be\u0627 \u0631\u06c1\u0627 \u06c1\u06d2\" style=\"display:block;margin:0 auto\" width=\"600\" height=\"400\" loading=\"lazy\" title=\"\"><\/p>\n<h3 id=\"heading-break-it-on-purpose\">\u062c\u0627\u0646 \u0628\u0648\u062c\u06be \u06a9\u0631 \u062a\u0648\u0691 \u062f\u0648<\/h3>\n<h4 id=\"heading-step-1-desync-the-db\">\u0645\u0631\u062d\u0644\u06c1 1: \u0688\u06cc \u0628\u06cc \u0688\u06cc \u0633\u0646\u06a9\u0631\u0648\u0646\u0627\u0626\u0632\u06cc\u0634\u0646<\/h4>\n<pre><code class=\"language-plaintext\">.\/break_it.sh\n<\/code><\/pre>\n<p>\u06cc\u06c1 \u0686\u0644\u062a\u0627 \u06c1\u06d2\u06d4 <code>ALTER USER<\/code> \u063a\u0644\u0637 \u067e\u0627\u0633 \u0648\u0631\u0688 \u06a9\u06d2 \u0633\u0627\u062a\u06be PostgreSQL \u0633\u06d2 \u0628\u0631\u0627\u06c1 \u0631\u0627\u0633\u062a \u062c\u0691\u0646\u0627\u06d4 K8s \u0633\u06cc\u06a9\u0631\u06cc\u0679 \u0645\u06cc\u06ba \u0627\u0628 \u0628\u06be\u06cc \u067e\u0631\u0627\u0646\u0627 \u067e\u0627\u0633 \u0648\u0631\u0688 \u06c1\u06d2\u060c \u0627\u0633 \u0644\u06cc\u06d2 \u067e\u0648\u0688 \u06a9\u0627 \u0645\u0627\u062d\u0648\u0644 \u0627\u0648\u0631 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u0627\u0628 \u06c1\u0645 \u0622\u06c1\u0646\u06af\u06cc \u0633\u06d2 \u0628\u0627\u06c1\u0631 \u06c1\u06d2\u06d4<\/p>\n<h4 id=\"heading-step-2-check-what-kubernetes-sees\">\u0645\u0631\u062d\u0644\u06c1 2: \u0686\u06cc\u06a9 \u06a9\u0631\u06cc\u06ba \u06a9\u06c1 \u0622\u067e Kubernetes \u0645\u06cc\u06ba \u06a9\u06cc\u0627 \u062f\u06cc\u06a9\u06be\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/h4>\n<pre><code class=\"language-plaintext\">kubectl exec deployment\/myapp -- curl -s http:\/\/localhost:8000\/healthz\n<\/code><\/pre>\n<p>\u0622\u067e \u062f\u06cc\u06a9\u06be\u06cc\u06ba \u06af\u06d2 <code>{\"status\":\"ok\"}<\/code>. \u067e\u0648\u0688 \u0627\u0628 \u0628\u06be\u06cc \u06a9\u06c1\u062a\u0627 \u06c1\u06d2 \u062a\u06cc\u0627\u0631 \u0627\u0646\u062f\u0631\u06d4 <code>kubectl get pods<\/code>. \u06a9\u0628\u0631\u0646\u06cc\u0679\u0633 \u06a9\u0648 \u0627\u0646\u062f\u0627\u0632\u06c1 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2 \u06a9\u06c1 \u06a9\u06cc\u0627 \u063a\u0644\u0637 \u06c1\u06d2\u06d4 \u06cc\u06c1 \u0679\u0631\u0645\u06cc\u0646\u0644 \u0645\u06cc\u06ba \u0638\u0627\u06c1\u0631 \u06c1\u0648\u0646\u06d2 \u0648\u0627\u0644\u0627 \u0645\u0639\u0627\u06c1\u062f\u06c1 \u062e\u0627\u0644\u06cc \u06c1\u06d2\u06d4<\/p>\n<h4 id=\"heading-step-3-check-what-your-users-experience\">\u0645\u0631\u062d\u0644\u06c1 3: \u0635\u0627\u0631\u0641 \u06a9\u06d2 \u062a\u062c\u0631\u0628\u06d2 \u06a9\u06cc \u062a\u0635\u062f\u06cc\u0642 \u06a9\u0631\u06cc\u06ba\u06d4<\/h4>\n<pre><code class=\"language-plaintext\">kubectl exec deployment\/myapp -- curl -s http:\/\/localhost:8000\/healthz\/db\n<\/code><\/pre>\n<p>\u0622\u067e \u062f\u06cc\u06a9\u06be \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba <code>503<\/code> \u063a\u0644\u0637\u06cc \u0646\u06cc\u0627 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u06a9\u0646\u06a9\u0634\u0646 \u0646\u0627\u06a9\u0627\u0645 \u06c1\u0648 \u062c\u0627\u062a\u0627 \u06c1\u06d2\u06d4 \u0622\u067e \u06a9\u06d2 \u0635\u0627\u0631\u0641\u06cc\u0646 \u0627\u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u06c1\u06cc \u062f\u06cc\u06a9\u06be \u0631\u06c1\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<h4 id=\"heading-step-4-see-the-mixed-pattern-optional\">\u0645\u0631\u062d\u0644\u06c1 4: \u0645\u0644\u0627\u0648\u0679 \u0634\u062f\u06c1 \u067e\u06cc\u0679\u0631\u0646\u0632 \u062f\u06cc\u06a9\u06be\u06cc\u06ba (\u0627\u062e\u062a\u06cc\u0627\u0631\u06cc)<\/h4>\n<pre><code class=\"language-plaintext\">.\/load_test.sh\n<\/code><\/pre>\n<p>\u06a9\u0686\u06be \u062f\u0631\u062e\u0648\u0627\u0633\u062a\u06cc\u06ba \u06a9\u0627\u0645\u06cc\u0627\u0628 \u06c1\u0648 \u062c\u0627\u062a\u06cc \u06c1\u06cc\u06ba \u06a9\u06cc\u0648\u0646\u06a9\u06c1 \u0648\u06c1 \u062e\u0644\u0644 \u0688\u0627\u0644\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u067e\u0686\u06be\u0644\u06d2 \u062a\u0648\u062b\u06cc\u0642 \u0634\u062f\u06c1 \u067e\u0648\u0644 \u06a9\u0646\u06a9\u0634\u0646 \u062a\u06a9 \u067e\u06c1\u0646\u0686 \u062c\u0627\u062a\u06cc \u06c1\u06cc\u06ba\u06d4 \u06a9\u0686\u06be \u0646\u0627\u06a9\u0627\u0645 \u06c1\u0648 \u062c\u0627\u062a\u06d2 \u06c1\u06cc\u06ba \u06a9\u06cc\u0648\u0646\u06a9\u06c1 \u0627\u0646\u06c1\u06cc\u06ba \u0646\u0626\u06d2 \u06a9\u0646\u06a9\u0634\u0646 \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u06c1\u0648\u062a\u06cc \u06c1\u06d2\u06d4 \u067e\u06be\u0644\u06cc\u0627\u06ba \u0635\u062d\u062a \u0645\u0646\u062f \u0646\u0638\u0631 \u0622\u062a\u06cc \u06c1\u06cc\u06ba\u060c \u0644\u06cc\u06a9\u0646 \u0679\u0631\u06cc\u0641\u06a9 \u06a9\u0627 \u0622\u062f\u06be\u0627 \u062d\u0635\u06c1 \u0646\u0627\u06a9\u0627\u0645 \u06c1\u0648 \u0631\u06c1\u0627 \u06c1\u06d2\u06d4<\/p>\n<h4 id=\"heading-step-5-run-the-rotation-script\">\u0645\u0631\u062d\u0644\u06c1 5: \u0633\u0631\u06a9\u0644\u0631 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0686\u0644\u0627\u0626\u06cc\u06ba\u06d4<\/h4>\n<pre><code class=\"language-plaintext\">python rotate_secret.py\n<\/code><\/pre>\n<p>\u0627\u0633 \u0628\u0627\u0631 \u06c1\u0645 \u0646\u0627\u06a9\u0627\u0645\u06cc \u06a9\u0648 \u0645\u0631\u062d\u0644\u06c1 6 \u0645\u06cc\u06ba \u062f\u06cc\u06a9\u06be\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 \u06cc\u06c1 \u06c1\u06d2 \u062c\u0648 \u0622\u067e \u062f\u06cc\u06a9\u06be\u062a\u06d2 \u06c1\u06cc\u06ba:<\/p>\n<pre><code class=\"language-plaintext\">[Step 5\/6] Triggering rolling restart...\n  [K8s] Rollout complete. All pods report Ready.\n[Step 6\/6] Verifying the new credential works at the application level...\n  [Verify] Running post-rotation credential check...\n  [Verify] FAILED - Pod is Running but database authentication failed.\n           The readiness probe validated HTTP reachability.\n           The application cannot authenticate with the new credential.\n           These are two different contracts. Only one was checked automatically.\n\n============================================================\nRotation incomplete. Readiness probe passed but credential verification failed.\n<\/code><\/pre>\n<p>\u067e\u06be\u0644\u06cc \u0686\u0644 \u0631\u06c1\u06cc \u06c1\u06d2 \u0627\u0648\u0631 \u062a\u06cc\u0627\u0631 \u062f\u06a9\u06be\u0627\u0626\u06cc \u062f\u06cc\u062a\u06cc \u06c1\u06d2\u06d4 <code>kubectl get pods<\/code>. \u0645\u062a\u0628\u0627\u062f\u0644 \u0627\u0633\u06a9\u0631\u067e\u0679 \u06a9\u0627 \u06a9\u06c1\u0646\u0627 \u06c1\u06d2 \u06a9\u06c1 \u0627\u0633\u0646\u0627\u062f \u0633\u06d2 \u0633\u0645\u062c\u06be\u0648\u062a\u06c1 \u06a9\u06cc\u0627 \u06af\u06cc\u0627 \u06c1\u06d2\u06d4 \u06cc\u06c1 \u06a9\u0646\u0679\u0631\u06cc\u06a9\u0679 \u0648\u0627\u0626\u0679 \u0627\u0633\u067e\u06cc\u0633 \u06c1\u06d2 \u062c\u0648 \u0679\u0631\u0645\u06cc\u0646\u0644 \u0645\u06cc\u06ba \u0646\u0638\u0631 \u0622\u062a\u06cc \u06c1\u06d2\u060c \u0635\u0627\u0631\u0641 \u06a9\u06d2 \u062f\u0628\u0627\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u067e\u06a9\u0691\u06cc \u062c\u0627\u062a\u06cc \u06c1\u06d2\u06d4<\/p>\n<p><strong>\u0633\u0628\u0642:<\/strong> <code>\/healthz<\/code>    \u06cc\u06c1 \u0622\u067e \u06a9\u0648 \u0628\u062a\u0627\u062a\u0627 \u06c1\u06d2 \u06a9\u06c1 HTTP \u0633\u0631\u0648\u0631 \u0632\u0646\u062f\u06c1 \u06c1\u06d2\u06d4 <code>\/healthz\/db<\/code> \u06cc\u06c1 \u0622\u067e \u06a9\u0648 \u0628\u062a\u0627\u062a\u0627 \u06c1\u06d2 \u06a9\u06c1 \u0627\u06cc\u067e\u0644\u06cc \u06a9\u06cc\u0634\u0646 \u062f\u0631\u0627\u0635\u0644 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u0633\u06d2 \u062c\u0691 \u0633\u06a9\u062a\u06cc \u06c1\u06d2\u06d4 Kubernetes \u0635\u0631\u0641 \u067e\u06c1\u0644\u06cc \u0622\u0626\u0679\u0645 \u06a9\u0648 \u0686\u06cc\u06a9 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u062c\u0628 \u062a\u06a9 \u06a9\u06c1 \u0622\u067e \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u067e\u0631\u0648\u0628 \u0634\u0627\u0645\u0644 \u0646\u06c1 \u06a9\u0631\u06cc\u06ba\u06d4 \u0645\u062a\u0628\u0627\u062f\u0644 \u0627\u0633\u06a9\u0631\u067e\u0679 \u06c1\u0631 \u0645\u062a\u0628\u0627\u062f\u0644 \u06a9\u06d2 \u0622\u062e\u0631 \u0645\u06cc\u06ba \u0627\u06cc\u06a9 \u0686\u06cc\u06a9 \u06a9\u0627 \u0627\u0636\u0627\u0641\u06c1 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u062a\u0627\u06a9\u06c1 \u0622\u067e \u063a\u0644\u0637\u06cc\u0648\u06ba \u06a9\u06d2 \u0646\u0627\u06a9\u0627\u0645 \u06c1\u0648\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u0627\u0646 \u06a9\u0648 \u067e\u06a9\u0691 \u0633\u06a9\u06cc\u06ba\u06d4<\/p>\n<h3 id=\"heading-the-decision-the-script-cant-make-for-you\">\u0648\u06c1 \u0641\u06cc\u0635\u0644\u06d2 \u062c\u0648 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0646\u06c1\u06cc\u06ba \u06a9\u0631 \u0633\u06a9\u062a\u0627<\/h3>\n<p>\u062a\u0635\u062f\u06cc\u0642 \u0646\u0627\u06a9\u0627\u0645 \u06c1\u0648\u06af\u0626\u06cc\u060c \u067e\u0648\u0688 \u0686\u0644 \u0631\u06c1\u0627 \u06c1\u06d2\u060c \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u06a9\u06cc \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u0646\u0627\u06a9\u0627\u0645 \u06c1\u0648\u06af\u0626\u06cc\u06d4 \u062f\u0648 \u0627\u062e\u062a\u06cc\u0627\u0631\u0627\u062a \u06c1\u06cc\u06ba:<\/p>\n<ol>\n<li>\n<p>\u06a9\u0646\u06a9\u0634\u0646 \u067e\u0648\u0644 \u06a9\u0648 \u0641\u0644\u0634 \u06a9\u0631\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0627\u06cc\u06a9 \u0633\u0627\u062a\u06be \u062a\u0645\u0627\u0645 \u067e\u0648\u0688\u0632 \u06a9\u0648 \u062f\u0648\u0628\u0627\u0631\u06c1 \u0634\u0631\u0648\u0639 \u06a9\u0631\u0646\u06d2 \u067e\u0631 \u0645\u062c\u0628\u0648\u0631 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 (\u062a\u06cc\u0632\u060c \u0644\u06cc\u06a9\u0646 \u0635\u0644\u0627\u062d\u06cc\u062a \u0645\u06cc\u06ba \u062a\u06be\u0648\u0691\u06cc \u06a9\u0645\u06cc \u06a9\u06d2 \u0633\u0627\u062a\u06be)\u06d4<\/p>\n<\/li>\n<li>\n<p>\u067e\u0686\u06be\u0644\u06d2 \u0633\u06cc\u0634\u0646 \u06a9\u06d2 \u0642\u062f\u0631\u062a\u06cc \u0637\u0648\u0631 \u067e\u0631 \u062e\u062a\u0645 \u06c1\u0648\u0646\u06d2 \u06a9\u0627 \u0627\u0646\u062a\u0638\u0627\u0631 \u06a9\u0631\u06cc\u06ba (\u06cc\u06c1 \u0688\u0627\u0624\u0646 \u0679\u0627\u0626\u0645 \u06a9\u0648 \u0631\u0648\u06a9\u062a\u0627 \u06c1\u06d2\u060c \u0644\u06cc\u06a9\u0646 \u067e\u0644 \u0633\u0627\u0626\u06cc\u06a9\u0644 \u062a\u06a9 \u062f\u0631\u062e\u0648\u0627\u0633\u062a\u0648\u06ba \u06a9\u0648 \u0648\u0642\u0641\u06d2 \u0648\u0642\u0641\u06d2 \u0633\u06d2 \u0646\u0627\u06a9\u0627\u0645 \u06c1\u0648\u0646\u06d2 \u06a9\u0627 \u0633\u0628\u0628 \u0628\u0646\u062a\u0627 \u06c1\u06d2)\u06d4<\/p>\n<\/li>\n<\/ol>\n<p>\u0627\u0633\u06a9\u0631\u067e\u0679 \u0646\u06d2 \u0645\u0633\u0626\u0644\u06c1 \u062f\u0631\u06cc\u0627\u0641\u062a \u06a9\u0631 \u0644\u06cc\u0627 \u06c1\u06d2\u060c \u0644\u06cc\u06a9\u0646 \u06cc\u06c1 \u0627\u0646\u062c\u06cc\u0646\u0626\u0631 \u067e\u0631 \u0645\u0646\u062d\u0635\u0631 \u06c1\u06d2 \u062c\u0648 \u0633\u0633\u0679\u0645 \u06a9\u0648 \u062c\u0627\u0646\u062a\u0627 \u06c1\u06d2 \u06a9\u06c1 \u0648\u06c1 \u0641\u06cc\u0635\u0644\u06c1 \u06a9\u0631\u06d2 \u06a9\u06c1 \u0622\u06af\u06d2 \u06a9\u06cc\u0627 \u06a9\u0631\u0646\u0627 \u06c1\u06d2\u06d4<\/p>\n<h3 id=\"heading-teardown\">\u06af\u0644\u0646\u0627<\/h3>\n<pre><code class=\"language-plaintext\">.\/teardown.sh\n<\/code><\/pre>\n<h2 id=\"heading-use-case-5-automated-canary-rollback-trigger\">\u06a9\u06cc\u0633 5 \u06a9\u0627 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0631\u06cc\u06ba &#8211; \u062e\u0648\u062f\u06a9\u0627\u0631 \u06a9\u06cc\u0646\u0631\u06cc \u0631\u0648\u0644 \u0628\u06cc\u06a9 \u0679\u0631\u06af\u0631<\/h2>\n<p><strong>\u0645\u0627\u062d\u0648\u0644:<\/strong> \u0645\u06a9\u0645\u0644 \u0637\u0648\u0631 \u067e\u0631 \u0645\u0642\u0627\u0645\u06cc &#8211; \u0642\u0633\u0645\u060c \u06c1\u06cc\u0644\u0645 \u06a9\u06d2 \u0630\u0631\u06cc\u0639\u06d2 Prometheus<br \/><strong>\u0632\u0628\u0627\u0646:<\/strong> bash<\/p>\n<h3 id=\"heading-what-this-use-case-does-and-why-it-matters\">\u06cc\u06c1 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06cc\u0633 \u06a9\u06cc\u0627 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u0627\u0648\u0631 \u06cc\u06c1 \u06a9\u06cc\u0648\u06ba \u0627\u06c1\u0645\u06cc\u062a \u0631\u06a9\u06be\u062a\u0627 \u06c1\u06d2\u06d4<\/h3>\n<p>\u06cc\u06c1 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0627 \u06a9\u06cc\u0633 \u0627\u06cc\u06a9 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0686\u0644\u0627\u062a\u0627 \u06c1\u06d2 \u062c\u0648 \u0646\u0626\u06cc \u062a\u0639\u06cc\u0646\u0627\u062a\u06cc\u0648\u06ba \u06a9\u0648 \u062f\u06cc\u06a9\u06be\u062a\u0627 \u06c1\u06d2 \u0627\u0648\u0631 \u0627\u06af\u0631 \u0635\u0627\u0631\u0641 \u0633\u067e\u0648\u0631\u0679 \u06a9\u06cc \u0642\u0637\u0627\u0631 \u0645\u06cc\u06ba \u0633\u06cc\u0644\u0627\u0628 \u0622\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u06a9\u0686\u06be \u063a\u0644\u0637 \u06c1\u0648 \u062c\u0627\u062a\u0627 \u06c1\u06d2 \u062a\u0648 \u062e\u0648\u062f \u0628\u062e\u0648\u062f \u0648\u0627\u067e\u0633 \u0686\u0644\u0627 \u062c\u0627\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u06cc\u06c1 \u067e\u0631\u0648\u0688\u06a9\u0634\u0646 \u0645\u06cc\u06ba \u0627\u06c1\u0645 \u06c1\u06d2 \u06a9\u06cc\u0648\u0646\u06a9\u06c1 \u062c\u0628 \u0622\u067e \u0646\u06cc\u0627 \u0648\u0631\u0698\u0646 \u062c\u0627\u0631\u06cc \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u060c \u062a\u0648 \u062a\u0645\u0627\u0645 \u0679\u0631\u06cc\u0641\u06a9 \u0641\u0648\u0631\u06cc \u0637\u0648\u0631 \u067e\u0631 \u0646\u06c1\u06cc\u06ba \u067e\u06c1\u0646\u0686 \u062c\u0627\u0626\u06d2 \u06af\u06cc\u06d4 \u0645\u062b\u0627\u0644 \u06a9\u06d2 \u0637\u0648\u0631 \u067e\u0631\u060c \u0627\u06cc\u06a9 \u0686\u06be\u0648\u0679\u0627 \u0679\u06a9\u0691\u0627 \u0628\u06be\u06cc\u062c\u06cc\u06ba \u062c\u06c1\u0627\u06ba 20% \u0646\u0626\u06d2 \u0648\u0631\u0698\u0646 \u0645\u06cc\u06ba \u0628\u06be\u06cc\u062c\u06d2 \u062c\u0627\u0626\u06cc\u06ba \u0627\u0648\u0631 80% \u067e\u0631\u0627\u0646\u06d2 \u0648\u0631\u0698\u0646 \u0645\u06cc\u06ba \u0628\u06be\u06cc\u062c\u06d2 \u062c\u0627\u0626\u06cc\u06ba\u06d4 \u0627\u06af\u0631 \u06a9\u0648\u0626\u06cc \u0646\u06cc\u0627 \u0648\u0631\u0698\u0646 \u0679\u0648\u0679 \u062c\u0627\u062a\u0627 \u06c1\u06d2\u060c \u062a\u0648 \u0635\u0631\u0641 20% \u0635\u0627\u0631\u0641\u06cc\u0646 \u0645\u062a\u0627\u062b\u0631 \u06c1\u0648\u06ba \u06af\u06d2 \u0627\u0648\u0631 \u0646\u0642\u0635\u0627\u0646 \u067e\u06be\u06cc\u0644\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u0627\u0633\u06d2 \u0648\u0627\u067e\u0633 \u0644\u06cc\u0627 \u062c\u0627 \u0633\u06a9\u062a\u0627 \u06c1\u06d2\u06d4 \u0644\u06cc\u06a9\u0646 \u0631\u0648\u0644 \u0628\u06cc\u06a9 \u0635\u0631\u0641 \u0627\u0633 \u0635\u0648\u0631\u062a \u0645\u06cc\u06ba \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u062c\u0628 \u0622\u067e \u0635\u062d\u06cc\u062d \u0645\u0648\u0627\u062f \u06a9\u0648 \u062f\u06cc\u06a9\u06be \u0631\u06c1\u06d2 \u06c1\u0648\u06ba\u06d4<\/p>\n<p><strong>\u06af\u06be\u0631 \u0645\u06cc\u06ba \u06a9\u06cc\u0627 \u0644\u06d2 \u062c\u0627\u0646\u0627 \u06c1\u06d2:<\/strong> \u062f\u0648 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0627\u06cc\u06a9 \u06c1\u06cc \u0646\u0627\u06a9\u0627\u0645 \u06a9\u06cc\u0646\u0631\u06cc \u06a9\u06d2 \u0644\u06cc\u06d2 \u062f\u06cc\u06a9\u06be\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 \u0627\u06cc\u06a9 \u0627\u0637\u0644\u0627\u0639 \u062f\u06cc\u062a\u0627 \u06c1\u06d2 \u06a9\u06c1 \u0633\u0628 \u06a9\u0686\u06be \u0679\u06be\u06cc\u06a9 \u06c1\u06d2\u06d4 \u062f\u0648\u0633\u0631\u0627 \u0627\u06cc\u06a9 \u0631\u0648\u0644 \u0628\u06cc\u06a9 \u0634\u0631\u0648\u0639 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 \u0641\u0631\u0642 \u0635\u0631\u0641 \u0648\u06c1\u06cc \u06c1\u06d2 \u062c\u0648 \u0646\u0627\u067e\u0627 \u062c\u0627\u062a\u0627 \u06c1\u06d2\u06d4 \u0622\u0679\u0648\u0645\u06cc\u0634\u0646 \u0635\u0631\u0641 \u0627\u062a\u0646\u0627 \u06c1\u06cc \u0627\u0686\u06be\u0627 \u06c1\u06d2 \u062c\u062a\u0646\u0627 \u0622\u067e \u062f\u06cc\u06a9\u06be\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p><strong>\u0646\u0648\u0679 \u06a9\u0631\u0646\u06d2 \u06a9\u06cc \u0686\u06cc\u0632\u06cc\u06ba:<\/strong> <code>canary_watch_v1.sh<\/code>    \u06cc\u06c1 \u0635\u0631\u0641 \u063a\u0644\u0637\u06cc\u0648\u06ba \u06a9\u0648 \u062f\u06cc\u06a9\u06be\u062a\u0627 \u06c1\u06d2 \u0627\u0648\u0631 \u0627\u0633 \u0648\u0642\u062a \u062a\u06a9 \u062e\u0627\u0645\u0648\u0634 \u0631\u06c1\u062a\u0627 \u06c1\u06d2 \u062c\u0628 \u062a\u06a9 \u06a9\u06cc\u0646\u0631\u06cc \u0633\u0633\u062a \u06c1\u0648\u06d4 <code>canary_watch_v2.sh<\/code> \u063a\u0644\u0637\u06cc\u0648\u06ba \u0627\u0648\u0631 \u062c\u0648\u0627\u0628\u06cc \u0627\u0648\u0642\u0627\u062a \u06a9\u0627 \u0645\u0634\u0627\u06c1\u062f\u06c1 \u06a9\u0631\u06cc\u06ba \u0627\u0648\u0631 \u0631\u0648\u0644 \u0628\u06cc\u06a9 \u0634\u0631\u0648\u0639 \u06a9\u0631\u06cc\u06ba\u06d4 \u0627\u0646 \u0645\u06cc\u06ba \u0641\u0631\u0642 \u0633\u0628\u0642 \u06a9\u0627 \u06c1\u06d2\u06d4<\/p>\n<p><strong>\u06cc\u06c1 \u06a9\u06cc\u0627 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2:<\/strong> \u06cc\u06c1 \u06a9\u06cc\u0646\u0631\u06cc \u06a9\u0648 \u062a\u0639\u06cc\u0646\u0627\u062a \u06a9\u0631\u0646\u06d2 \u06a9\u0627 \u0631\u06c1\u0646\u0645\u0627 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4 \u06cc\u06c1 \u0627\u0633 \u06a9\u06d2 \u0628\u0627\u0631\u06d2 \u0645\u06cc\u06ba \u06c1\u06d2 \u06a9\u06c1 \u062c\u0628 \u0622\u067e \u0635\u0631\u0641 \u0627\u06cc\u06a9 \u0633\u06af\u0646\u0644 \u06a9\u0648 \u062f\u06cc\u06a9\u06be\u062a\u06d2 \u06c1\u06cc\u06ba \u062a\u0648 \u0646\u06af\u0631\u0627\u0646\u06cc \u0633\u06d2 \u06a9\u06cc\u0627 \u06a9\u0645\u06cc \u0645\u062d\u0633\u0648\u0633 \u06c1\u0648\u062a\u06cc \u06c1\u06d2\u06d4<\/p>\n<h3 id=\"heading-how-it-works\">\u06cc\u06c1 \u06a9\u06cc\u0633\u06d2 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/h3>\n<p>\u06a9\u0644\u0633\u0679\u0631 \u067e\u0631 \u062a\u06cc\u0646 \u0686\u06cc\u0632\u06cc\u06ba \u0686\u0644 \u0631\u06c1\u06cc \u06c1\u06cc\u06ba: \u0627\u06cc\u06a9 \u0645\u0633\u062a\u062d\u06a9\u0645 \u0627\u06cc\u067e (3 \u067e\u0648\u0688\u0632\u060c \u0632\u06cc\u0627\u062f\u06c1 \u062a\u0631 \u0679\u0631\u06cc\u0641\u06a9 \u06a9\u0648 \u0633\u0646\u0628\u06be\u0627\u0644\u0646\u0627)\u060c \u0627\u06cc\u06a9 \u06a9\u06cc\u0646\u0631\u06cc \u0627\u06cc\u067e (1 \u067e\u0648\u0688\u060c \u0627\u06cc\u06a9 \u0686\u06be\u0648\u0679\u0627 \u0633\u0627 \u0679\u06a9\u0691\u0627 \u06c1\u06cc\u0646\u0688\u0644 \u06a9\u0631\u0646\u0627)\u060c \u0627\u0648\u0631 \u067e\u0631\u0648\u0645\u06cc\u062a\u06be\u06cc\u0633 (\u06c1\u0631 15 \u0633\u06cc\u06a9\u0646\u0688 \u0645\u06cc\u06ba \u062f\u0648\u0646\u0648\u06ba \u062c\u06af\u06c1\u0648\u06ba \u0633\u06d2 \u062c\u0648\u0627\u0628\u06cc \u0627\u0648\u0642\u0627\u062a \u0627\u0648\u0631 \u063a\u0644\u0637\u06cc \u06a9\u06cc \u06af\u0646\u062a\u06cc \u062c\u0645\u0639 \u06a9\u0631\u0646\u0627)\u06d4<\/p>\n<p>\u0648\u0627\u0686 \u0627\u0633\u06a9\u0631\u067e\u0679 \u06c1\u0631 15 \u0633\u06cc\u06a9\u0646\u0688 \u0645\u06cc\u06ba \u067e\u0631\u0648\u0645\u06cc\u062a\u06be\u06cc\u0633 \u0633\u06d2 \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u06a9\u0631\u062a\u06cc \u06c1\u06d2\u06d4 <em>&quot;\u06a9\u06cc\u0627 \u06a9\u06cc\u0646\u0631\u06cc \u0639\u0627\u0645 \u0637\u0648\u0631 \u067e\u0631 \u0628\u0631\u062a\u0627\u0624 \u06a9\u0631 \u0631\u06c1\u06cc \u06c1\u06d2\u061f&#8221;<\/em> \u0627\u06af\u0631 \u0645\u0633\u0644\u0633\u0644 \u062a\u06cc\u0646 \u0686\u06cc\u06a9\u0648\u06ba \u06a9\u06d2 \u0644\u06cc\u06d2 \u062c\u0648\u0627\u0628 \u0646\u0641\u06cc \u0645\u06cc\u06ba \u06c1\u06d2\u060c \u062a\u0648 \u06a9\u06cc\u0646\u0631\u06cc \u062e\u0648\u062f \u0628\u062e\u0648\u062f \u0648\u0627\u067e\u0633 \u0686\u0644\u0627 \u062c\u0627\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u0633\u0648\u0627\u0644 \u06cc\u06c1 \u06c1\u06d2 \u06a9\u06c1 \u0622\u067e \u06a9\u06cc\u0627 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u061f <em>&quot;\u0639\u0627\u0645 \u0628\u0631\u062a\u0627\u0624 \u06a9\u0631\u0648&#8221;<\/em> \u0627\u0648\u0633\u0637\u061f \u06cc\u06c1 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0627 \u067e\u0648\u0631\u0627 \u0645\u0639\u0627\u0645\u0644\u06c1 \u06c1\u06d2\u06d4<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/umang.pk\/wp-content\/uploads\/2026\/05\/1779904521_284_\u0631\u06cc\u0626\u0644-\u0648\u0631\u0644\u0688-\u0688\u06cc-\u0627\u0648-\u0627\u0648\u067e\u0633-\u0622\u0679\u0648\u0645\u06cc\u0634\u0646-\u06a9\u06d2-\u0644\u06cc\u06d2-\u0628\u0627\u0634-\u0627\u0648\u0631.png\" alt=\"\u0679\u0631\u0645\u06cc\u0646\u0644 \u0627\u0633\u06a9\u0631\u06cc\u0646 \u0634\u0627\u0679 &#039;kubectl get pods&#039; \u06a9\u0627 \u0622\u0624\u0679 \u067e\u0679 \u062f\u06a9\u06be\u0627 \u0631\u06c1\u0627 \u06c1\u06d2\" style=\"display:block;margin:0 auto\" width=\"600\" height=\"400\" loading=\"lazy\" title=\"\"><\/p>\n<h3 id=\"heading-set-up-the-demo-environment\">\u0688\u06cc\u0645\u0648 \u06a9\u06cc \u062a\u0631\u062a\u06cc\u0628\u0627\u062a<\/h3>\n<p>\u0627\u06af\u0644\u06d2 \u067e\u0631 \u062c\u0627\u0626\u06cc\u06ba\u06d4 <code>05-canary-rollback\/<\/code> \u067e\u06be\u0631 \u0686\u0644\u0627\u0626\u06cc\u06ba:<\/p>\n<pre><code class=\"language-plaintext\">cd 05-canary-rollback\n.\/setup.sh\n<\/code><\/pre>\n<p>\u0627\u0633\u06d2 \u062a\u0631\u062a\u06cc\u0628 \u062f\u06cc\u0646\u06d2 \u0645\u06cc\u06ba \u0686\u0646\u062f \u0645\u0646\u0679 \u0644\u06af\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 Prometheus \u0627\u0646\u0633\u0679\u0627\u0644 \u06a9\u0631\u06cc\u06ba\u060c \u0688\u06cc\u0645\u0648 \u0627\u06cc\u067e \u06a9\u06d2 \u062f\u0648 \u0648\u0631\u0698\u0646 \u0644\u06af\u0627\u0626\u06cc\u06ba\u060c \u0627\u0648\u0631 \u0627\u06cc\u06a9 \u0644\u0648\u0688 \u062c\u0646\u0631\u06cc\u0679\u0631 \u067e\u0648\u0688 \u0634\u0631\u0648\u0639 \u06a9\u0631\u06cc\u06ba \u062c\u0648 \u062f\u0648\u0646\u0648\u06ba \u0648\u0631\u0698\u0646\u0632 \u067e\u0631 \u0645\u0633\u0644\u0633\u0644 \u0679\u0631\u06cc\u0641\u06a9 \u0628\u06be\u06cc\u062c\u062a\u0627 \u06c1\u06d2 \u062a\u0627\u06a9\u06c1 Prometheus \u06a9\u06d2 \u067e\u0627\u0633 \u06c1\u0645\u06cc\u0634\u06c1 \u0688\u06cc\u0679\u0627 \u0645\u0648\u062c\u0648\u062f \u0631\u06c1\u06d2\u06d4<\/p>\n<p>\u0633\u06cc\u0679 \u0627\u067e \u0645\u06a9\u0645\u0644 \u06c1\u0648\u0646\u06d2 \u06a9\u06d2 \u0628\u0639\u062f\u060c \u06cc\u0642\u06cc\u0646\u06cc \u0628\u0646\u0627\u0626\u06cc\u06ba \u06a9\u06c1 \u0633\u0628 \u06a9\u0686\u06be \u0686\u0644 \u0631\u06c1\u0627 \u06c1\u06d2\u06d4<\/p>\n<pre><code class=\"language-plaintext\">kubectl get pods\n<\/code><\/pre>\n<p>\u0622\u067e \u0627\u0633 \u0637\u0631\u062d \u0622\u0624\u0679 \u067e\u0679 \u062f\u06cc\u06a9\u06be\u06cc\u06ba \u06af\u06d2:<\/p>\n<pre><code class=\"language-plaintext\">NAME                                                   READY   STATUS    RESTARTS   AGE\nload-generator-68c59698b7-kws2l                        1\/1     Running   0          4m54s\nmyapp-canary-6d6979c66f-g9lgw                          1\/1     Running   0          32s\nmyapp-stable-6bcf994fc4-b4k9l                          1\/1     Running   0          4m55s\nmyapp-stable-6bcf994fc4-ndhxc                          1\/1     Running   0          4m55s\nmyapp-stable-6bcf994fc4-z97kx                          1\/1     Running   0          4m55s\nprometheus-kube-prometheus-operator-59b847d96c-mp72s   1\/1     Running   0          5m58s\nprometheus-prometheus-kube-prometheus-prometheus-0     2\/2     Running   0          5m1s\n<\/code><\/pre>\n<p>\u0645\u06cc\u0631\u06d2 \u067e\u0627\u0633 3 \u0645\u0633\u062a\u062d\u06a9\u0645 \u067e\u0648\u0688\u0632\u060c 1 \u06a9\u06cc\u0646\u0631\u06cc \u067e\u0648\u0688\u060c 1 \u0644\u0648\u0688 \u062c\u0646\u0631\u06cc\u0679\u0631\u060c \u0627\u0648\u0631 \u067e\u0631\u0648\u0645\u06cc\u062a\u06be\u06cc\u0633 \u0686\u0644 \u0631\u06c1\u0627 \u06c1\u06d2\u06d4 \u0644\u06cc\u0628 \u0632\u0646\u062f\u06c1 \u06c1\u06d2\u06d4<\/p>\n<p><strong>\u0628\u0631\u0627\u06c1 \u06a9\u0631\u0645 \u06a9\u0648\u0626\u06cc \u0627\u0648\u0631 \u06a9\u0627\u0645 \u06a9\u0631\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 60 \u0633\u06cc\u06a9\u0646\u0688 \u0627\u0646\u062a\u0638\u0627\u0631 \u06a9\u0631\u06cc\u06ba\u06d4<\/strong> Prometheus \u06a9\u0648 Pod \u0633\u06d2 \u067e\u06c1\u0644\u06cc \u0645\u06cc\u0679\u0631\u06a9 \u06a9\u0648 \u06a9\u06be\u0631\u0686\u0646\u06d2 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0648\u0642\u062a \u062f\u0631\u06a9\u0627\u0631 \u06c1\u0648\u062a\u0627 \u06c1\u06d2\u06d4 \u0627\u06af\u0631 \u0622\u067e \u0627\u0633\u06d2 \u0686\u06be\u0648\u0691 \u062f\u06cc\u062a\u06d2 \u06c1\u06cc\u06ba\u060c \u062a\u0648 \u0648\u0627\u0686 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0628\u063a\u06cc\u0631 \u06a9\u0633\u06cc \u0648\u0636\u0627\u062d\u062a \u06a9\u06d2 \u062e\u0627\u0644\u06cc \u0688\u06cc\u0679\u0627 \u0644\u0648\u0679\u0627\u0626\u06d2 \u06af\u0627\u06d4<\/p>\n<h3 id=\"heading-three-terminal-windows\">3-\u0679\u0631\u0645\u06cc\u0646\u0644 \u0648\u0646\u0688\u0648<\/h3>\n<p>\u0627\u0633 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0628\u06cc\u06a9 \u0648\u0642\u062a \u062a\u06cc\u0646 \u0627\u0644\u06af \u0627\u0644\u06af \u06a9\u0645\u0627\u0646\u0688 \u067e\u0631\u0627\u0645\u067e\u0679\u0633 \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u06c1\u06d2\u06d4<\/p>\n<p><strong>macOS \u06a9\u06d2 \u0644\u06cc\u06d2:<\/strong> \u0679\u0631\u0645\u06cc\u0646\u0644 \u06a9\u06be\u0648\u0644\u06cc\u06ba \u0627\u0648\u0631 \u062f\u0628\u0627\u0626\u06cc\u06ba\u06d4 <code>Cmd+T<\/code> \u0688\u0628\u0644\u06d4 \u0627\u0628 \u0622\u067e \u06a9\u06d2 \u067e\u0627\u0633 \u062a\u06cc\u0646 \u0679\u06cc\u0628\u0632 \u06c1\u06cc\u06ba\u060c \u062c\u0646 \u0645\u06cc\u06ba \u0633\u06d2 \u06c1\u0631 \u0627\u06cc\u06a9 \u0622\u0632\u0627\u062f \u0679\u0631\u0645\u06cc\u0646\u0644 \u06c1\u06d2\u06d4<br \/><strong>\u0644\u06cc\u0646\u06a9\u0633 \u06a9\u06d2 \u0644\u06cc\u06d2:<\/strong> \u062f\u0628\u0627\u0626\u06cc\u06ba <code>Ctrl+Shift+T<\/code> \u0632\u06cc\u0627\u062f\u06c1 \u062a\u0631 \u0679\u0631\u0645\u06cc\u0646\u0644 \u0627\u06cc\u067e\u0633 \u0645\u06cc\u06ba\u060c \u06cc\u0627 \u062f\u0627\u0626\u06cc\u06ba \u06a9\u0644\u06a9 \u06a9\u0631\u06cc\u06ba \u0627\u0648\u0631 &quot;\u0646\u06cc\u0627 \u0679\u06cc\u0628 \u06a9\u06be\u0648\u0644\u06cc\u06ba&#8221; \u06a9\u0648 \u0645\u0646\u062a\u062e\u0628 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<p>\u0648\u0627\u0686 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0679\u0631\u0645\u06cc\u0646\u0644 1\u060c \u0646\u0627\u06a9\u0627\u0645\u06cc \u0627\u0646\u062c\u06cc\u06a9\u0634\u0646 \u0679\u0631\u0645\u06cc\u0646\u0644 2\u060c \u0627\u0648\u0631 \u0644\u06cc\u0679\u0646\u0633\u06cc \u0622\u0628\u0632\u0631\u0648\u06cc\u0634\u0646 \u0679\u0631\u0645\u06cc\u0646\u0644 3 \u067e\u0631 \u0644\u06cc\u0628\u0644 \u0644\u06af\u0627\u0626\u06cc\u06ba\u06d4<\/p>\n<h3 id=\"heading-the-scripts\">\u0633\u06a9\u0631\u067e\u0679<\/h3>\n<h4 id=\"heading-version-1-watches-errors-only-code-here\">\u0648\u0631\u0698\u0646 1: \u0635\u0631\u0641 \u063a\u0644\u0637\u06cc\u0648\u06ba \u06a9\u0648 \u062f\u06cc\u06a9\u06be\u06cc\u06ba (\u06a9\u0648\u0688 \u06cc\u06c1\u0627\u06ba \u06c1\u06d2)\u06d4<\/h4>\n<pre><code class=\"language-bash\">#!\/usr\/bin\/env bash\n# canary_watch_v1.sh\n\nPROMETHEUS=\"http:\/\/localhost:9090\"\nDEPLOYMENT=\"myapp-canary\"\nNAMESPACE=\"default\"\nERROR_THRESHOLD=\"0.05\"\nCHECK_INTERVAL=15\nSTRIKE_LIMIT=3\n\nstrikes=0\n\necho \"Canary monitor running (v1 - error rate only).\"\necho \"Rollback triggers if error rate exceeds ({ERROR_THRESHOLD} for ){STRIKE_LIMIT} checks.\"\necho \"\"\n\nwhile true; do\n    ts=$(date '+%Y-%m-%dT%H:%M:%S')\n\n    error_query='sum(rate(http_requests_total{app=\"myapp-canary\",status=~\"5..\"}[1m])) \/ sum(rate(http_requests_total{app=\"myapp-canary\"}[1m]))'\n\n    error_rate=((curl -sf \"){PROMETHEUS}\/api\/v1\/query\" \n        --data-urlencode \"query=${error_query}\" | \n        python3 -c \"\nimport sys, json\nd = json.load(sys.stdin)\nresult = d['data']['result']\nprint(result[0]['value'][1] if result else '0')\n\" 2>\/dev\/null)\n\n    error_rate=${error_rate:-0}\n    above=((echo \")error_rate > $ERROR_THRESHOLD\" | bc -l)\n\n    echo \"[(ts] error_rate=){error_rate} | threshold=({ERROR_THRESHOLD} | breach=)([ \"$above\" = \"1\" ] && echo YES || echo NO)\"\n\n    if [ \"$above\" = \"1\" ]; then\n        strikes=$((strikes + 1))\n        echo \"  Strike ({strikes}\/){STRIKE_LIMIT}\"\n        if [ \"(strikes\" -ge \")STRIKE_LIMIT\" ]; then\n            echo \"  ROLLBACK TRIGGERED\"\n            kubectl rollout undo deployment\/\"({DEPLOYMENT}\" -n \"){NAMESPACE}\"\n            exit 0\n        fi\n    else\n        strikes=0\n    fi\n\n    sleep \"${CHECK_INTERVAL}\"\ndone\n<\/code><\/pre>\n<h4 id=\"heading-version-2-watches-error-rate-and-response-time\">\u0648\u0631\u0698\u0646 2: \u062e\u0631\u0627\u0628\u06cc \u06a9\u06cc \u0634\u0631\u062d \u0627\u0648\u0631 \u062c\u0648\u0627\u0628\u06cc \u0648\u0642\u062a \u06a9\u06cc \u0646\u06af\u0631\u0627\u0646\u06cc<\/h4>\n<pre><code class=\"language-bash\">#!\/usr\/bin\/env bash\n# canary_watch_v2.sh\n\nPROMETHEUS=\"http:\/\/localhost:9090\"\nDEPLOYMENT=\"myapp-canary\"\nNAMESPACE=\"default\"\nERROR_THRESHOLD=\"0.05\"\nLATENCY_THRESHOLD=\"2.0\"\nCHECK_INTERVAL=15\nSTRIKE_LIMIT=3\n\nstrikes=0\n\necho \"Canary monitor running (v2 - error rate + P99 latency).\"\necho \"Error threshold: ({ERROR_THRESHOLD} | Latency P99 threshold: ){LATENCY_THRESHOLD}s\"\necho \"\"\n\nwhile true; do\n    ts=$(date '+%Y-%m-%dT%H:%M:%S')\n\n    error_query='sum(rate(http_requests_total{app=\"myapp-canary\",status=~\"5..\"}[1m])) \/ sum(rate(http_requests_total{app=\"myapp-canary\"}[1m]))'\n    error_rate=((curl -sf \"){PROMETHEUS}\/api\/v1\/query\" \n        --data-urlencode \"query=${error_query}\" | \n        python3 -c \"\nimport sys, json\nd = json.load(sys.stdin)\nresult = d['data']['result']\nprint(result[0]['value'][1] if result else '0')\n\" 2>\/dev\/null)\n\n    latency_query='histogram_quantile(0.99, sum(rate(http_request_duration_seconds_bucket{app=\"myapp-canary\"}[1m])) by (le))'\n    latency=((curl -sf \"){PROMETHEUS}\/api\/v1\/query\" \n        --data-urlencode \"query=${latency_query}\" | \n        python3 -c \"\nimport sys, json\nd = json.load(sys.stdin)\nresult = d['data']['result']\nprint(result[0]['value'][1] if result else '0')\n\" 2>\/dev\/null)\n\n    error_rate=${error_rate:-0}\n    latency=${latency:-0}\n\n    error_breach=((echo \")error_rate > $ERROR_THRESHOLD\" | bc -l)\n    latency_breach=((echo \")latency > $LATENCY_THRESHOLD\" | bc -l)\n\n    triggered_by=\"\"\n    [ \"(error_breach\" = \"1\" ] && triggered_by=\"error_rate(){error_rate})\"\n    [ \"(latency_breach\" = \"1\" ] && triggered_by=\"){triggered_by:+({triggered_by}, }latency_p99(){latency}s)\"\n\n    echo \"[(ts] error_rate=){error_rate} | latency_p99=({latency}s | breach=){triggered_by:-none}\"\n\n    if [ \"(error_breach\" = \"1\" ] || [ \")latency_breach\" = \"1\" ]; then\n        strikes=$((strikes + 1))\n        echo \"  Strike ({strikes}\/){STRIKE_LIMIT} | Triggered by: ${triggered_by}\"\n        if [ \"(strikes\" -ge \")STRIKE_LIMIT\" ]; then\n            echo \"\"\n            echo \"  ROLLBACK TRIGGERED\"\n            echo \"  Signal: ${triggered_by}\"\n            kubectl rollout undo deployment\/\"({DEPLOYMENT}\" -n \"){NAMESPACE}\"\n            exit 0\n        fi\n    else\n        strikes=0\n    fi\n\n    sleep \"${CHECK_INTERVAL}\"\ndone\n<\/code><\/pre>\n<h3 id=\"heading-how-the-scripts-work\">\u0627\u0633\u06a9\u0631\u067e\u0679 \u06a9\u06cc\u0633\u06d2 \u06a9\u0627\u0645 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4<\/h3>\n<p>\u06a9\u06c1 <code>error rate query<\/code> \u067e\u0631\u0648\u0645\u06cc\u062a\u06be\u06cc\u0633 \u067e\u0648\u0686\u06be\u062a\u0627 \u06c1\u06d2: <em>&quot;\u06a9\u06cc\u0646\u0631\u06cc \u062f\u0631\u062e\u0648\u0627\u0633\u062a\u0648\u06ba \u06a9\u0627 \u06a9\u062a\u0646\u0627 \u0641\u06cc\u0635\u062f \u0622\u062e\u0631\u06cc \u0644\u0645\u062d\u06d2 \u0645\u06cc\u06ba \u0627\u06cc\u06a9 \u063a\u0644\u0637\u06cc \u0648\u0627\u067e\u0633 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u061f&#8221;<\/em> \u0646\u062a\u06cc\u062c\u06c1 <code>0.0<\/code> \u0627\u0633 \u06a9\u0627 \u0645\u0637\u0644\u0628 \u06c1\u06d2 \u06a9\u06c1 \u06a9\u0648\u0626\u06cc \u063a\u0644\u0637\u06cc \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4 \u0646\u062a\u06cc\u062c\u06c1 <code>0.06<\/code> \u0627\u0633 \u06a9\u0627 \u0645\u0637\u0644\u0628 \u06c1\u06d2 \u06a9\u06c1 6% \u062f\u0631\u062e\u0648\u0627\u0633\u062a\u06cc\u06ba \u0646\u0627\u06a9\u0627\u0645 \u06c1\u0648 \u062c\u0627\u0626\u06cc\u06ba \u06af\u06cc \u06a9\u06cc\u0648\u0646\u06a9\u06c1 \u0648\u06c1 5% \u062d\u062f \u0633\u06d2 \u062a\u062c\u0627\u0648\u0632 \u06a9\u0631 \u062c\u0627\u0626\u06cc\u06ba \u06af\u06cc\u06d4 \u0622\u0624\u0679 \u067e\u0679 \u0645\u06cc\u06ba \u0622\u067e \u06cc\u06c1 \u062f\u06cc\u06a9\u06be\u06cc\u06ba \u06af\u06d2:<\/p>\n<pre><code class=\"language-plaintext\">error_rate=0.06 | threshold=0.05 | breach=YES\n<\/code><\/pre>\n<p>\u06a9\u06c1 <code>latency query<\/code> \u067e\u0648\u0686\u06be\u06cc\u06ba: <em>&quot;\u0622\u062c \u06a9\u06cc\u0646\u0631\u06cc \u06a9\u0648 \u0622\u0646\u06d2 \u0648\u0627\u0644\u06cc 1% \u062f\u0631\u062e\u0648\u0627\u0633\u062a\u0648\u06ba \u06a9\u06cc \u0631\u0641\u062a\u0627\u0631 \u06a9\u062a\u0646\u06cc \u0633\u0633\u062a \u06c1\u06d2\u061f&#8221;<\/em> \u0646\u062a\u06cc\u062c\u06c1 <code>5.234<\/code> \u0627\u0633 \u06a9\u0627 \u0645\u0637\u0644\u0628 \u06c1\u06d2 \u06a9\u06c1 100 \u0645\u06cc\u06ba \u0633\u06d2 1 \u062f\u0631\u062e\u0648\u0627\u0633\u062a\u0648\u06ba \u0645\u06cc\u06ba 5 \u0633\u06cc\u06a9\u0646\u0688 \u0633\u06d2 \u0632\u06cc\u0627\u062f\u06c1 \u0648\u0642\u062a \u0644\u06af\u062a\u0627 \u06c1\u06d2\u06d4 \u0622\u067e \u0627\u0633\u06d2 \u0627\u0633 \u0637\u0631\u062d \u062f\u06cc\u06a9\u06be\u062a\u06d2 \u06c1\u06cc\u06ba:<\/p>\n<pre><code class=\"language-plaintext\">latency_p99=5.234s | breach=latency_p99(5.234s)\n<\/code><\/pre>\n<p>V1 \u0635\u0631\u0641 \u067e\u06c1\u0644\u0627 \u0633\u0648\u0627\u0644 \u0686\u0644\u0627\u062a\u0627 \u06c1\u06d2\u06d4 V2 \u062f\u0648\u0646\u0648\u06ba \u0686\u0644\u062a\u0627 \u06c1\u06d2\u06d4 \u0627\u06cc\u06a9 \u06c1\u06cc \u06a9\u06cc\u0646\u0631\u06cc\u060c \u0627\u06cc\u06a9 \u06c1\u06cc \u0645\u0633\u0626\u0644\u06c1\u060c \u0645\u062e\u062a\u0644\u0641 \u062c\u0648\u0627\u0628\u06d4<\/p>\n<p>\u062a\u06cc\u0646 \u0633\u0679\u0631\u0627\u0626\u06cc\u06a9\u0633 \u06a9\u06d2 \u0627\u0635\u0648\u0644 \u06a9\u0627 \u0645\u0637\u0644\u0628 \u06c1\u06d2 \u06a9\u06c1 \u0627\u06cc\u06a9 \u062e\u0631\u0627\u0628 \u0686\u06cc\u06a9 \u0631\u0648\u0644 \u0628\u06cc\u06a9 \u06a9\u0648 \u0645\u062a\u062d\u0631\u06a9 \u0646\u06c1\u06cc\u06ba \u06a9\u0631\u06d2 \u06af\u0627\u06d4 \u0644\u06af\u0627\u062a\u0627\u0631 \u062a\u06cc\u0646 \u0627\u06cc\u06a9 \u0631\u0648\u0644 \u0628\u06cc\u06a9 \u06a9\u0648 \u0645\u062a\u062d\u0631\u06a9 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 \u0631\u0648\u0644 \u0628\u06cc\u06a9 \u06a9\u06d2 \u0634\u0631\u0648\u0639 \u06c1\u0648\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 \u0646\u0645\u0627\u0626\u0634 \u06a9\u0627 \u0648\u0642\u062a 45 \u0633\u06cc\u06a9\u0646\u0688 \u06c1\u06d2 (\u06c1\u0631 15 \u0633\u06cc\u06a9\u0646\u0688 \u0645\u06cc\u06ba \u062a\u06cc\u0646 \u0686\u06cc\u06a9)\u06d4<\/p>\n<p>\u062a\u06cc\u0646 \u062d\u0645\u0644\u0648\u06ba \u06a9\u06d2 \u0628\u0639\u062f\u060c \u0646\u06af\u0631\u0627\u0646\u06cc \u0633\u06a9\u0631\u067e\u0679 \u062e\u0648\u062f \u06a9\u0648 \u067e\u06be\u0627\u0646\u0633\u06cc \u062f\u06cc \u062c\u0627\u062a\u06cc \u06c1\u06d2.<\/p>\n<pre><code class=\"language-plaintext\">kubectl rollout undo deployment\/myapp-canary -n default\n<\/code><\/pre>\n<p>\u0648\u06c1 \u0627\u06cc\u06a9 \u0644\u0627\u0626\u0646 \u0631\u0648\u0644 \u0628\u06cc\u06a9 \u06a9\u0627 \u0633\u0628\u0628 \u0628\u0646\u062a\u06cc \u06c1\u06d2\u06d4 \u0627\u0633 \u0645\u06cc\u06ba \u0631\u06c1\u062a\u06d2 \u06c1\u06cc\u06ba <code>canary_watch_v2.sh<\/code> \u06cc\u06c1 \u062e\u0648\u062f \u0628\u062e\u0648\u062f \u0686\u0644\u062a\u0627 \u06c1\u06d2 \u0644\u06c1\u0630\u0627 \u0622\u067e \u06a9\u0648 \u06a9\u0686\u06be \u06a9\u0631\u0646\u06d2 \u06a9\u06cc \u0636\u0631\u0648\u0631\u062a \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4 \u0627\u0633\u06a9\u0631\u067e\u0679 \u06a9\u0648 \u0633\u0645\u062c\u06be\u0646\u0627\u060c \u0641\u06cc\u0635\u0644\u06c1 \u06a9\u0631\u0646\u0627 \u0627\u0648\u0631 \u0639\u0645\u0644 \u06a9\u0631\u0646\u0627 \u06c1\u06d2\u06d4<\/p>\n<h3 id=\"heading-break-it-on-purpose\">\u062c\u0627\u0646 \u0628\u0648\u062c\u06be \u06a9\u0631 \u062a\u0648\u0691 \u062f\u0648<\/h3>\n<p><strong>\u0679\u0631\u0645\u06cc\u0646\u0644 1 \u067e\u0631<\/strong>v1 \u0645\u0627\u0646\u06cc\u0679\u0631 \u0634\u0631\u0648\u0639 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<pre><code class=\"language-plaintext\">.\/canary_watch_v1.sh\n<\/code><\/pre>\n<p>\u0622\u067e \u0627\u0633\u06d2 \u06c1\u0631 15 \u0633\u06cc\u06a9\u0646\u0688 \u0645\u06cc\u06ba \u062f\u06c1\u0631\u0627\u062a\u06d2 \u06c1\u0648\u0626\u06d2 \u062f\u06cc\u06a9\u06be \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba:<\/p>\n<pre><code class=\"language-plaintext\">Canary monitor running (v1 - error rate only).\nRollback triggers if error rate exceeds 0.05 for 3 checks.\n\n[2026-05-17T11:53:12] error_rate=0 | threshold=0.05 | breach=NO\n[2026-05-17T11:53:27] error_rate=0 | threshold=0.05 | breach=NO\n[2026-05-17T11:53:42] error_rate=0 | threshold=0.05 | breach=NO\n<\/code><\/pre>\n<p><code>breach=NO<\/code>    \u0627\u0633 \u06a9\u0627 \u0645\u0637\u0644\u0628 \u06c1\u06d2 \u06a9\u06c1 \u06a9\u06cc\u0646\u0631\u06cc \u0635\u062d\u062a \u0645\u0646\u062f \u0646\u0638\u0631 \u0622\u062a\u06cc \u06c1\u06d2\u06d4 \u0627\u0633\u06d2 \u0648\u06cc\u0633\u06d2 \u06c1\u06cc \u0631\u06c1\u0646\u06d2 \u062f\u06cc\u06ba \u0627\u0648\u0631 \u0679\u0631\u0645\u06cc\u0646\u0644 2 \u067e\u0631 \u062c\u0627\u0626\u06cc\u06ba\u06d4<\/p>\n<p><strong>\u0679\u0631\u0645\u06cc\u0646\u0644 2 \u067e\u0631<\/strong>\u06a9\u06cc\u0646\u0631\u06cc \u0645\u06cc\u06ba \u062a\u0627\u062e\u06cc\u0631 \u06a9\u0627 \u0627\u0646\u062c\u06cc\u06a9\u0634\u0646 \u0644\u06af\u0627\u0626\u06cc\u06ba\u06d4<\/p>\n<pre><code class=\"language-plaintext\">.\/break_it.sh\n<\/code><\/pre>\n<p>\u0627\u0633 \u06a9\u06cc \u0648\u062c\u06c1 \u0633\u06d2 \u06a9\u06cc\u0646\u0631\u06cc \u06a9\u06cc \u06c1\u0631 \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u0645\u06cc\u06ba 5 \u0633\u06cc\u06a9\u0646\u0688 \u0644\u06af\u06cc\u06ba \u06af\u06d2\u06d4 \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u0627\u0628 \u0628\u06be\u06cc 200 \u0648\u0627\u067e\u0633 \u06a9\u0631\u062a\u06cc \u06c1\u06d2\u06d4 \u06a9\u0648\u0626\u06cc \u062e\u0631\u0627\u0628\u06cc \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u060c \u06cc\u06c1 \u0635\u0631\u0641 \u0633\u0633\u062a \u06c1\u06d2\u06d4 \u0622\u067e \u062f\u06cc\u06a9\u06be \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba:<\/p>\n<pre><code class=\"language-plaintext\">Injecting latency into the canary deployment...\ndeployment \"myapp-canary\" successfully rolled out\nLatency injection is active.\n\nThe canary pod is Running and passing its readiness probe.\nEvery request to the canary now takes 5 seconds.\nError rate: 0%   |   P99 latency: ~5s\n<\/code><\/pre>\n<p>\u0627\u0628 \u0679\u0631\u0645\u06cc\u0646\u0644 1 \u067e\u0631 \u0627\u06cc\u06a9 \u0627\u0648\u0631 \u0646\u0638\u0631 \u0688\u0627\u0644\u06cc\u06ba\u06d4 v1 \u0645\u0627\u0646\u06cc\u0679\u0631 \u0627\u0628\u06be\u06cc \u0628\u06be\u06cc \u067e\u0631\u0646\u0679 \u06a9\u0631 \u0631\u06c1\u0627 \u06c1\u06d2\u06d4 <code>breach=NO<\/code>. \u06a9\u06cc\u0646\u0631\u06cc \u0641\u06cc \u062f\u0631\u062e\u0648\u0627\u0633\u062a 5 \u0633\u06cc\u06a9\u0646\u0688 \u0644\u06cc\u062a\u0627 \u06c1\u06d2 \u0627\u0648\u0631 \u0646\u06af\u0631\u0627\u0646\u06cc \u0633\u06d2 \u067e\u062a\u06c1 \u0686\u0644\u062a\u0627 \u06c1\u06d2 \u06a9\u06c1 \u0633\u0628 \u06a9\u0686\u06be \u0679\u06be\u06cc\u06a9 \u06c1\u06d2\u06d4 \u0648\u06c1 \u0646\u0627\u06a9\u0627\u0645\u06cc \u06c1\u06d2\u06d4<\/p>\n<p><strong>\u0679\u0631\u0645\u06cc\u0646\u0644 3 \u067e\u0631<\/strong>\u0645\u0639\u0644\u0648\u0645 \u06a9\u0631\u06cc\u06ba \u06a9\u06c1 \u0622\u067e \u06a9\u06d2 \u0635\u0627\u0631\u0641\u06cc\u0646 \u0627\u0635\u0644 \u0645\u06cc\u06ba \u06a9\u06cc\u0627 \u062a\u062c\u0631\u0628\u06c1 \u06a9\u0631 \u0631\u06c1\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<pre><code class=\"language-plaintext\">.\/check_latency.sh\n<\/code><\/pre>\n<pre><code class=\"language-plaintext\">TIMESTAMP                   STABLE (ms)   CANARY (ms)   STATUS\n---------                   -----------   -----------   ------\n2026-05-17T11:55:14         18ms          5008ms        CANARY DEGRADED\n2026-05-17T11:55:20         7ms           5008ms        CANARY DEGRADED\n2026-05-17T11:55:27         6ms           5008ms        CANARY DEGRADED\n<\/code><\/pre>\n<p>\u0645\u0633\u062a\u062d\u06a9\u0645 6 \u0633\u06d2 18 \u0645\u0644\u06cc \u0633\u06cc\u06a9\u0646\u0688 \u06a9\u06d2 \u0627\u0646\u062f\u0631 \u062c\u0648\u0627\u0628 \u062f\u06cc\u062a\u0627 \u06c1\u06d2\u06d4 \u06a9\u06cc\u0646\u0631\u06cc \u0645\u06cc\u06ba 5 \u0633\u06cc\u06a9\u0646\u0688 \u0633\u06d2 \u0632\u06cc\u0627\u062f\u06c1 \u0648\u0642\u062a \u0644\u06af\u062a\u0627 \u06c1\u06d2\u06d4 \u06a9\u06cc\u0646\u0631\u06cc \u06a9\u06d2 \u0635\u0627\u0631\u0641\u06cc\u0646 \u06c1\u0631 \u0628\u0627\u0631 \u0635\u0641\u062d\u06c1 \u0644\u0648\u0688 \u06c1\u0648\u0646\u06d2 \u067e\u0631 5 \u0633\u06cc\u06a9\u0646\u0688 \u0627\u0646\u062a\u0638\u0627\u0631 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 \u0679\u0631\u0645\u06cc\u0646\u0644 1 \u06a9\u0627 v1 \u0645\u0627\u0646\u06cc\u0679\u0631 \u0627\u0628 \u0628\u06be\u06cc \u062f\u06a9\u06be\u0627\u062a\u0627 \u06c1\u06d2: <code>breach=NO<\/code>.<\/p>\n<p>\u06cc\u06c1 \u0633\u0628\u0642 \u06c1\u06d2\u06d4 \u0645\u0627\u0646\u06cc\u0679\u0631\u0646\u06af \u0627\u0648\u0631 \u0635\u0627\u0631\u0641 \u06a9\u0627 \u062a\u062c\u0631\u0628\u06c1 \u0628\u0627\u0644\u06a9\u0644 \u0627\u0644\u06af \u06c1\u06d2\u06d4 \u0627\u0633\u06a9\u0631\u067e\u0679 \u062e\u0631\u0627\u0628 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2\u06d4 \u0622\u067e \u063a\u0644\u0637 \u0686\u06cc\u0632 \u06a9\u0648 \u062f\u06cc\u06a9\u06be \u0631\u06c1\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u0627\u0628 \u0622\u0626\u06cc\u06d2 \u062a\u0631\u0645\u06cc\u0645\u0627\u062a \u06a9\u0648 \u062f\u06cc\u06a9\u06be\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 \u062f\u0628\u0627\u0626\u06cc\u06ba <code>Ctrl+C<\/code> \u0679\u0631\u0645\u06cc\u0646\u0644 1 \u067e\u0631 v1 \u06a9\u0648 \u0631\u0648\u06a9\u06cc\u06ba\u06d4 \u0627\u0633\u06cc \u0679\u0631\u0645\u06cc\u0646\u0644 \u0645\u06cc\u06ba v2 \u0634\u0631\u0648\u0639 \u06a9\u0631\u06cc\u06ba\u06d4<\/p>\n<pre><code class=\"language-plaintext\">.\/canary_watch_v2.sh\n<\/code><\/pre>\n<p>\u0679\u0631\u0645\u06cc\u0646\u0644 2 \u0645\u06cc\u06ba \u0644\u06cc\u0679\u0646\u0633\u06cc \u06a9\u0648 \u062f\u0648\u0628\u0627\u0631\u06c1 \u0644\u06af\u0627\u0626\u06cc\u06ba\u06d4<\/p>\n<pre><code class=\"language-plaintext\">.\/break_it.sh\n<\/code><\/pre>\n<p>\u0679\u0631\u0645\u06cc\u0646\u0644 1 \u062f\u06cc\u06a9\u06be\u06cc\u06ba\u06d4 V2 \u062a\u0627\u062e\u06cc\u0631 \u06a9\u0627 \u062a\u0639\u06cc\u0646 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u0627\u0648\u0631 \u062a\u06cc\u0646 \u062d\u0645\u0644\u0648\u06ba \u06a9\u06d2 \u0628\u0639\u062f \u0631\u0648\u0644 \u0628\u06cc\u06a9 \u06a9\u0648 \u0627\u0646\u062c\u0627\u0645 \u062f\u06cc\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<pre><code class=\"language-plaintext\">Canary monitor running (v2 - error rate + P99 latency).\nError threshold: 0.05 | Latency P99 threshold: 2.0s\n\n[2026-05-15T14:30:00] error_rate=0.0 | latency_p99=0.082s | breach=none\n[2026-05-15T14:30:15] error_rate=0.0 | latency_p99=5.234s | breach=latency_p99(5.234s)\n  Strike 1\/3 | Triggered by: latency_p99(5.234s)\n[2026-05-15T14:30:30] error_rate=0.0 | latency_p99=5.891s | breach=latency_p99(5.891s)\n  Strike 2\/3 | Triggered by: latency_p99(5.891s)\n[2026-05-15T14:30:45] error_rate=0.0 | latency_p99=6.102s | breach=latency_p99(6.102s)\n  Strike 3\/3 | Triggered by: latency_p99(6.102s)\n\n  ROLLBACK TRIGGERED\n  Signal: latency_p99(6.102s)\n\ndeployment.apps\/myapp-canary rolled back\n<\/code><\/pre>\n<p>\u063a\u0644\u0637\u06cc \u06a9\u06cc \u0634\u0631\u062d \u06a9\u0628\u06be\u06cc \u0628\u06be\u06cc 0 \u0633\u06d2 \u0645\u0646\u062a\u0642\u0644 \u0646\u06c1\u06cc\u06ba \u06c1\u0648\u0626\u06cc\u06d4 V2 \u06a9\u0648 \u0628\u06c1\u0631\u062d\u0627\u0644 \u0648\u0627\u067e\u0633 \u06a9\u0631 \u062f\u06cc\u0627 \u06af\u06cc\u0627 \u06a9\u06cc\u0648\u0646\u06a9\u06c1 \u062a\u0627\u062e\u06cc\u0631 \u062d\u062f \u0633\u06d2 \u0632\u06cc\u0627\u062f\u06c1 \u062a\u06be\u06cc\u06d4 \u0627\u06cc\u06a9 \u0627\u0636\u0627\u0641\u06cc \u067e\u06cc\u0645\u0627\u0626\u0634 \u0633\u06d2 \u06cc\u06c1\u06cc \u0641\u0631\u0642 \u067e\u0691\u062a\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u0631\u0648\u0644 \u0628\u06cc\u06a9 \u06a9\u06d2 \u0628\u0639\u062f\u060c \u06cc\u0642\u06cc\u0646\u06cc \u0628\u0646\u0627\u0626\u06cc\u06ba \u06a9\u06c1 \u06a9\u06cc\u0646\u0631\u06cc \u063a\u06cc\u0631 \u0641\u0639\u0627\u0644 \u06c1\u06d2 \u0644\u06cc\u06a9\u0646 \u062d\u0630\u0641 \u0646\u06c1\u06cc\u06ba \u06c1\u0648\u0626\u06cc \u06c1\u06d2\u06d4<\/p>\n<pre><code class=\"language-plaintext\">kubectl rollout history deployment\/myapp-canary -n default\n<\/code><\/pre>\n<pre><code class=\"language-plaintext\">REVISION  CHANGE-CAUSE\n1         <none>\n2         <none>\n<\/none><\/none><\/code><\/pre>\n<p>\u062f\u0648 \u0646\u0638\u0631\u062b\u0627\u0646\u06cc\u06d4 \u0631\u0648\u0644 \u0628\u06cc\u06a9 \u0646\u06d2 \u0646\u0638\u0631\u062b\u0627\u0646\u06cc 2 \u06a9\u0648 0 \u062a\u06a9 \u06a9\u0645 \u06a9\u0631 \u062f\u06cc\u0627 \u0627\u0648\u0631 \u0646\u0638\u0631\u062b\u0627\u0646\u06cc 1 \u06a9\u0648 \u0628\u062d\u0627\u0644 \u06a9\u0631 \u062f\u06cc\u0627\u06d4 \u0627\u06af\u0631 \u0622\u067e \u06cc\u06c1 \u0637\u06d2 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba \u06a9\u06c1 \u06a9\u0686\u06be \u0628\u06be\u06cc \u062d\u0630\u0641 \u0646\u06c1\u06cc\u06ba \u06a9\u06cc\u0627 \u06af\u06cc\u0627 \u06c1\u06d2 \u0627\u0648\u0631 \u0631\u0648\u0644 \u0628\u06cc\u06a9 \u063a\u0644\u0637 \u0627\u0644\u0627\u0631\u0645 \u062a\u06be\u0627\u060c \u062a\u0648 \u0622\u067e \u062f\u0648\u0628\u0627\u0631\u06c1 \u062a\u0639\u06cc\u0646\u0627\u062a \u06a9\u0631 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<h3 id=\"heading-the-decision-the-script-cant-make-for-you\">\u0648\u06c1 \u0641\u06cc\u0635\u0644\u06d2 \u062c\u0648 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0646\u06c1\u06cc\u06ba \u06a9\u0631 \u0633\u06a9\u062a\u0627<\/h3>\n<p>V2 \u062a\u0627\u062e\u06cc\u0631 \u06a9\u06cc \u0628\u0646\u06cc\u0627\u062f \u067e\u0631 \u063a\u0644\u0637\u06cc \u06a9\u06d2 \u0628\u063a\u06cc\u0631 \u0648\u0627\u067e\u0633 \u06a9\u0631 \u062f\u06cc\u0627 \u06af\u06cc\u0627\u06d4 \u062f\u0648\u0628\u0627\u0631\u06c1 \u062a\u0639\u06cc\u0646\u0627\u062a \u06a9\u0631\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2\u060c \u067e\u0648\u0686\u06be\u06cc\u06ba \u06a9\u06c1 \u06a9\u06cc\u0627 \u062a\u0627\u062e\u06cc\u0631 \u0646\u0626\u06d2 \u06a9\u0648\u0688 \u0645\u06cc\u06ba \u0627\u06cc\u06a9 \u062d\u0642\u06cc\u0642\u06cc \u0631\u062c\u0639\u062a \u06c1\u06d2\u060c \u06cc\u0627 \u0627\u06cc\u06a9 \u0639\u0627\u0631\u0636\u06cc \u0627\u0633\u067e\u0627\u0626\u06a9\u060c \u062c\u06cc\u0633\u06d2 \u06a9\u06c1 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u06a9\u06cc\u0634 \u06a9\u0627 \u067e\u06c1\u0644\u06d2 \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u067e\u0631 \u06af\u0631\u0645 \u06c1\u0648\u0646\u0627\u06d4 \u062f\u0648\u0646\u0648\u06ba \u0627\u06cc\u06a9 \u06c1\u06cc \u0633\u06af\u0646\u0644 \u067e\u06cc\u062f\u0627 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 \u0635\u0631\u0641 \u0622\u067e \u06a9\u0648 \u0645\u0639\u0644\u0648\u0645 \u06c1\u0648 \u06af\u0627 \u06a9\u06c1 \u06a9\u0648\u0646 \u0633\u0627 \u0632\u06cc\u0627\u062f\u06c1 \u0627\u0645\u06a9\u0627\u0646 \u06c1\u06d2 \u06a9\u06c1 \u06a9\u06cc\u0627 \u0628\u062f\u0644\u0627 \u06c1\u06d2\u06d4<\/p>\n<p>\u063a\u0644\u0637 \u0645\u062b\u0628\u062a \u0631\u0648\u0644 \u0628\u06cc\u06a9\u0633 \u062a\u0639\u06cc\u0646\u0627\u062a\u06cc \u06a9\u0648 \u0633\u0633\u062a \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba \u0627\u0648\u0631 \u0622\u0679\u0648\u0645\u06cc\u0634\u0646 \u0645\u06cc\u06ba \u0627\u0639\u062a\u0645\u0627\u062f \u06a9\u0648 \u06a9\u0645 \u06a9\u0631\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4 \u062f\u0631\u0633\u062a \u062d\u062f \u0635\u0627\u0631\u0641 \u0627\u0648\u0631 \u0633\u0633\u0679\u0645 \u067e\u0631 \u0645\u0646\u062d\u0635\u0631 \u06c1\u06d2\u06d4<br \/>\u0627\u0633\u06a9\u0631\u067e\u0679 \u06a9\u0627 \u0627\u0637\u0644\u0627\u0642 \u0648\u06c1\u06cc \u06c1\u0648\u062a\u0627 \u06c1\u06d2 \u062c\u0633\u06d2 \u0622\u067e \u062a\u0631\u062a\u06cc\u0628 \u062f\u06cc\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<h3 id=\"heading-teardown\">\u06af\u0644\u0646\u0627<\/h3>\n<pre><code class=\"language-plaintext\">.\/teardown.sh\n<\/code><\/pre>\n<h2 id=\"heading-what-you-can-do-now\">\u0627\u0628 \u0622\u067e \u06a9\u06cc\u0627 \u06a9\u0631 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/h2>\n<p>\u0627\u0633 \u06c1\u06cc\u0646\u0688 \u0628\u06a9 \u0645\u06cc\u06ba \u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u0627 \u06c1\u0631 \u06a9\u06cc\u0633 \u0627\u06cc\u06a9 \u0627\u0633\u06a9\u0631\u067e\u0679 \u062a\u06be\u0627 \u062c\u0633 \u0646\u06d2 \u0627\u06cc\u06a9 \u0645\u062e\u0635\u0648\u0635 \u0645\u0633\u0626\u0644\u06c1 \u062d\u0644 \u06a9\u06cc\u0627 \u062c\u0633\u06d2 \u0645\u0639\u06cc\u0627\u0631\u06cc \u0679\u0648\u0644\u0632 \u0646\u06d2 \u06af\u0631\u0641\u062a \u0645\u06cc\u06ba \u0646\u06c1\u06cc\u06ba \u0644\u06cc\u0627\u06d4 \u0644\u06cc\u0646\u0688\u0646\u06af \u06a9\u06d2 \u0645\u0642\u0627\u0645\u0627\u062a \u06c1\u06cc\u06ba:<\/p>\n<p>\u0622\u067e \u0627\u0646\u0648\u0627\u0626\u0633 \u0648\u0635\u0648\u0644 \u06a9\u0631\u0646\u06d2 \u0633\u06d2 \u067e\u06c1\u0644\u06d2 AWS \u0644\u0627\u06af\u062a \u0645\u06cc\u06ba \u0627\u0636\u0627\u0641\u06d2 \u06a9\u0648 \u067e\u06a9\u0691 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba\u060c \u0627\u0648\u0631 \u0622\u067e \u062f\u06cc\u06a9\u06be \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba \u06a9\u06c1 \u0633\u0631\u0648\u0633 \u0644\u06cc\u0628\u0644 AWS \u06a9\u06cc \u062e\u0627\u0635\u06cc\u062a \u06c1\u06d2 \u0646\u06c1 \u06a9\u06c1 \u0627\u0635\u0644 \u0645\u06cc\u06ba \u0644\u0627\u06af\u062a \u06a9\u06cc \u0648\u062c\u06c1 \u06a9\u06cc\u0627 \u06c1\u06d2\u06d4 \u0622\u067e\u0631\u06cc\u0634\u0646\u0644 \u062a\u0628\u062f\u06cc\u0644\u06cc\u0648\u06ba \u0633\u06d2 \u0634\u0631\u0648\u0639 \u06a9\u0631\u06cc\u06ba\u060c \u0628\u0644\u0646\u06af \u0644\u06cc\u0628\u0644\u0632 \u0633\u06d2 \u0646\u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u0627\u06cc\u06a9 \u0648\u0627\u062d\u062f \u0679\u0631\u06cc\u06a9\u0646\u06af ID \u06a9\u06d2 \u0633\u0627\u062a\u06be\u060c \u0622\u067e \u0645\u062a\u0639\u062f\u062f \u0633\u0631\u0648\u0633\u0632 \u0645\u06cc\u06ba \u0646\u0627\u06a9\u0627\u0645 \u062f\u0631\u062e\u0648\u0627\u0633\u062a\u0648\u06ba \u06a9\u06cc \u067e\u0648\u0631\u06cc \u0679\u0627\u0626\u0645 \u0644\u0627\u0626\u0646 \u06a9\u0648 \u062f\u0648\u0628\u0627\u0631\u06c1 \u062a\u0634\u06a9\u06cc\u0644 \u062f\u06d2 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba\u060c \u0627\u0648\u0631 \u062c\u0627\u0646 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba \u06a9\u06c1 \u0627\u0633 \u0679\u0627\u0626\u0645 \u0644\u0627\u0626\u0646 \u0633\u06d2 \u063a\u0627\u0626\u0628 \u06c1\u0648\u0646\u06d2 \u0648\u0627\u0644\u06cc \u06a9\u0648\u0626\u06cc \u0628\u06be\u06cc \u0633\u0631\u0648\u0633 \u062b\u0628\u0648\u062a \u06c1\u06d2\u060c \u0646\u06c1 \u06a9\u06c1 \u0635\u0631\u0641 \u063a\u06cc\u0631 \u0645\u0648\u062c\u0648\u062f\u06af\u06cc\u06d4<\/p>\n<p>\u0622\u067e \u0628\u0646\u06cc\u0627\u062f\u06cc \u0688\u06be\u0627\u0646\u0686\u06d2 \u06a9\u06d2 \u0628\u0691\u06be\u0646\u06d2 \u06a9\u0627 \u067e\u062a\u06c1 \u0644\u06af\u0627 \u06a9\u0631 \u0627\u0633 \u06a9\u0627 \u0645\u0648\u0627\u0632\u0646\u06c1 \u06a9\u0631 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba \u06a9\u06c1 Terraform \u06a9\u06cc\u0627 \u0645\u0627\u0646\u062a\u0627 \u06c1\u06d2 \u0627\u0648\u0631 AWS \u0627\u0635\u0644 \u0645\u06cc\u06ba \u06a9\u06cc\u0627 \u0631\u06a9\u06be\u062a\u0627 \u06c1\u06d2\u060c \u0627\u0648\u0631 \u0622\u067e \u062f\u06cc\u06a9\u06be\u06cc\u06ba \u06af\u06d2 \u06a9\u06c1 \u0635\u0627\u0641 \u0646\u062a\u0627\u0626\u062c \u06a9\u0627 \u0645\u0637\u0644\u0628 \u06cc\u06c1 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2 \u06a9\u06c1 \u0622\u067e \u06a9\u0627 \u067e\u0648\u0631\u0627 AWS \u0627\u06a9\u0627\u0624\u0646\u0679 \u0635\u0627\u0641 \u06c1\u06d2\u060c \u0628\u0644\u06a9\u06c1 \u06cc\u06c1 \u06a9\u06c1 Terraform \u06a9\u0627 \u0627\u0646\u062a\u0638\u0627\u0645 \u06a9\u0631\u0646\u06d2 \u0648\u0627\u0644\u06d2 \u0648\u0633\u0627\u0626\u0644 \u0645\u0637\u0627\u0628\u0642\u062a \u067e\u0630\u06cc\u0631 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u0622\u067e \u0627\u06cc\u067e\u0644\u06cc\u06a9\u06cc\u0634\u0646 \u06a9\u06cc \u0633\u0637\u062d \u06a9\u06d2 \u0633\u0627\u062a\u06be \u0633\u0627\u062a\u06be \u0627\u0646\u0641\u0631\u0627\u0633\u0679\u0631\u06a9\u0686\u0631 \u06a9\u06cc \u0633\u0637\u062d \u067e\u0631 \u062e\u0641\u06cc\u06c1 \u06af\u0631\u062f\u0634 \u06a9\u06cc \u062a\u0635\u062f\u06cc\u0642 \u06a9\u0631 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba \u0627\u0648\u0631 \u0631\u06cc\u0688\u06cc \u0646\u06cc\u0633 \u067e\u0631\u0648\u0628 \u067e\u0627\u0633 \u06c1\u0648\u0646\u06d2 \u0627\u0648\u0631 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u0633\u06d2 \u062c\u0691\u0646\u06d2 \u06a9\u06d2 \u0642\u0627\u0628\u0644 \u06c1\u0648\u0646\u06d2 \u0648\u0627\u0644\u06cc \u0627\u06cc\u067e\u0644\u06cc\u06a9\u06cc\u0634\u0646 \u06a9\u06d2 \u062f\u0631\u0645\u06cc\u0627\u0646 \u0641\u0631\u0642 \u0628\u062a\u0627 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u0622\u067e \u0627\u06cc\u06a9 \u06a9\u06cc\u0646\u0631\u06cc \u0631\u0648\u0644 \u0628\u06cc\u06a9 \u0679\u0631\u06af\u0631 \u0628\u0646\u0627 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba \u062c\u0648 \u0635\u062d\u06cc\u062d \u0633\u06af\u0646\u0644\u0632 \u06a9\u0648 \u062f\u06cc\u06a9\u06be\u062a\u0627 \u06c1\u06d2\u060c \u0627\u0648\u0631 \u0635\u0631\u0641 \u062e\u0631\u0627\u0628\u06cc \u06a9\u06cc \u0634\u0631\u062d \u06a9\u0648 \u062f\u06cc\u06a9\u06be\u0646\u0627 \u0622\u067e \u06a9\u0648 \u0628\u062a\u0627\u0626\u06d2 \u06af\u0627 \u06a9\u06c1 \u0622\u067e \u06a9\u06d2 \u0635\u0627\u0631\u0641\u06cc\u0646 \u06a9\u06d2 \u0627\u0646\u062a\u0638\u0627\u0631 \u06a9\u06d2 \u062f\u0648\u0631\u0627\u0646 \u0622\u067e \u0633\u0633\u062a\u060c \u0679\u0648\u0679\u06cc \u06c1\u0648\u0626\u06cc \u062a\u0639\u06cc\u0646\u0627\u062a\u06cc \u06a9\u06cc\u0648\u06ba \u0686\u0644\u0627 \u0631\u06c1\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p>\u0627\u0633\u062a\u0639\u0645\u0627\u0644 \u06a9\u06d2 \u067e\u0627\u0646\u0686\u0648\u06ba \u0645\u0639\u0627\u0645\u0644\u0627\u062a \u06a9\u0627 \u067e\u06cc\u0679\u0631\u0646 \u0627\u06cc\u06a9 \u062c\u06cc\u0633\u0627 \u06c1\u06d2\u06d4 \u0645\u0639\u06cc\u0627\u0631\u06cc \u0679\u0648\u0644 \u0646\u06d2 \u0627\u0637\u0644\u0627\u0639 \u062f\u06cc \u06a9\u06c1 \u0633\u0628 \u06a9\u0686\u06be \u0679\u06be\u06cc\u06a9 \u062a\u06be\u0627\u060c \u062d\u0627\u0644\u0627\u0646\u06a9\u06c1 \u062d\u0642\u06cc\u0642\u062a \u0645\u06cc\u06ba \u06a9\u0686\u06be \u063a\u0644\u0637 \u06c1\u0648 \u0631\u06c1\u0627 \u062a\u06be\u0627\u06d4 \u0644\u0627\u06af\u062a \u06a9\u0627 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0635\u0627\u0641 \u0637\u0648\u0631 \u067e\u0631 \u0648\u0627\u067e\u0633 \u0622\u06cc\u0627\u060c \u067e\u0648\u0688\u0632 \u0686\u0644\u062a\u06d2 \u06c1\u0648\u0626\u06d2 \u062f\u06a9\u06be\u0627\u0626\u06d2 \u06af\u0626\u06d2\u060c \u0627\u0648\u0631 \u06a9\u06cc\u0646\u0631\u06cc\u0632 \u0646\u06d2 \u06a9\u0648\u0626\u06cc \u063a\u0644\u0637\u06cc \u0646\u06c1\u06cc\u06ba \u062f\u06a9\u06be\u0627\u0626\u06cc\u06d4 \u06cc\u06c1 \u0627\u0633 \u0644\u06cc\u06d2 \u0646\u06c1\u06cc\u06ba \u06c1\u06d2 \u06a9\u06c1 \u0679\u0648\u0644\u0632 \u063a\u0644\u0637 \u06c1\u06cc\u06ba\u060c \u06cc\u06c1 \u0627\u0633 \u0644\u06cc\u06d2 \u06c1\u06d2 \u06a9\u06c1 \u06c1\u0645 \u0635\u0631\u0641 \u0627\u0633 \u06a9\u06cc \u062c\u0627\u0646\u0686 \u06a9\u0631 \u0631\u06c1\u06d2 \u06c1\u06cc\u06ba \u062c\u0648 \u0686\u06cc\u06a9 \u06a9\u0631\u0646\u0627 \u0622\u0633\u0627\u0646 \u06c1\u06d2\u06d4 \u06cc\u06c1 \u0627\u0633\u06a9\u0631\u067e\u0679 \u0627\u0646 \u0686\u06cc\u0632\u0648\u06ba \u06a9\u06cc \u062c\u0627\u0646\u0686 \u06a9\u0631\u062a\u0627 \u06c1\u06d2 \u062c\u0648 \u0645\u0639\u06cc\u0627\u0631\u06cc \u0679\u0648\u0644\u0632 \u0686\u06be\u0648\u0691 \u062f\u06cc\u062a\u06d2 \u06c1\u06cc\u06ba\u06d4<\/p>\n<p><strong>GitHub \u0630\u062e\u06cc\u0631\u06c1:<\/strong> https:\/\/github.com\/Osomudeya\/devops-scripting-labs<\/p>\n<p>\u0645\u06cc\u06ba \u06c1\u0641\u062a\u06c1 \u0648\u0627\u0631 DevOps \u06a9\u06d2 \u0628\u0627\u0631\u06d2 \u0645\u06cc\u06ba \u0644\u06a9\u06be\u062a\u0627 \u06c1\u0648\u06ba\u060c \u062c\u0633 \u0645\u06cc\u06ba \u062d\u0642\u06cc\u0642\u06cc \u062f\u0646\u06cc\u0627 \u06a9\u06d2 \u0646\u0638\u0627\u0645\u060c \u0627\u0646\u0679\u0631\u0648\u06cc\u0648\u0632\u060c CV \u0679\u067e\u0633 \u0627\u0648\u0631 \u0679\u0631\u06a9\u0633\u060c \u0627\u0648\u0631 \u062d\u0642\u06cc\u0642\u06cc \u062f\u0646\u06cc\u0627 \u06a9\u06d2 \u0648\u0627\u0642\u0639\u0627\u062a \u06a9\u0627 \u0627\u062d\u0627\u0637\u06c1 \u06a9\u06cc\u0627 \u062c\u0627\u062a\u0627 \u06c1\u06d2\u06d4 <strong>\u06c1\u0645\u0627\u0631\u06d2 \u0646\u06cc\u0648\u0632 \u0644\u06cc\u0679\u0631 \u06a9\u06d2 \u0644\u06cc\u06d2 \u0633\u0627\u0626\u0646 \u0627\u067e \u06a9\u0631\u06cc\u06ba\u06d4<\/strong>.<\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u0622\u0679\u0648\u0645\u06cc\u0634\u0646 \u0627\u0633\u06a9\u0631\u067e\u0679\u0633 \u0627\u06a9\u062b\u0631 \u0633\u0633\u0679\u0645 \u06a9\u06cc \u062d\u06cc\u062b\u06cc\u062a \u06a9\u06d2 \u0628\u062c\u0627\u0626\u06d2 \u0639\u0645\u0644 \u06a9\u06cc \u062a\u06a9\u0645\u06cc\u0644 \u06a9\u0648 \u0686\u06cc\u06a9 \u06a9\u0631\u062a\u06cc \u06c1\u06cc\u06ba\u06d4 Kubernetes Pods \u0686\u0644 \u0633\u06a9\u062a\u06d2 \u06c1\u06cc\u06ba \u062c\u0628\u06a9\u06c1 \u0627\u0646\u062f\u0631\u0648\u0646\u06cc \u0627\u06cc\u067e\u0644\u06cc \u06a9\u06cc\u0634\u0646\u0632 \u0688\u06cc\u0679\u0627 \u0628\u06cc\u0633 \u06a9\u06cc \u062a\u0635\u062f\u06cc\u0642 \u0646\u06c1\u06cc\u06ba \u06a9\u0631 \u0633\u06a9\u062a\u06cc\u06ba\u06d4 \u0627\u06cc\u06a9 \u0679\u06cc\u0631\u0627\u0641\u0627\u0631\u0645 \u06a9\u06cc \u062a\u0639\u06cc\u0646\u0627\u062a\u06cc \u0635\u0627\u0641 \u0637\u0648\u0631 \u067e\u0631 \u0648\u0627\u067e\u0633 \u0622\u0633\u06a9\u062a\u06cc \u06c1\u06d2 \u062c\u0628 \u06a9\u0648\u0626\u06cc \u062f\u0633\u062a\u06cc \u0637\u0648\u0631 \u067e\u0631 \u06a9\u0644\u0627\u0624\u0688 \u06a9\u0646\u0633\u0648\u0644 \u0645\u06cc\u06ba \u0628\u0646\u06cc\u0627\u062f\u06cc \u0688\u06be\u0627\u0646\u0686\u06d2 \u06a9\u0648 \u062a\u0628\u062f\u06cc\u0644 \u06a9\u0631\u062a\u0627 \u06c1\u06d2\u06d4 [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":24544,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-24543","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog"],"_links":{"self":[{"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/posts\/24543","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/comments?post=24543"}],"version-history":[{"count":1,"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/posts\/24543\/revisions"}],"predecessor-version":[{"id":24545,"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/posts\/24543\/revisions\/24545"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/media\/24544"}],"wp:attachment":[{"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/media?parent=24543"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/categories?post=24543"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/umang.pk\/en_us\/wp-json\/wp\/v2\/tags?post=24543"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}