{"id":22871,"date":"2025-11-08T22:47:40","date_gmt":"2025-11-08T22:47:40","guid":{"rendered":"https:\/\/pokecon.jp\/job\/?p=22871"},"modified":"2025-11-08T22:47:40","modified_gmt":"2025-11-08T22:47:40","slug":"docker-on-ec2%e3%81%ae%e3%83%ad%e3%82%b0%e7%9b%a3%e8%a6%96%e3%80%81cloudwatch%e3%81%a7%e5%a7%8b%e3%82%81%e3%82%8b%e6%9c%80%e5%b0%8f%e6%a7%8b%e6%88%90%e3%80%90%e5%88%9d%e5%bf%83%e8%80%85%e5%90%91","status":"publish","type":"post","link":"https:\/\/pokecon.jp\/job\/22871\/","title":{"rendered":"Docker on EC2\u306e\u30ed\u30b0\u76e3\u8996\u3001CloudWatch\u3067\u59cb\u3081\u308b\u6700\u5c0f\u69cb\u6210\u3010\u521d\u5fc3\u8005\u5411\u3051\u30ac\u30a4\u30c9\u3011 &#8211; \u30b5\u30fc\u30d0\u30fc\u30ef\u30fc\u30af\u30b9\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0"},"content":{"rendered":"\n<\/p>\n<div>\n<h2 id=\"\u6982\u8981\">\u6982\u8981<\/h2>\n<p>\u3053\u306e\u30d6\u30ed\u30b0\u3067\u306f\u3001EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5185\u3067\u52d5\u4f5c\u3059\u308bDocker\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30ed\u30b0\u3092CloudWatch\u306b\u51fa\u529b\u3059\u308b\u65b9\u6cd5\u3092\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<p>\u6700\u7d42\u7684\u306b\u4ee5\u4e0b\u306e\u69cb\u6210\u56f3\u306e\u3088\u3046\u306a\u69cb\u6210\u3092\u76ee\u6307\u3057\u307e\u3059\u3002<\/p>\n<figure class=\"figure-image figure-image-fotolife\" title=\"\u69cb\u6210\u56f3\"><span itemscope=\"\" itemtype=\"http:\/\/schema.org\/Photograph\"><img decoding=\"async\" src=\"https:\/\/cdn-ak.f.st-hatena.com\/images\/fotolife\/s\/swx-kazuma-doi\/20251015\/20251015124906.png\" width=\"1200\" height=\"714\" loading=\"lazy\" title=\"\" class=\"hatena-fotolife\" itemprop=\"image\"\/><\/span><figcaption>\u69cb\u6210\u56f3<\/figcaption><\/figure>\n<h2 id=\"\u524d\u63d0\u6761\u4ef6\">\u524d\u63d0\u6761\u4ef6<\/h2>\n<ul>\n<li>VPC\u3068EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3055\u308c\u3066\u3044\u308b\u3053\u3068<\/li>\n<li>EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306bDocker\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u3053\u3068<\/li>\n<li>EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3053\u3068\n<ul>\n<li>\u4eca\u56de\u306fAWS Systems Manager Session Manager\uff08\u4ee5\u4e0b\u3001Session Manager\uff09\u3092\u4f7f\u7528\u3057\u3066\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3059<\/li>\n<li>SessionManager\u3092\u4f7f\u7528\u3059\u308b\u306b\u306fIAM\u30ed\u30fc\u30eb\u306b<code>AmazonSSMManagedInstanceCore<\/code>\u30dd\u30ea\u30b7\u30fc\u304c\u5fc5\u8981\u3067\u3059<\/li>\n<\/ul>\n<\/li>\n<li>\u6771\u4eac\u30ea\u30fc\u30b8\u30e7\u30f3\uff08ap-northeast-1\uff09\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u5225\u306e\u30ea\u30fc\u30b8\u30e7\u30f3\u3092\u4f7f\u7528\u3059\u308b\u5834\u5408\u306f\u3001\u30b3\u30de\u30f3\u30c9\u5185\u306e\u30ea\u30fc\u30b8\u30e7\u30f3\u6307\u5b9a\u3092\u9069\u5b9c\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/li>\n<\/ul>\n<h2 id=\"\u60f3\u5b9a\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9\">\u60f3\u5b9a\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9<\/h2>\n<ul>\n<li>EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u4e0a\u3067Docker\u30b3\u30f3\u30c6\u30ca\u3092\u4f7f\u7528\u3057\u3066\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3057\u3001\u305d\u306e\u30ed\u30b0\u3092\u76e3\u8996\u3057\u305f\u3044\u5834\u5408<\/li>\n<li>EC2\u4e0a\u306b\u30d5\u30a1\u30a4\u30eb\u51fa\u529b\u3092\u884c\u3046\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092AWS\u4e0a\u3067\u76e3\u8996\u3059\u308b\u5834\u5408<\/li>\n<\/ul>\n<h2 id=\"\u30ed\u30b0\u3092\u51fa\u529b\u3059\u308bPython\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u4f5c\u6210\u3068\u5b9f\u884c\">\u30ed\u30b0\u3092\u51fa\u529b\u3059\u308bPython\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u4f5c\u6210\u3068\u5b9f\u884c<\/h2>\n<p>Docker\u30b3\u30f3\u30c6\u30ca\u4e0a\u3067\u52d5\u4f5c\u3059\u308bPython\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"code bash\" data-lang=\"bash\" data-unlink=\"\">$ cd\n$ mkdir container_log\n$ cd container_log\n\n$ vi app.py<\/pre>\n<p>\u4e0b\u8a18Python\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u8cbc\u308a\u4ed8\u3051\u307e\u3059\u3002<\/p>\n<pre class=\"code lang-python\" data-lang=\"python\" data-unlink=\"\"><span class=\"synPreProc\">import<\/span> time\n<span class=\"synPreProc\">import<\/span> sys\n\ncount = <span class=\"synConstant\">1<\/span>\n\n\n<span class=\"synStatement\">while<\/span> <span class=\"synIdentifier\">True<\/span>:\n    \n    <span class=\"synIdentifier\">print<\/span>(f<span class=\"synConstant\">\"Log {count}\"<\/span>)\n\n    \n    <span class=\"synStatement\">if<\/span> count % <span class=\"synConstant\">6<\/span> == <span class=\"synConstant\">0<\/span>:\n        <span class=\"synIdentifier\">print<\/span>(f<span class=\"synConstant\">\"Error {count}\"<\/span>, <span class=\"synIdentifier\">file<\/span>=sys.stderr)\n\n    time.sleep(<span class=\"synConstant\">10<\/span>)\n    count += <span class=\"synConstant\">1<\/span>\n<\/pre>\n<p>\u6b21\u306b\u30d9\u30fc\u30b9\u3068\u306a\u308bDocker\u30a4\u30e1\u30fc\u30b8\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"code bash\" data-lang=\"bash\" data-unlink=\"\">$ vi Dockerfile<\/pre>\n<p>\u4e0b\u8a18\u5185\u5bb9\u3092\u8cbc\u308a\u4ed8\u3051\u307e\u3059\u3002<\/p>\n<p><strong>\u3010\u30dd\u30a4\u30f3\u30c8\u3011<\/strong><br \/>\npython\u306e\u6a19\u6e96\u51fa\u529b\u3092\u5373\u6642\u66f4\u65b0\uff08\u30d5\u30e9\u30c3\u30b7\u30e5\uff09\u3059\u308b\u305f\u3081\u306b\u3001<code>print<\/code>\u95a2\u6570\u306b<code>flush=True<\/code>\u3092\u8ffd\u52a0\u3059\u308b\u304b\u3001Python\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u5b9f\u884c\u6642\u306b<code>-u<\/code>\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u4eca\u56de\u306fDockerfile\u3067<code>-u<\/code>\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"code lang-dockerfile\" data-lang=\"dockerfile\" data-unlink=\"\">\n<span class=\"synStatement\">FROM<\/span> public.ecr.aws\/amazonlinux\/amazonlinux:latest\n\n\n<span class=\"synStatement\">WORKDIR<\/span> \/app\n\n\n<span class=\"synStatement\">COPY<\/span> app.py .\n\n\n<span class=\"synStatement\">CMD<\/span> <span class=\"synSpecial\">[<\/span>\"<span class=\"synConstant\">python3<\/span>\", \"<span class=\"synConstant\">-u<\/span>\", \"<span class=\"synConstant\">app.py<\/span>\"<span class=\"synSpecial\">]<\/span>\n<\/pre>\n<p>Docker\u30a4\u30e1\u30fc\u30b8\u3092\u30d3\u30eb\u30c9\u3057\u3001\u30b3\u30f3\u30c6\u30ca\u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre class=\"code bash\" data-lang=\"bash\" data-unlink=\"\">$ docker build -t my-app .\n\n# \u30b3\u30f3\u30c6\u30ca\u3092\u30d5\u30a9\u30a2\u30b0\u30e9\u30a6\u30f3\u30c9\u3067\u8d77\u52d5\n$ docker run --name my-app my-app:latest\nLog 1\nLog 2\n...\nLog 6\nError 6\n...\n\n(Ctrl + C \u3067\u505c\u6b62)<\/pre>\n<p>\u3053\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u306f\u300110\u79d2\u3054\u3068\u306b\u6a19\u6e96\u51fa\u529b\u306b\u30ed\u30b0\u3092\u51fa\u529b\u3057\u300160\u79d2\u3054\u3068\uff086\u56de\u76ee\u3054\u3068\uff09\u306b\u6a19\u6e96\u30a8\u30e9\u30fc\u51fa\u529b\u3078\u30a8\u30e9\u30fc\u30ed\u30b0\u3082\u51fa\u529b\u3057\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u307e\u307e\u3067\u306f\u30b3\u30f3\u30c6\u30ca\u304c\u30d5\u30a9\u30a2\u30b0\u30e9\u30a6\u30f3\u30c9\u3067\u5b9f\u884c\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u51fa\u529b\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3059\u304c\u3001\u4ed6\u306e\u64cd\u4f5c\u304c\u3067\u304d\u307e\u305b\u3093\u3002<br \/>\n\u5b9f\u969b\u306e\u904b\u7528\u3067\u306f\u3001\u8907\u6570\u306e\u30b3\u30f3\u30c6\u30ca\u3092\u30d0\u30c3\u30af\u30b0\u30e9\u30a6\u30f3\u30c9\u3067\u52d5\u4f5c\u3055\u305b\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2 id=\"\u30b3\u30f3\u30c6\u30ca\u3092\u30d0\u30c3\u30af\u30b0\u30e9\u30a6\u30f3\u30c9\u3067\u5b9f\u884c\u3059\u308b\">\u30b3\u30f3\u30c6\u30ca\u3092\u30d0\u30c3\u30af\u30b0\u30e9\u30a6\u30f3\u30c9\u3067\u5b9f\u884c\u3059\u308b<\/h2>\n<p>\u6b21\u306b\u3001\u30b3\u30f3\u30c6\u30ca\u3092\u30d0\u30c3\u30af\u30b0\u30e9\u30a6\u30f3\u30c9\u3067\u5b9f\u884c\u3057\u3001\u30ed\u30b0\u3092\u78ba\u8a8d\u3059\u308b\u65b9\u6cd5\u3092\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<p>\u4e00\u5ea6\u3001\u30b3\u30f3\u30c6\u30ca\u3092\u505c\u6b62\u3057\u3001\u524a\u9664\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"code bash\" data-lang=\"bash\" data-unlink=\"\"># \u30b3\u30f3\u30c6\u30ca\u3092\u505c\u6b62\uff08Ctrl + C\u3067\u505c\u6b62\u3057\u3066\u3044\u306a\u3044\u5834\u5408\uff09\n$ docker stop my-app\n\n# \u30b3\u30f3\u30c6\u30ca\u3092\u524a\u9664\n$ docker rm my-app<\/pre>\n<p>\u30d0\u30c3\u30af\u30b0\u30e9\u30a6\u30f3\u30c9\u3067\u30b3\u30f3\u30c6\u30ca\u3092\u8d77\u52d5\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"code bash\" data-lang=\"bash\" data-unlink=\"\">$ docker run -d --name my-app my-app:latest<\/pre>\n<p>\u5148\u307b\u3069\u306f10\u79d2\u3054\u3068\u306b\u30ed\u30b0\u304c\u51fa\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u3053\u306e\u307e\u307e\u3067\u306f\u30ed\u30b0\u3092\u78ba\u8a8d\u3067\u304d\u307e\u305b\u3093\u3002<br \/>\n\u3053\u308c\u306f\u3001\u30b3\u30f3\u30c6\u30ca\u304c\u30d0\u30c3\u30af\u30b0\u30e9\u30a6\u30f3\u30c9\u3067\u5b9f\u884c\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3067\u3059\u3002<\/p>\n<h2 id=\"\u30ed\u30b0\u306e\u51fa\u529b\u65b9\u6cd5\u6a19\u6e96\u6a5f\u80fd\">\u30ed\u30b0\u306e\u51fa\u529b\u65b9\u6cd5\uff08\u6a19\u6e96\u6a5f\u80fd\uff09<\/h2>\n<p>Docker\u4e0a\u3067\u52d5\u304f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30ed\u30b0\u306e\u6a19\u6e96\u6a5f\u80fd\u3068\u3057\u3066<code>docker logs<\/code>\u30b3\u30de\u30f3\u30c9\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n<code>docker logs<\/code>\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u30b3\u30f3\u30c6\u30ca\u306e\u6a19\u6e96\u51fa\u529b\u3068\u6a19\u6e96\u30a8\u30e9\u30fc\u51fa\u529b\u306b\u9001\u3089\u308c\u305f\u30ed\u30b0\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u8868\u793a\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u5b9f\u969b\u306b\u30ed\u30b0\u3092\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre class=\"code\" data-lang=\"\" data-unlink=\"\">$ docker logs -f my-app\nLog 1\nLog 2\nLog 3\nLog 4\n...\n\n\uff08Ctrl + C \u3067\u505c\u6b62\uff09<\/pre>\n<p>\u30d5\u30a9\u30a2\u30b0\u30e9\u30a6\u30f3\u30c9\u3067\u5b9f\u884c\u3057\u3066\u3044\u308b\u5834\u5408\u3068\u540c\u69d8\u306b\u300110\u79d2\u3054\u3068\u306b\u30ed\u30b0\u304c\u51fa\u529b\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u78ba\u8a8d\u3067\u304d\u305f\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u307e\u307e\u3067\u306f\u5148\u307b\u3069\u3068\u540c\u69d8\u306b\u3001\u30ed\u30b0\u3092\u78ba\u8a8d\u3057\u3066\u3044\u308b\u9593\u306f\u4ed6\u306e\u64cd\u4f5c\u304c\u3067\u304d\u307e\u305b\u3093\u3002<br \/>\n\u305d\u3053\u3067\u3001\u6b21\u306e\u3088\u3046\u306b\u3057\u3066\u30ed\u30b0\u3092\u30d5\u30a1\u30a4\u30eb\u306b\u51fa\u529b\u3059\u308b\u3053\u3068\u3067\u3001\u4ed6\u306e\u64cd\u4f5c\u3092\u884c\u3048\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<p><strong>\u3010\u91cd\u8981\uff1a\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u3068\u6a29\u9650\u306e\u8a2d\u5b9a\u3011<\/strong><br \/>\n<code>\/var\/log\/<\/code>\u914d\u4e0b\u306b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3059\u308b\u969b\u306f\u3001\u9069\u5207\u306a\u6a29\u9650\u8a2d\u5b9a\u304c\u5fc5\u9808\u3067\u3059\u3002<br \/>\n\u5b9f\u904b\u7528\u3067\u306f\u5c02\u7528\u30e6\u30fc\u30b6\u30fc\u3092\u4f5c\u6210\u3057\u3001\u6700\u5c0f\u6a29\u9650\u306e\u539f\u5247\u306b\u5f93\u3063\u3066\u6a29\u9650\u3092\u4ed8\u4e0e\u3059\u308b\u3053\u3068\u3092\u5f37\u304f\u63a8\u5968\u3057\u307e\u3059\u3002<br \/>\n\u4eca\u56de\u306fSession Manager\u7d4c\u7531\u3067\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3044\u308b\u305f\u3081\u3001ssm-user\u3092\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u672c\u756a\u74b0\u5883\u3067\u306f\u5c02\u7528\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30e6\u30fc\u30b6\u30fc\u3092\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"code bash\" data-lang=\"bash\" data-unlink=\"\"># 1. \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4f5c\u6210\n$ sudo mkdir -p \/var\/log\/docker\/my-app\n\n# 2. \u73fe\u5728\u306e\u30e6\u30fc\u30b6\u30fc\u306b\u6a29\u9650\u3092\u4ed8\u4e0e\uff08SSM\u3067\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3044\u308b\u305f\u3081ssm-user\uff09\n$ sudo chown ssm-user:ssm-user \/var\/log\/docker\/my-app\n$ sudo chmod 755 \/var\/log\/docker\/my-app\n\n\n# 3. \u6a29\u9650\u78ba\u8a8d\n$ ls -al \/var\/log\/docker\/\ndrwxr-xr-x. 2 ssm-user ssm-user  6 Oct  8 11:26 my-app\n\n# 4. \u30b3\u30f3\u30c6\u30ca\u306e\u5b9f\u884c\n$ docker run -d --name my-app my-app:latest\n\n# 5. \u30ed\u30b0\u51fa\u529b\n$ docker logs -f my-app &gt; \/var\/log\/docker\/my-app\/app.log 2&gt;&amp;1 &amp;\n\n# 6. \u30ed\u30b0\u78ba\u8a8d\n$ tail -f \/var\/log\/docker\/my-app\/app.log\nLog 1\nLog 2\nLog 3\nLog 4<\/pre>\n<p><strong>\u3010\u6ce8\u610f\u4e8b\u9805\u3011<\/strong><br \/>\n\u3053\u306e\u65b9\u6cd5\u3067\u306f\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u304c\u969b\u9650\u306a\u304f\u5927\u304d\u304f\u306a\u308a\u307e\u3059\u3002\u5b9f\u904b\u7528\u3067\u306f<code>logrotate<\/code>\u7b49\u3092\u4f7f\u7528\u3057\u3066\u30ed\u30b0\u30ed\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u306e\u8a2d\u5b9a\u304c\u5fc5\u8981\u3067\u3059\u3002\u307e\u305f\u3001\u30d0\u30c3\u30af\u30b0\u30e9\u30a6\u30f3\u30c9\u3067\u5b9f\u884c\u3057\u3066\u3044\u308b\u30ed\u30b0\u51fa\u529b\u30d7\u30ed\u30bb\u30b9\u306e\u7ba1\u7406\u306b\u306f\u3001<code>systemd<\/code>\u30b5\u30fc\u30d3\u30b9\u5316\u306a\u3069\u306e\u9069\u5207\u306a\u30d7\u30ed\u30bb\u30b9\u7ba1\u7406\u624b\u6cd5\u3092\u691c\u8a0e\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u3053\u308c\u3067\u3001EC2\u4e0a\u3067\u52d5\u304f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30ed\u30b0\u3092\u30d5\u30a1\u30a4\u30eb\u306b\u51fa\u529b\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u591a\u304f\u306eAWS\u30b5\u30fc\u30d3\u30b9\u3067\u306fCloudWatch Logs\u306b\u305d\u306e\u30ed\u30b0\u304c\u81ea\u52d5\u7684\u306b\u96c6\u7d04\u3055\u308c\u307e\u3059\u3002<br \/>\nCloudWatch Logs\u3001CloudWatch \u30e1\u30c8\u30ea\u30af\u30b9\u3001CloudWatch \u30a2\u30e9\u30fc\u30e0\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u3001\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u306e\u76e3\u8996\u3084\u30a2\u30e9\u30fc\u30c8\u901a\u77e5\u3082\u53ef\u80fd\u3067\u3059\u3002<br \/>\n\u305d\u308c\u3067\u306f\u3001EC2\u4e0a\u306e\u30d5\u30a1\u30a4\u30eb\u3092CloudWatch Logs\u306b\u9001\u4fe1\u3059\u308b\u306b\u306f\u3069\u3046\u3059\u308c\u3070\u3088\u3044\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n<p>\u6b21\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u306b\u9032\u3080\u524d\u306b\u3001\u4e0d\u8981\u306a\u30b3\u30f3\u30c6\u30ca\u3092\u505c\u6b62\u30fb\u524a\u9664\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"code bash\" data-lang=\"bash\" data-unlink=\"\"># \u30b3\u30f3\u30c6\u30ca\u3092\u505c\u6b62\n$ docker stop my-app\n\n# \u30b3\u30f3\u30c6\u30ca\u3092\u524a\u9664\n$ docker rm my-app<\/pre>\n<h2 id=\"CloudWatch-\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u3092\u4f7f\u7528\u3057\u305f\u30ed\u30b0\u306e\u9001\u4fe1\u76e3\u8996\">CloudWatch \u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u3092\u4f7f\u7528\u3057\u305f\u30ed\u30b0\u306e\u9001\u4fe1\u30fb\u76e3\u8996<\/h2>\n<p>EC2\u4e0a\u306e\u30d5\u30a1\u30a4\u30eb\u3092CloudWatch Logs\u306b\u9001\u4fe1\u3059\u308b\u7b54\u3048\u306f\u300cCloudWatch \u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u300d\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3059\u3002<\/p>\n<h3 id=\"CloudWatch-\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u3068\u306f\">CloudWatch \u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u3068\u306f<\/h3>\n<p>CloudWatch \u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u306f\u3001EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u4e0a\u3067\u52d5\u4f5c\u3057\u3001\u30b7\u30b9\u30c6\u30e0\u30ec\u30d9\u30eb\u306e\u60c5\u5831\u3092CloudWatch\u306b\u9001\u4fe1\u3059\u308b\u305f\u3081\u306e\u30c4\u30fc\u30eb\u3067\u3059\u3002<br \/>\nCPU\u4f7f\u7528\u7387\u3001\u30e1\u30e2\u30ea\u4f7f\u7528\u7387\u3001\u30c7\u30a3\u30b9\u30af\u4f7f\u7528\u7387\u306a\u3069\u306e\u30e1\u30c8\u30ea\u30af\u30b9\u3092\u53ce\u96c6\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n\u4eca\u56de\u306f\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u3092CloudWatch Logs\u306b\u9001\u4fe1\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<p><a target=\"_blank\" href=\"https:\/\/docs.aws.amazon.com\/ja_jp\/AmazonCloudWatch\/latest\/monitoring\/Install-CloudWatch-Agent.html\">\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a><\/p>\n<h3 id=\"CloudWatch-\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u306e\u524d\u63d0\u6761\u4ef6\">CloudWatch \u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u306e\u524d\u63d0\u6761\u4ef6<\/h3>\n<p>CloudWatch \u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u3092\u4f7f\u7528\u3057\u3066\u30ed\u30b0\u3092\u9001\u4fe1\u3059\u308b\u306b\u306f\u3001\u4ee5\u4e0b\u306e\u524d\u63d0\u6761\u4ef6\u3092\u6e80\u305f\u3059\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<ul>\n<li>EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306b\u9069\u5207\u306aIAM\u30dd\u30ea\u30b7\u30fc\uff08<code>CloudWatchAgentServerPolicy<\/code>\uff09\u304c\u30a2\u30bf\u30c3\u30c1\u3055\u308c\u3066\u3044\u308b\u3053\u3068\n<ul>\n<li>EC2\u30b3\u30f3\u30bd\u30fc\u30eb\u753b\u9762\u3067\u5bfe\u8c61\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u9078\u629e<\/li>\n<li>\u300c\u30a2\u30af\u30b7\u30e7\u30f3\u300d\u2192\u300c\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u300d\u2192\u300cIAM\u30ed\u30fc\u30eb\u3092\u5909\u66f4\u300d\u3092\u9078\u629e<\/li>\n<li>\u65e2\u5b58\u306eIAM\u30ed\u30fc\u30eb\u306b<code>CloudWatchAgentServerPolicy<\/code>\u30de\u30cd\u30fc\u30b8\u30c9\u30dd\u30ea\u30b7\u30fc\u3092\u30a2\u30bf\u30c3\u30c1<\/li>\n<li>\u307e\u305f\u306f\u3001\u65b0\u3057\u3044IAM\u30ed\u30fc\u30eb\u3092\u4f5c\u6210\u3057\u3066<code>CloudWatchAgentServerPolicy<\/code>\u3092\u30a2\u30bf\u30c3\u30c1\u3057\u3001\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306b\u95a2\u9023\u4ed8\u3051<\/li>\n<\/ul>\n<\/li>\n<li>CloudWatch \u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u3053\u3068<\/li>\n<\/ul>\n<h3 id=\"CloudWatch-\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\">CloudWatch \u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n<p>Amazon Linux 2023\u3067\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3067\u3057\u305f\u3002<br \/>\nCloudWatch \u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u306b\u306f\u3001\u4ee5\u4e0b\u306e\u624b\u9806\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"code bash\" data-lang=\"bash\" data-unlink=\"\">$ sudo yum install -y amazon-cloudwatch-agent<\/pre>\n<p><a target=\"_blank\" href=\"https:\/\/docs.aws.amazon.com\/ja_jp\/AmazonCloudWatch\/latest\/monitoring\/manual-installation.html#amazon-linux-package\">AWS\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\uff1a\u30d1\u30c3\u30b1\u30fc\u30b8\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3092\u4f7f\u7528\u3057\u3066 Amazon Linux \u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/a><\/p>\n<h3 id=\"CloudWatch-\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\">CloudWatch \u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b<\/h3>\n<p>\u5148\u307b\u3069\u7d39\u4ecb\u3057\u305f\u3088\u3046\u306b\u3001CloudWatch \u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u3067\u306f\u69d8\u3005\u306a\u60c5\u5831\u3092CloudWatch\u306b\u9001\u4fe1\u3067\u304d\u307e\u3059\u3002<br \/>\n\u305d\u306e\u305f\u3081\u306b\u3001\u4f55\u306e\u60c5\u5831\u3092\u9001\u4fe1\u3059\u308b\u306e\u304b\u3092\u5b9a\u7fa9\u3057\u305f\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<p>\u30a6\u30a3\u30b6\u30fc\u30c9\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u7c21\u5358\u306b\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3067\u304d\u307e\u3059\u304c\u3001\u4eca\u56de\u306f\u624b\u52d5\u3067\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p><strong>\u3010\u30dd\u30a4\u30f3\u30c8\uff01\u3011<\/strong><br \/>\n\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u30a6\u30a3\u30b6\u30fc\u30c9\u3092\u8d77\u52d5\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"code bash\" data-lang=\"bash\" data-unlink=\"\">$ sudo \/opt\/aws\/amazon-cloudwatch-agent\/bin\/amazon-cloudwatch-agent-config-wizard\n================================================================\n= Welcome to the Amazon CloudWatch Agent Configuration Manager =\n=                                                              =\n= CloudWatch Agent allows you to collect metrics and logs from =\n= your host and send them to CloudWatch. Additional CloudWatch =\n= charges may apply.                                           =\n================================================================\nOn which OS are you planning to use the agent?\n1. linux\n2. windows\n3. darwin\ndefault choice: [1]:\n\n\uff08\u4ee5\u4e0b\u3001\u8cea\u554f\u306b\u56de\u7b54\uff09<\/pre>\n<p><a target=\"_blank\" href=\"https:\/\/docs.aws.amazon.com\/ja_jp\/AmazonCloudWatch\/latest\/monitoring\/create-cloudwatch-agent-configuration-file-wizard.html\">AWS\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\uff1aCloudWatch \u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b<\/a><\/p>\n<p>\u4eca\u56de\u306f\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u306e\u307f\u3092CloudWatch Logs\u306b\u9001\u4fe1\u3059\u308b\u8a2d\u5b9a\u3092\u884c\u3046\u305f\u3081\u3001\u4ee5\u4e0b\u306e\u624b\u9806\u3067\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p><strong>\u3010\u91cd\u8981\u30dd\u30a4\u30f3\u30c8\uff01\u3011<\/strong><br \/>\n\u30d5\u30a1\u30a4\u30eb\u540d\u306f <code>amazon-cloudwatch-agent.json<\/code> \u3067\u3042\u308b\u5fc5\u8981\u304c\u3042\u308a\u3001<br \/>\n\u914d\u7f6e\u5148\u306f <code>\/opt\/aws\/amazon-cloudwatch-agent\/etc\/<\/code> \u3067\u3042\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"code bash\" data-lang=\"bash\" data-unlink=\"\"># \u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\n$ sudo touch \/opt\/aws\/amazon-cloudwatch-agent\/etc\/amazon-cloudwatch-agent.json\n\n# \u8a2d\u5b9a\u5185\u5bb9\u3092\u7de8\u96c6\n$ sudo vi \/opt\/aws\/amazon-cloudwatch-agent\/etc\/amazon-cloudwatch-agent.json<\/pre>\n<p>\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306b\u306f\u3001\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u8cbc\u308a\u4ed8\u3051\u307e\u3059\u3002<\/p>\n<pre class=\"code lang-json\" data-lang=\"json\" data-unlink=\"\"><span class=\"synSpecial\">{<\/span>\n  \"<span class=\"synStatement\">logs<\/span>\": <span class=\"synSpecial\">{<\/span>\n    \"<span class=\"synStatement\">logs_collected<\/span>\": <span class=\"synSpecial\">{<\/span>\n      \"<span class=\"synStatement\">files<\/span>\": <span class=\"synSpecial\">{<\/span>\n        \"<span class=\"synStatement\">collect_list<\/span>\": <span class=\"synSpecial\">[<\/span>\n          <span class=\"synSpecial\">{<\/span>\n            \"<span class=\"synStatement\">file_path<\/span>\": \"<span class=\"synConstant\">\/var\/log\/docker\/my-app\/app.log<\/span>\",\n            \"<span class=\"synStatement\">log_group_name<\/span>\": \"<span class=\"synConstant\">\/aws\/ec2\/docker\/applications\/my-app<\/span>\",\n            \"<span class=\"synStatement\">log_stream_name<\/span>\": \"<span class=\"synConstant\">{instance_id}-{hostname}<\/span>\",\n            \"<span class=\"synStatement\">timezone<\/span>\": \"<span class=\"synConstant\">Local<\/span>\"\n          <span class=\"synSpecial\">}<\/span>\n        <span class=\"synSpecial\">]<\/span>\n      <span class=\"synSpecial\">}<\/span>\n    <span class=\"synSpecial\">}<\/span>\n  <span class=\"synSpecial\">}<\/span>\n<span class=\"synSpecial\">}<\/span>\n<\/pre>\n<p><strong>\u3010\u30dd\u30a4\u30f3\u30c8!\u3011<\/strong><br \/>\n\u30d1\u30e9\u30e1\u30fc\u30bf\u30b9\u30c8\u30a2\u3084Secrets Manager\u306b\u4fdd\u5b58\u3057\u3066\u304a\u304d\u3001CloudWatch \u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u306e\u8d77\u52d5\u6642\u306b\u53c2\u7167\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u3002<br \/>\n\u4e00\u5143\u7ba1\u7406\u304c\u53ef\u80fd\u306b\u306a\u308a\u3001Auto Scaling\u7b49\u3067\u30b9\u30b1\u30fc\u30ea\u30f3\u30b0\u3055\u305b\u305f\u969b\u3082\u540c\u3058\u8a2d\u5b9a\u3067\u8d77\u52d5\u3067\u304d\u308b\u305f\u3081\u3001\u904b\u7528\u306e\u52b9\u7387\u5316\u304c\u56f3\u308c\u307e\u3059\u3002<\/p>\n<p><strong>\u3010\u6ce8\u610f\u3011<\/strong><br \/>\n\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u5909\u66f4\u3057\u305f\u5834\u5408\u306f\u3001CloudWatch \u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u306e\u518d\u8d77\u52d5\u304c\u5fc5\u8981\u3067\u3059\uff1a<\/p>\n<pre class=\"code bash\" data-lang=\"bash\" data-unlink=\"\">$ sudo systemctl restart amazon-cloudwatch-agent<\/pre>\n<h3 id=\"CloudWatch-\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u306e\u8d77\u52d5\u3068\u78ba\u8a8d\">CloudWatch \u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u306e\u8d77\u52d5\u3068\u78ba\u8a8d<\/h3>\n<p>\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u5f8c\u3001\u4ee5\u4e0b\u306e\u624b\u9806\u3067\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u3092\u8d77\u52d5\u3057\u307e\u3059\uff1a<\/p>\n<pre class=\"code bash\" data-lang=\"bash\" data-unlink=\"\"># \u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u3092\u8d77\u52d5\n$ sudo systemctl start amazon-cloudwatch-agent\n\n# \u30b9\u30c6\u30fc\u30bf\u30b9\u78ba\u8a8d\n$ sudo systemctl status amazon-cloudwatch-agent\n\n# \u81ea\u52d5\u8d77\u52d5\u3092\u6709\u52b9\u5316\n$ sudo systemctl enable amazon-cloudwatch-agent\n\n# \u30ed\u30b0\u3067\u52d5\u4f5c\u78ba\u8a8d\n$ sudo journalctl -u amazon-cloudwatch-agent -f<\/pre>\n<p>\u4ee5\u4e0a\u3067CloudWatch \u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u306e\u8a2d\u5b9a\u3068\u8d77\u52d5\u304c\u5b8c\u4e86\u3057\u307e\u3057\u305f\u3002<br \/>\n\u7d9a\u3044\u3066\u3001\u5b9f\u969b\u306b\u30ed\u30b0\u304cCloudWatch Logs\u306b\u9001\u4fe1\u3055\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2 id=\"CloudWatch-Logs\u3067\u306e\u78ba\u8a8d\">CloudWatch Logs\u3067\u306e\u78ba\u8a8d<\/h2>\n<p>\u307e\u305a\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u8d77\u52d5\u3057\u3066\u30ed\u30b0\u3092\u51fa\u529b\u3055\u305b\u307e\u3059\u3002<\/p>\n<pre class=\"code bash\" data-lang=\"bash\" data-unlink=\"\"># \u30b3\u30f3\u30c6\u30ca\u3092\u30d0\u30c3\u30af\u30b0\u30e9\u30a6\u30f3\u30c9\u3067\u8d77\u52d5\n$ docker run -d --name my-app my-app:latest\n\n# \u30ed\u30b0\u3092\u30d5\u30a1\u30a4\u30eb\u306b\u51fa\u529b\n$ docker logs -f my-app &gt; \/var\/log\/docker\/my-app\/app.log 2&gt;&amp;1 &amp;<\/pre>\n<p>\u6570\u5206\u5f85\u3063\u3066\u304b\u3089\u3001CloudWatch \u30b3\u30f3\u30bd\u30fc\u30eb\u3067\u30ed\u30b0\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<p><a target=\"_blank\" href=\"https:\/\/ap-northeast-1.console.aws.amazon.com\/cloudwatch\/home?region=ap-northeast-1#home:\">CloudWatch \u30b3\u30f3\u30bd\u30fc\u30eb<\/a>\u306b\u79fb\u52d5\u3057\u3001\u5de6\u5074\u306e\u30e1\u30cb\u30e5\u30fc\u304b\u3089\u300c\u30ed\u30b0\u30b0\u30eb\u30fc\u30d7\u300d\u3092\u9078\u629e\u3057\u307e\u3059\u3002<br \/>\n\u5148\u307b\u3069\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3067\u6307\u5b9a\u3057\u305f\u30ed\u30b0\u30b0\u30eb\u30fc\u30d7\u540d <code>\/aws\/ec2\/docker\/applications\/my-app<\/code> \u3092\u691c\u7d22\u3057\u307e\u3059\u3002<\/p>\n<figure class=\"figure-image figure-image-fotolife\" title=\"\u30ed\u30b0\u30b0\u30eb\u30fc\u30d7\"><span itemscope=\"\" itemtype=\"http:\/\/schema.org\/Photograph\"><img decoding=\"async\" src=\"https:\/\/cdn-ak.f.st-hatena.com\/images\/fotolife\/s\/swx-kazuma-doi\/20251015\/20251015172248.png\" width=\"1200\" height=\"572\" loading=\"lazy\" title=\"\" class=\"hatena-fotolife\" itemprop=\"image\"\/><\/span><figcaption>\u30ed\u30b0\u30b0\u30eb\u30fc\u30d7<\/figcaption><\/figure>\n<p>\u30ed\u30b0\u30b9\u30c8\u30ea\u30fc\u30e0\u540d\u3068\u3057\u3066<code>{instance_id}-{hostname}<\/code> \u3068\u8a2d\u5b9a\u3057\u3066\u3044\u308b\u305f\u3081\u3001EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306eID\u3068\u30db\u30b9\u30c8\u540d\u304c\u542b\u307e\u308c\u305f\u30ed\u30b0\u30b9\u30c8\u30ea\u30fc\u30e0\u304c\u8868\u793a\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<figure class=\"figure-image figure-image-fotolife\" title=\"\u30ed\u30b0\u30b9\u30c8\u30ea\u30fc\u30e0\"><span itemscope=\"\" itemtype=\"http:\/\/schema.org\/Photograph\"><img decoding=\"async\" src=\"https:\/\/cdn-ak.f.st-hatena.com\/images\/fotolife\/s\/swx-kazuma-doi\/20251015\/20251015172306.png\" width=\"1200\" height=\"573\" loading=\"lazy\" title=\"\" class=\"hatena-fotolife\" itemprop=\"image\"\/><\/span><figcaption>\u30ed\u30b0\u30b9\u30c8\u30ea\u30fc\u30e0<\/figcaption><\/figure>\n<p>\u30ed\u30b0\u30b9\u30c8\u30ea\u30fc\u30e0\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u3001EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u4e0a\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u51fa\u529b\u3057\u305f\u30ed\u30b0\u304c\u8868\u793a\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<figure class=\"figure-image figure-image-fotolife\" title=\"\u30ed\u30b0\u30a4\u30d9\u30f3\u30c8\"><span itemscope=\"\" itemtype=\"http:\/\/schema.org\/Photograph\"><img decoding=\"async\" src=\"https:\/\/cdn-ak.f.st-hatena.com\/images\/fotolife\/s\/swx-kazuma-doi\/20251015\/20251015172321.png\" width=\"1200\" height=\"566\" loading=\"lazy\" title=\"\" class=\"hatena-fotolife\" itemprop=\"image\"\/><\/span><figcaption>\u30ed\u30b0\u30a4\u30d9\u30f3\u30c8<\/figcaption><\/figure>\n<p>\u4ee5\u4e0a\u306e\u8a2d\u5b9a\u3067\u3001EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u4e0a\u306eDocker\u30b3\u30f3\u30c6\u30ca\u304b\u3089\u51fa\u529b\u3055\u308c\u305f\u30ed\u30b0\u304cCloudWatch Logs\u306b\u9001\u4fe1\u3055\u308c\u3001\u78ba\u8a8d\u3067\u304d\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3057\u305f\u3002<br \/>\n10\u79d2\u3054\u3068\u306b\u30ed\u30b0\u304c\u51fa\u529b\u3055\u308c\u300160\u79d2\u3054\u3068\uff086\u56de\u3054\u3068\uff09\u306b\u30a8\u30e9\u30fc\u304c\u51fa\u529b\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3082\u78ba\u8a8d\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<h2 id=\"\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30a8\u30e9\u30fc\u3092\u78ba\u8a8d\u3059\u308b\">\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30a8\u30e9\u30fc\u3092\u78ba\u8a8d\u3059\u308b<\/h2>\n<p>EC2\u4e0a\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u51fa\u529b\u3057\u305f\u30ed\u30b0\u3092CloudWatch Logs\u306b\u9001\u4fe1\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<br \/>\n\u672c\u30d6\u30ed\u30b0\u306e\u30c6\u30fc\u30de\u3067\u3042\u308b\u300c\u76e3\u8996\u300d\u3092\u5b9f\u73fe\u3059\u308b\u305f\u3081\u306b\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30a8\u30e9\u30fc\u3092\u691c\u51fa\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u3067\u306f\u3001CloudWatch Logs Insights\u3067\u30a8\u30e9\u30fc\u3092\u691c\u7d22\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>CloudWatch \u30b3\u30f3\u30bd\u30fc\u30eb\u306e\u5de6\u5074\u306e\u30e1\u30cb\u30e5\u30fc\u304b\u3089\u300c\u30ed\u30b0\u306e\u30a4\u30f3\u30b5\u30a4\u30c8\u300d\u3092\u9078\u629e\u3057\u307e\u3059\u3002<\/p>\n<p>\u300c\u9078\u629e\u57fa\u6e96\u300d\u304b\u3089\u5148\u307b\u3069\u306e\u30ed\u30b0\u30b0\u30eb\u30fc\u30d7 <code>\/aws\/ec2\/docker\/applications\/my-app<\/code> \u3092\u9078\u629e\u3057\u307e\u3059\u3002<br \/>\n\u30af\u30a8\u30ea\u30a8\u30c7\u30a3\u30bf\u306b\u4ee5\u4e0b\u306e\u30af\u30a8\u30ea\u3092\u8cbc\u308a\u4ed8\u3051\u3001\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"code lang-sql\" data-lang=\"sql\" data-unlink=\"\">fields @<span class=\"synType\">timestamp<\/span>, @message, @logStream, @<span class=\"synIdentifier\">log<\/span>\n| filter @message <span class=\"synStatement\">like<\/span> \/Error\/\n| sort @<span class=\"synType\">timestamp<\/span> <span class=\"synSpecial\">desc<\/span>\n| limit <span class=\"synConstant\">10<\/span>\n<\/pre>\n<figure class=\"figure-image figure-image-fotolife\" title=\"\u30ed\u30b0\u306e\u30a4\u30f3\u30b5\u30a4\u30c8\u753b\u9762\"><span itemscope=\"\" itemtype=\"http:\/\/schema.org\/Photograph\"><img decoding=\"async\" src=\"https:\/\/cdn-ak.f.st-hatena.com\/images\/fotolife\/s\/swx-kazuma-doi\/20251015\/20251015174157.png\" width=\"1200\" height=\"568\" loading=\"lazy\" title=\"\" class=\"hatena-fotolife\" itemprop=\"image\"\/><\/span><figcaption>\u30ed\u30b0\u306e\u30a4\u30f3\u30b5\u30a4\u30c8\u753b\u9762<\/figcaption><\/figure>\n<p>\u300c\u30af\u30a8\u30ea\u306e\u5b9f\u884c\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u3001\u30af\u30a8\u30ea\u7d50\u679c\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><strong>\u3010\u30dd\u30a4\u30f3\u30c8\uff01\u3011<\/strong><br \/>\n\u7279\u5b9a\u306e\u671f\u9593\u306e\u30ed\u30b0\u3092\u53d6\u5f97\u3057\u305f\u3044\u5834\u5408\u306f\u53f3\u4e0a\u3067\u671f\u9593\u3092\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n\u30af\u30a8\u30ea\u30a8\u30c7\u30a3\u30bf\u4e0b\u90e8\u306eQuery generator\uff08\u82f1\u8a9e\u306e\u307f\uff09\u3084\u30b3\u30f3\u30bd\u30fc\u30eb\u53f3\u4e0a\u306eAmazon Q\uff08\u65e5\u672c\u8a9e\u3082\u53ef\uff09\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u5bfe\u8a71\u7684\u306b\u30af\u30a8\u30ea\u6587\u3092\u751f\u6210\u3067\u304d\u307e\u3059\u3002<\/p>\n<figure class=\"figure-image figure-image-fotolife\" title=\"\u30af\u30a8\u30ea\u7d50\u679c\"><span itemscope=\"\" itemtype=\"http:\/\/schema.org\/Photograph\"><img decoding=\"async\" src=\"https:\/\/cdn-ak.f.st-hatena.com\/images\/fotolife\/s\/swx-kazuma-doi\/20251015\/20251015174826.png\" width=\"1200\" height=\"567\" loading=\"lazy\" title=\"\" class=\"hatena-fotolife\" itemprop=\"image\"\/><\/span><figcaption>\u30af\u30a8\u30ea\u7d50\u679c<\/figcaption><\/figure>\n<h2 id=\"CloudWatch\u3067\u76e3\u8996\u8a2d\u5b9a\u3092\u884c\u3046\">CloudWatch\u3067\u76e3\u8996\u8a2d\u5b9a\u3092\u884c\u3046<\/h2>\n<p>\u30ed\u30b0\u306e\u76e3\u8996\u3092\u884c\u3046\u305f\u3081\u306b\u306f\u3001<\/p>\n<ul>\n<li>\u691c\u51fa\u6587\u5b57\u5217\u306e\u30e1\u30c8\u30ea\u30af\u30b9\u30d5\u30a3\u30eb\u30bf\u30fc\u3092\u4f5c\u6210\u3057\u3001CloudWatch \u30e1\u30c8\u30ea\u30af\u30b9\u306b\u5909\u63db<\/li>\n<li>CloudWatch \u30a2\u30e9\u30fc\u30e0\u3092\u4f5c\u6210\u3057\u3001\u30e1\u30c8\u30ea\u30af\u30b9\u306b\u57fa\u3065\u3044\u3066\u30a2\u30e9\u30fc\u30c8\u3092\u767a\u884c<\/li>\n<\/ul>\n<p>\u306e2\u3064\u306e\u30b9\u30c6\u30c3\u30d7\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u30b9\u30c6\u30c3\u30d7\u3067\u306f\u3001AWS \u30de\u30cd\u30b8\u30e1\u30f3\u30c8\u30b3\u30f3\u30bd\u30fc\u30eb\u4e0a\u3067\u30b7\u30a7\u30eb\u30b3\u30de\u30f3\u30c9\u304c\u5b9f\u884c\u3067\u304d\u308bAWS CloudShell\u304b\u3089\u3001<br \/>\nAWS CLI\u30b3\u30de\u30f3\u30c9\u3092\u5229\u7528\u3057\u3066\u30e1\u30c8\u30ea\u30af\u30b9\u30d5\u30a3\u30eb\u30bf\u30fc\u3068\u30a2\u30e9\u30fc\u30e0\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<h3 id=\"\u30e1\u30c8\u30ea\u30af\u30b9\u30d5\u30a3\u30eb\u30bf\u30fc\u306e\u4f5c\u6210\">\u30e1\u30c8\u30ea\u30af\u30b9\u30d5\u30a3\u30eb\u30bf\u30fc\u306e\u4f5c\u6210<\/h3>\n<p>\u30de\u30cd\u30b8\u30e1\u30f3\u30c8\u30b3\u30f3\u30bd\u30fc\u30eb\u753b\u9762\u5de6\u4e0b\u306b\u300cCloudShell\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u3001CloudShell\u3092\u8d77\u52d5\u3057\u307e\u3059\u3002<br \/>\nCloudShell\u3092\u958b\u304d\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u30e1\u30c8\u30ea\u30af\u30b9\u30d5\u30a3\u30eb\u30bf\u30fc\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"code bash\" data-lang=\"bash\" data-unlink=\"\">$ aws logs put-metric-filter \\\n --log-group-name \/aws\/ec2\/docker\/applications\/my-app \\\n --filter-name ErrorFilter \\\n --filter-pattern \"Error\" \\\n --metric-transformations metricName=ErrorCount, metricNamespace=MyApp, metricValue=1<\/pre>\n<div class=\"s_table\"><table>\n<thead>\n<tr>\n<th>\u30aa\u30d7\u30b7\u30e7\u30f3<\/th>\n<th style=\"text-align:left;\">\u610f\u5473 \/ \u7528\u9014<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>&#8211;log-group-name<\/td>\n<td style=\"text-align:left;\">\u5bfe\u8c61\u3068\u306a\u308bCloudWatch Logs\u306e\u30ed\u30b0\u30b0\u30eb\u30fc\u30d7\u540d<\/td>\n<\/tr>\n<tr>\n<td>&#8211;filter-name<\/td>\n<td style=\"text-align:left;\">\u4f5c\u6210\u3059\u308b\u30e1\u30c8\u30ea\u30af\u30b9\u30d5\u30a3\u30eb\u30bf\u30fc\u306e\u540d\u524d<\/td>\n<\/tr>\n<tr>\n<td>&#8211;filter-pattern<\/td>\n<td style=\"text-align:left;\">\u30ed\u30b0\u672c\u6587\u3068\u30de\u30c3\u30c1\u3055\u305b\u308b\u30d1\u30bf\u30fc\u30f3<\/td>\n<\/tr>\n<tr>\n<td>&#8211;metric-transformations<\/td>\n<td style=\"text-align:left;\">\u30de\u30c3\u30c1\u6642\u306b\u767a\u884c\u3059\u308b\u30e1\u30c8\u30ea\u30af\u30b9\u8a2d\u5b9a\u8907\u5408\u30aa\u30d7\u30b7\u30e7\u30f3<\/td>\n<\/tr>\n<tr>\n<td>metricName=<\/td>\n<td style=\"text-align:left;\">\u751f\u6210\u3059\u308b\u30e1\u30c8\u30ea\u30af\u30b9\u540d<\/td>\n<\/tr>\n<tr>\n<td>metricNamespace=<\/td>\n<td style=\"text-align:left;\">\u30e1\u30c8\u30ea\u30af\u30b9\u540d\u524d\u7a7a\u9593<\/td>\n<\/tr>\n<tr>\n<td>metricValue=<\/td>\n<td style=\"text-align:left;\">1\u884c\u30de\u30c3\u30c1\u3054\u3068\u306b\u9001\u308b\u5024<\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/div>\n<p>\u3053\u306e\u30b3\u30de\u30f3\u30c9\u306f\u3001\u30ed\u30b0\u30b0\u30eb\u30fc\u30d7 <code>\/aws\/ec2\/docker\/applications\/my-app<\/code> \u306b\u5bfe\u3057\u3066\u3001&#8221;Error&#8221; \u3068\u3044\u3046\u6587\u5b57\u5217\u3092\u542b\u3080\u30ed\u30b0\u30a8\u30f3\u30c8\u30ea\u3092\u691c\u51fa\u3059\u308b\u30e1\u30c8\u30ea\u30af\u30b9\u30d5\u30a3\u30eb\u30bf\u30fc <code>ErrorFilter<\/code> \u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p><code>Error<\/code>\u3068\u3044\u3046\u6587\u5b57\u5217\u304c\u542b\u307e\u308c\u308b\u30ed\u30b0\u30a8\u30f3\u30c8\u30ea\u304c\u691c\u51fa\u3055\u308c\u308b\u3068\u3001\u30e1\u30c8\u30ea\u30af\u30b9 <code>MyApp\/ErrorCount<\/code> \u3092<code>1<\/code>\u5897\u52a0\u3055\u305b\u307e\u3059\u3002<\/p>\n<p>\u5148\u307b\u3069\u78ba\u8a8d\u3057\u305f\u30ed\u30b0\u30b0\u30eb\u30fc\u30d7\u306e\u300c\u30e1\u30c8\u30ea\u30af\u30b9\u30d5\u30a3\u30eb\u30bf\u30fc\u300d\u30bf\u30d6\u3092\u78ba\u8a8d\u3059\u308b\u3068\u3001\u4f5c\u6210\u3057\u305f\u30d5\u30a3\u30eb\u30bf\u30fc\u304c\u8868\u793a\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<figure class=\"figure-image figure-image-fotolife\" title=\"\u30e1\u30c8\u30ea\u30af\u30b9\u30d5\u30a3\u30eb\u30bf\u30fc\"><span itemscope=\"\" itemtype=\"http:\/\/schema.org\/Photograph\"><img decoding=\"async\" src=\"https:\/\/cdn-ak.f.st-hatena.com\/images\/fotolife\/s\/swx-kazuma-doi\/20251029\/20251029211643.png\" width=\"1200\" height=\"566\" loading=\"lazy\" title=\"\" class=\"hatena-fotolife\" itemprop=\"image\"\/><\/span><figcaption>\u30e1\u30c8\u30ea\u30af\u30b9\u30d5\u30a3\u30eb\u30bf\u30fc\u753b\u9762<\/figcaption><\/figure>\n<p>\u305d\u3057\u3066\u3001\u3053\u306e\u30d5\u30a3\u30eb\u30bf\u30fc\u306b\u57fa\u3065\u3044\u3066CloudWatch \u30e1\u30c8\u30ea\u30af\u30b9 <code>MyApp\/ErrorCount<\/code> \u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u5de6\u30da\u30a4\u30f3\u306e\u300c\u30e1\u30c8\u30ea\u30af\u30b9\u300d\u304b\u3089\u300c\u3059\u3079\u3066\u306e\u30e1\u30c8\u30ea\u30af\u30b9\u300d\u3092\u9078\u629e\u3057\u3001<code>MyApp<\/code> \u540d\u524d\u7a7a\u9593 \u2192 <code>\u30c7\u30a3\u30e1\u30f3\u30b7\u30e7\u30f3\u306a\u3057\u306e\u30e1\u30c8\u30ea\u30af\u30b9<\/code>\u3092\u305f\u3069\u308a\u3001<code>ErrorCount<\/code>\u30e1\u30c8\u30ea\u30af\u30b9\u3092\u30c1\u30a7\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n<figure class=\"figure-image figure-image-fotolife\" title=\"\u30e1\u30c8\u30ea\u30af\u30b9\u753b\u9762\"><span itemscope=\"\" itemtype=\"http:\/\/schema.org\/Photograph\"><img decoding=\"async\" src=\"https:\/\/cdn-ak.f.st-hatena.com\/images\/fotolife\/s\/swx-kazuma-doi\/20251029\/20251029212057.png\" width=\"1200\" height=\"566\" loading=\"lazy\" title=\"\" class=\"hatena-fotolife\" itemprop=\"image\"\/><\/span><figcaption>\u30e1\u30c8\u30ea\u30af\u30b9\u753b\u9762<\/figcaption><\/figure>\n<p>\u300c\u30b0\u30e9\u30d5\u5316\u3057\u305f\u30e1\u30c8\u30ea\u30af\u30b9\u300d\u306b\u3066<code>\u7d71\u8a08<\/code>\u3084<code>\u671f\u9593<\/code>\u3092\u8abf\u6574\u3057\u30011\u5206\u6bce\u306e\u30ab\u30a6\u30f3\u30c8\u6570\u3092\u78ba\u8a8d\u3059\u308b\u3068\u3001\u60f3\u5b9a\u901a\u308a1\u5206\u9593\u306b1\u3064\u306e\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n<h3 id=\"SNS\u30c8\u30d4\u30c3\u30af\u306e\u4f5c\u6210\">SNS\u30c8\u30d4\u30c3\u30af\u306e\u4f5c\u6210<\/h3>\n<p>\u4eca\u56de\u306f\u30a2\u30e9\u30fc\u30e0\u901a\u77e5\u3092SNS\u3092\u7d4c\u7531\u3057\u305f\u30e1\u30fc\u30eb\u3067\u53d7\u3051\u53d6\u308a\u307e\u3059\u3002<br \/>\nSNS\u30c8\u30d4\u30c3\u30af\u3092\u4f5c\u6210\u3057\u3001\u4e8b\u524d\u306b\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u30b5\u30d6\u30b9\u30af\u30e9\u30a4\u30d6\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<p>CloudShell\u3092\u4f7f\u7528\u3057\u3066\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3001SNS\u30c8\u30d4\u30c3\u30af\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"code bash\" data-lang=\"bash\" data-unlink=\"\"># SNS\u30c8\u30d4\u30c3\u30af\u306e\u4f5c\u6210\n$ aws sns create-topic --name MyAppAlerts\n\n# \u51fa\u529b\u3055\u308c\u305fTopicArn\u3092\u30e1\u30e2\u3057\u3066\u304a\u304d\u307e\u3059\n# \u51fa\u529b\u4f8b\uff1a\n# {\n#     \"TopicArn\": \"arn:aws:sns:ap-northeast-1::MyAppAlerts\"\n# }\n\n# \u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u30b5\u30d6\u30b9\u30af\u30e9\u30a4\u30d6\n# \u6ce8\u610f\uff1a\u306e\u90e8\u5206\u306f\u3001\u4e0a\u8a18\u3067\u51fa\u529b\u3055\u308c\u305fTopicArn\u304b\u3089\u53d6\u5f97\u3059\u308b\u304b\u3001\n#       AWS\u30b3\u30f3\u30bd\u30fc\u30eb\u53f3\u4e0a\u306e\u30a2\u30ab\u30a6\u30f3\u30c8\u756a\u53f7\uff0812\u6841\u306e\u6570\u5b57\uff09\u306b\u7f6e\u304d\u63db\u3048\u3066\u304f\u3060\u3055\u3044\n#       <your-email>\u306f\u5b9f\u969b\u306e\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u306b\u7f6e\u304d\u63db\u3048\u3066\u304f\u3060\u3055\u3044\n$ aws sns subscribe \\\n  --topic-arn arn:aws:sns:ap-northeast-1::MyAppAlerts \\\n  --protocol email \\\n  --notification-endpoint <your-email\/><\/your-email><\/pre>\n<p>\u6307\u5b9a\u3057\u305f\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u306b\u78ba\u8a8d\u30e1\u30fc\u30eb\u304c\u5c4a\u304f\u306e\u3067\u3001\u30e1\u30fc\u30eb\u5185\u306e\u300cConfirm subscription\u300d\u30ea\u30f3\u30af\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u30b5\u30d6\u30b9\u30af\u30ea\u30d7\u30b7\u30e7\u30f3\u3092\u5b8c\u4e86\u3055\u305b\u307e\u3059\u3002<\/p>\n<h3 id=\"\u30a2\u30e9\u30fc\u30e0\u306e\u4f5c\u6210\">\u30a2\u30e9\u30fc\u30e0\u306e\u4f5c\u6210<\/h3>\n<p>\u30e1\u30c8\u30ea\u30af\u30b9\u30d5\u30a3\u30eb\u30bf\u30fc\u3068\u540c\u69d8\u306b\u3001CloudShell\u3092\u4f7f\u7528\u3057\u3066\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3001\u30a2\u30e9\u30fc\u30e0\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"code bash\" data-lang=\"bash\" data-unlink=\"\"># \u6ce8\u610f\uff1a--alarm-actions\u306e\u3092\u5b9f\u969b\u306e\u30a2\u30ab\u30a6\u30f3\u30c8ID\u306b\u7f6e\u304d\u63db\u3048\u3066\u304f\u3060\u3055\u3044\n$ aws cloudwatch put-metric-alarm \\\n --alarm-name MyAppErrorAlarm \\\n --metric-name ErrorCount \\\n --namespace MyApp \\\n --statistic Sum \\\n --period 60 \\\n --threshold 1 \\\n --comparison-operator GreaterThanThreshold \\\n --evaluation-periods 1 \\\n --alarm-actions arn:aws:sns:ap-northeast-1::MyAppAlerts \\\n --treat-missing-data notBreaching<\/pre>\n<div class=\"s_table\"><table>\n<thead>\n<tr>\n<th>\u30aa\u30d7\u30b7\u30e7\u30f3<\/th>\n<th style=\"text-align:left;\">\u610f\u5473 \/ \u7528\u9014<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>&#8211;alarm-name<\/td>\n<td style=\"text-align:left;\">\u30a2\u30e9\u30fc\u30e0\u306e\u4e00\u610f\u306a\u540d\u524d<\/td>\n<\/tr>\n<tr>\n<td>&#8211;metric-name<\/td>\n<td style=\"text-align:left;\">\u76e3\u8996\u5bfe\u8c61\u30e1\u30c8\u30ea\u30af\u30b9\u540d<\/td>\n<\/tr>\n<tr>\n<td>&#8211;namespace<\/td>\n<td style=\"text-align:left;\">\u30e1\u30c8\u30ea\u30af\u30b9\u540d\u524d\u7a7a\u9593<\/td>\n<\/tr>\n<tr>\n<td>&#8211;statistic<\/td>\n<td style=\"text-align:left;\">\u96c6\u8a08\u65b9\u6cd5<\/td>\n<\/tr>\n<tr>\n<td>&#8211;period<\/td>\n<td style=\"text-align:left;\">1\u30c7\u30fc\u30bf\u30dd\u30a4\u30f3\u30c8\u306e\u8a55\u4fa1\u671f\u9593(\u79d2)<\/td>\n<\/tr>\n<tr>\n<td>&#8211;threshold<\/td>\n<td style=\"text-align:left;\">\u30a2\u30e9\u30fc\u30e0\u306e\u3057\u304d\u3044\u5024<\/td>\n<\/tr>\n<tr>\n<td>&#8211;comparison-operator<\/td>\n<td style=\"text-align:left;\">\u6bd4\u8f03\u6f14\u7b97\u5b50<\/td>\n<\/tr>\n<tr>\n<td>&#8211;evaluation-periods<\/td>\n<td style=\"text-align:left;\">\u3057\u304d\u3044\u5024\u3092\u8d85\u3048\u305f\u3068\u898b\u306a\u3059\u9023\u7d9a\u3057\u305f\u8a55\u4fa1\u671f\u9593\u306e\u6570<\/td>\n<\/tr>\n<tr>\n<td>&#8211;alarm-actions<\/td>\n<td style=\"text-align:left;\">\u30a2\u30e9\u30fc\u30e0\u72b6\u614b\u306b\u306a\u3063\u305f\u3068\u304d\u306b\u5b9f\u884c\u3059\u308b\u30a2\u30af\u30b7\u30e7\u30f3\u306eARN<br \/>\u4eca\u56de\u306fSNS\u30c8\u30d4\u30c3\u30af\u3092\u6307\u5b9a\u3059\u308b\u4f8b<\/td>\n<\/tr>\n<tr>\n<td>&#8211;treat-missing-data<\/td>\n<td style=\"text-align:left;\">\u30c7\u30fc\u30bf\u304c\u6b20\u843d\u3057\u3066\u3044\u308b\u5834\u5408\u306e\u6271\u3044\u65b9<\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/div>\n<p>\u3053\u306eCLI\u30b3\u30de\u30f3\u30c9\u306f\u3001\u30e1\u30c8\u30ea\u30af\u30b9 <code>ErrorCount<\/code> \u306b\u57fa\u3065\u3044\u3066\u30a2\u30e9\u30fc\u30e0 <code>MyAppErrorAlarm<\/code> \u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<br \/>\nError\u30ab\u30a6\u30f3\u30c8\u3092\u8868\u3059\u30e1\u30c8\u30ea\u30af\u30b9\u304c1\u5206\u9593\u306b1\u56de\u4ee5\u4e0a\u767a\u751f\u3057\u305f\u5834\u5408\u306b\u30a2\u30e9\u30fc\u30e0\u72b6\u614b\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u30a2\u30e9\u30fc\u30e0\u304c\u4f5c\u6210\u3055\u308c\u305f\u3089\u3001CloudWatch \u30b3\u30f3\u30bd\u30fc\u30eb\u306e\u5de6\u30da\u30a4\u30f3\u304b\u3089\u300c\u30a2\u30e9\u30fc\u30e0\u300d\u2192\u300c\u30a2\u30e9\u30fc\u30e0\u300d\u3092\u9078\u629e\u3057\u3001\u4f5c\u6210\u3057\u305f\u30a2\u30e9\u30fc\u30e0 <code>MyAppErrorAlarm<\/code> \u304c\u8868\u793a\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<p>\u3057\u3070\u3089\u304f\u5f85\u3063\u3066\u3044\u308b\u3068\u3001\u30a2\u30e9\u30fc\u30e0\u304c\u300c\u30a2\u30e9\u30fc\u30e0\u72b6\u614b\u300d\u306b\u9077\u79fb\u3059\u308b\u3053\u3068\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<figure class=\"figure-image figure-image-fotolife\" title=\"\u30a2\u30e9\u30fc\u30e0\u8a73\u7d30\u753b\u9762\"><span itemscope=\"\" itemtype=\"http:\/\/schema.org\/Photograph\"><img decoding=\"async\" src=\"https:\/\/cdn-ak.f.st-hatena.com\/images\/fotolife\/s\/swx-kazuma-doi\/20251029\/20251029212937.png\" width=\"1200\" height=\"566\" loading=\"lazy\" title=\"\" class=\"hatena-fotolife\" itemprop=\"image\"\/><\/span><figcaption>\u30a2\u30e9\u30fc\u30e0\u8a73\u7d30\u753b\u9762<\/figcaption><\/figure>\n<p>SNS\u30c8\u30d4\u30c3\u30af\u306b\u30b5\u30d6\u30b9\u30af\u30e9\u30a4\u30d6\u3057\u3066\u3044\u308b\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u306b\u901a\u77e5\u304c\u5c4a\u3044\u3066\u3044\u308b\u3053\u3068\u3082\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"code\" data-lang=\"\" data-unlink=\"\">\u4ef6\u540d\uff1aALARM: \"MyAppErrorAlarm\" in Asia Pacific (Tokyo)<\/pre>\n<p>\u4ee5\u4e0a\u3067\u3001CloudWatch Logs\u306e\u30ed\u30b0\u304b\u3089\u30a8\u30e9\u30fc\u3092\u691c\u51fa\u3057\u3066\u3001\u30a2\u30e9\u30fc\u30e0\u3092\u767a\u884c\u3059\u308b\u76e3\u8996\u8a2d\u5b9a\u304c\u5b8c\u4e86\u3057\u307e\u3057\u305f\u3002<\/p>\n<h2 id=\"\u307e\u3068\u3081\">\u307e\u3068\u3081<\/h2>\n<p>\u672c\u30d6\u30ed\u30b0\u3067\u306f\u3001EC2\u4e0a\u306eDocker\u30b3\u30f3\u30c6\u30ca\u304b\u3089CloudWatch Logs\u3078\u306e\u30ed\u30b0\u51fa\u529b\u3068\u3001\u76e3\u8996\u306e\u305f\u3081\u306e\u30a8\u30e9\u30fc\u691c\u51fa\u624b\u6cd5\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u300cEC2\u4e0a\u306e\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb \u2192 CloudWatch Logs \u2192 \u30e1\u30c8\u30ea\u30af\u30b9 \u2192 \u30a2\u30e9\u30fc\u30e0\u300d\u3068\u3044\u3046\u6700\u77ed\u30e9\u30a4\u30f3\u3092\u62bc\u3055\u3048\u308b\u3053\u3068\u3067\u3001\u76e3\u8996\u306e\u571f\u53f0\u304c\u4e00\u6c17\u306b\u56fa\u307e\u308a\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u5358\u7d14\u306b\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u306b\u51fa\u529b\u3055\u308c\u305f\u6587\u5b57\u5217\u3092CloudWatch Logs\u306b\u9001\u4fe1\u3057\u3001\u5358\u7d14\u306a\u6587\u5b57\u5217\u30de\u30c3\u30c1\u3067\u30a8\u30e9\u30fc\u3092\u691c\u51fa\u3057\u307e\u3057\u305f\u304c\u3001CloudWatch \u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3084\u30e1\u30c8\u30ea\u30af\u30b9\u30d5\u30a3\u30eb\u30bf\u30fc\u306e\u30d1\u30bf\u30fc\u30f3\u3092\u5de5\u592b\u3059\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u9ad8\u5ea6\u306a\u76e3\u8996\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u306f\u3053\u306e\u6700\u5c0f\u69cb\u6210\u3092\u69cb\u7bc9\u3057\u3001\u305d\u3053\u304b\u3089\u6539\u5584\u30fb\u81ea\u52d5\u5316\u30fb\u30e1\u30c8\u30ea\u30af\u30b9\u62e1\u5f35\u3067&#8221;\u904b\u7528\u3057\u3066\u697d\u306a\u4ed5\u7d44\u307f&#8221;\u306b\u80b2\u3066\u3066\u3044\u304d\u307e\u3057\u3087\u3046\uff01<\/p>\n<div class=\"profile-cards-list\">\n<div class=\"profile-card-container\">\n<div class=\"sw-profile\">\n<div class=\"sw-profile__txt-wrap\">\n<p class=\"sw-profile__name\">\u5721\u4e95\u4e00\u78e8<a target=\"_blank\" href=\"https:\/\/blog.serverworks.co.jp\/archive\/author\/swx-kazuma-doi\">(\u57f7\u7b46\u8a18\u4e8b\u306e\u4e00\u89a7)<\/a><\/p>\n<p class=\"sw-profile__txt\">23\u5e74\u5ea6\u65b0\u5352\u5165\u793e\u3057\u307e\u3057\u305f\u3002\u6700\u8fd1\u306f\u81ea\u708a\u306b\u306f\u307e\u3063\u3066\u3044\u307e\u3059\u3002\u30a2\u30d1\u30fc\u30c8\u306e\u30ad\u30c3\u30c1\u30f3\u304c\u72ed\u304f\u3066\u56f0\u3063\u3066\u307e\u3059\u3002<\/p>\n<\/p><\/div>\n<\/div><\/div>\n<\/p><\/div>\n<\/div>\n<p><script>(function(d, s, id) {\n  var js, fjs = d.getElementsByTagName(s)[0];\n  if (d.getElementById(id)) return;\n  js = d.createElement(s); js.id = id;\n  js.src = \"\/\/connect.facebook.net\/ja_JP\/sdk.js#xfbml=1&version=v17.0\";\n  fjs.parentNode.insertBefore(js, fjs);\n}(document, 'script', 'facebook-jssdk'));<\/script><br \/>\n<br \/>\n<br \/><a href=\"https:\/\/blog.serverworks.co.jp\/monitoring-docker-on-ec2-minimum\">\u5143\u306e\u8a18\u4e8b\u3092\u78ba\u8a8d\u3059\u308b <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\u6982\u8981 \u3053\u306e\u30d6\u30ed\u30b0\u3067\u306f\u3001EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5185\u3067\u52d5\u4f5c\u3059\u308bDocker\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30ed\u30b0\u3092CloudWatch\u306b\u51fa\u529b\u3059\u308b\u65b9\u6cd5\u3092\u8aac\u660e\u3057\u307e\u3059\u3002 \u6700\u7d42\u7684\u306b\u4ee5\u4e0b\u306e\u69cb\u6210\u56f3\u306e\u3088\u3046\u306a\u69cb\u6210\u3092\u76ee\u6307\u3057\u307e\u3059\u3002 \u69cb\u6210\u56f3 \u524d\u63d0\u6761\u4ef6 VPC\u3068EC2\u30a4 [&hellip;]","protected":false},"author":1,"featured_media":22872,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-22871","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-company-tec"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Docker on EC2\u306e\u30ed\u30b0\u76e3\u8996\u3001CloudWatch\u3067\u59cb\u3081\u308b\u6700\u5c0f\u69cb\u6210\u3010\u521d\u5fc3\u8005\u5411\u3051\u30ac\u30a4\u30c9\u3011 - \u30b5\u30fc\u30d0\u30fc\u30ef\u30fc\u30af\u30b9\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0 - \u30dd\u30b1\u30b3\u30f3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.serverworks.co.jp\/monitoring-docker-on-ec2-minimum\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Docker on EC2\u306e\u30ed\u30b0\u76e3\u8996\u3001CloudWatch\u3067\u59cb\u3081\u308b\u6700\u5c0f\u69cb\u6210\u3010\u521d\u5fc3\u8005\u5411\u3051\u30ac\u30a4\u30c9\u3011 - \u30b5\u30fc\u30d0\u30fc\u30ef\u30fc\u30af\u30b9\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0 - \u30dd\u30b1\u30b3\u30f3\" \/>\n<meta property=\"og:description\" content=\"\u6982\u8981 \u3053\u306e\u30d6\u30ed\u30b0\u3067\u306f\u3001EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5185\u3067\u52d5\u4f5c\u3059\u308bDocker\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30ed\u30b0\u3092CloudWatch\u306b\u51fa\u529b\u3059\u308b\u65b9\u6cd5\u3092\u8aac\u660e\u3057\u307e\u3059\u3002 \u6700\u7d42\u7684\u306b\u4ee5\u4e0b\u306e\u69cb\u6210\u56f3\u306e\u3088\u3046\u306a\u69cb\u6210\u3092\u76ee\u6307\u3057\u307e\u3059\u3002 \u69cb\u6210\u56f3 \u524d\u63d0\u6761\u4ef6 VPC\u3068EC2\u30a4 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.serverworks.co.jp\/monitoring-docker-on-ec2-minimum\" \/>\n<meta property=\"og:site_name\" content=\"\u30dd\u30b1\u30b3\u30f3\" \/>\n<meta property=\"article:published_time\" content=\"2025-11-08T22:47:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/pokecon.jp\/job\/wp-content\/uploads\/2025\/11\/https3A2F2Fcdn-ak.f.st-hatena.com2Fimages2Ffotolife2Fs2Fswx-kazuma-doi2F202510152F202510151.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1300\" \/>\n\t<meta property=\"og:image:height\" content=\"774\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"info@pokecon.jp\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"info@pokecon.jp\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"3\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/blog.serverworks.co.jp\\\/monitoring-docker-on-ec2-minimum#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/pokecon.jp\\\/job\\\/22871\\\/\"},\"author\":{\"name\":\"info@pokecon.jp\",\"@id\":\"https:\\\/\\\/pokecon.jp\\\/job\\\/#\\\/schema\\\/person\\\/16c9f07b1ba984d165d9aee259bda997\"},\"headline\":\"Docker on EC2\u306e\u30ed\u30b0\u76e3\u8996\u3001CloudWatch\u3067\u59cb\u3081\u308b\u6700\u5c0f\u69cb\u6210\u3010\u521d\u5fc3\u8005\u5411\u3051\u30ac\u30a4\u30c9\u3011 &#8211; \u30b5\u30fc\u30d0\u30fc\u30ef\u30fc\u30af\u30b9\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0\",\"datePublished\":\"2025-11-08T22:47:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/pokecon.jp\\\/job\\\/22871\\\/\"},\"wordCount\":178,\"image\":{\"@id\":\"https:\\\/\\\/blog.serverworks.co.jp\\\/monitoring-docker-on-ec2-minimum#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/pokecon.jp\\\/job\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/https3A2F2Fcdn-ak.f.st-hatena.com2Fimages2Ffotolife2Fs2Fswx-kazuma-doi2F202510152F202510151.png\",\"articleSection\":[\"\u4f01\u696d\u30c6\u30c3\u30af\"],\"inLanguage\":\"ja\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/pokecon.jp\\\/job\\\/22871\\\/\",\"url\":\"https:\\\/\\\/blog.serverworks.co.jp\\\/monitoring-docker-on-ec2-minimum\",\"name\":\"Docker on EC2\u306e\u30ed\u30b0\u76e3\u8996\u3001CloudWatch\u3067\u59cb\u3081\u308b\u6700\u5c0f\u69cb\u6210\u3010\u521d\u5fc3\u8005\u5411\u3051\u30ac\u30a4\u30c9\u3011 - \u30b5\u30fc\u30d0\u30fc\u30ef\u30fc\u30af\u30b9\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0 - \u30dd\u30b1\u30b3\u30f3\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/pokecon.jp\\\/job\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/blog.serverworks.co.jp\\\/monitoring-docker-on-ec2-minimum#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/blog.serverworks.co.jp\\\/monitoring-docker-on-ec2-minimum#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/pokecon.jp\\\/job\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/https3A2F2Fcdn-ak.f.st-hatena.com2Fimages2Ffotolife2Fs2Fswx-kazuma-doi2F202510152F202510151.png\",\"datePublished\":\"2025-11-08T22:47:40+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/pokecon.jp\\\/job\\\/#\\\/schema\\\/person\\\/16c9f07b1ba984d165d9aee259bda997\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/blog.serverworks.co.jp\\\/monitoring-docker-on-ec2-minimum#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/blog.serverworks.co.jp\\\/monitoring-docker-on-ec2-minimum\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\\\/\\\/blog.serverworks.co.jp\\\/monitoring-docker-on-ec2-minimum#primaryimage\",\"url\":\"https:\\\/\\\/pokecon.jp\\\/job\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/https3A2F2Fcdn-ak.f.st-hatena.com2Fimages2Ffotolife2Fs2Fswx-kazuma-doi2F202510152F202510151.png\",\"contentUrl\":\"https:\\\/\\\/pokecon.jp\\\/job\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/https3A2F2Fcdn-ak.f.st-hatena.com2Fimages2Ffotolife2Fs2Fswx-kazuma-doi2F202510152F202510151.png\",\"width\":1300,\"height\":774},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/blog.serverworks.co.jp\\\/monitoring-docker-on-ec2-minimum#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u30db\u30fc\u30e0\",\"item\":\"https:\\\/\\\/pokecon.jp\\\/job\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Docker on EC2\u306e\u30ed\u30b0\u76e3\u8996\u3001CloudWatch\u3067\u59cb\u3081\u308b\u6700\u5c0f\u69cb\u6210\u3010\u521d\u5fc3\u8005\u5411\u3051\u30ac\u30a4\u30c9\u3011 &#8211; \u30b5\u30fc\u30d0\u30fc\u30ef\u30fc\u30af\u30b9\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/pokecon.jp\\\/job\\\/#website\",\"url\":\"https:\\\/\\\/pokecon.jp\\\/job\\\/\",\"name\":\"\u30dd\u30b1\u30b3\u30f3\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/pokecon.jp\\\/job\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ja\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/pokecon.jp\\\/job\\\/#\\\/schema\\\/person\\\/16c9f07b1ba984d165d9aee259bda997\",\"name\":\"info@pokecon.jp\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2b0549cd9f7907c092ca5fbb283baf72337f235726e4b46fa39ec0b701ac2fe2?s=96&d=wavatar&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2b0549cd9f7907c092ca5fbb283baf72337f235726e4b46fa39ec0b701ac2fe2?s=96&d=wavatar&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2b0549cd9f7907c092ca5fbb283baf72337f235726e4b46fa39ec0b701ac2fe2?s=96&d=wavatar&r=g\",\"caption\":\"info@pokecon.jp\"},\"url\":\"https:\\\/\\\/pokecon.jp\\\/job\\\/author\\\/infopokecon-jp\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Docker on EC2\u306e\u30ed\u30b0\u76e3\u8996\u3001CloudWatch\u3067\u59cb\u3081\u308b\u6700\u5c0f\u69cb\u6210\u3010\u521d\u5fc3\u8005\u5411\u3051\u30ac\u30a4\u30c9\u3011 - \u30b5\u30fc\u30d0\u30fc\u30ef\u30fc\u30af\u30b9\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0 - \u30dd\u30b1\u30b3\u30f3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.serverworks.co.jp\/monitoring-docker-on-ec2-minimum","og_locale":"ja_JP","og_type":"article","og_title":"Docker on EC2\u306e\u30ed\u30b0\u76e3\u8996\u3001CloudWatch\u3067\u59cb\u3081\u308b\u6700\u5c0f\u69cb\u6210\u3010\u521d\u5fc3\u8005\u5411\u3051\u30ac\u30a4\u30c9\u3011 - \u30b5\u30fc\u30d0\u30fc\u30ef\u30fc\u30af\u30b9\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0 - \u30dd\u30b1\u30b3\u30f3","og_description":"\u6982\u8981 \u3053\u306e\u30d6\u30ed\u30b0\u3067\u306f\u3001EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5185\u3067\u52d5\u4f5c\u3059\u308bDocker\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30ed\u30b0\u3092CloudWatch\u306b\u51fa\u529b\u3059\u308b\u65b9\u6cd5\u3092\u8aac\u660e\u3057\u307e\u3059\u3002 \u6700\u7d42\u7684\u306b\u4ee5\u4e0b\u306e\u69cb\u6210\u56f3\u306e\u3088\u3046\u306a\u69cb\u6210\u3092\u76ee\u6307\u3057\u307e\u3059\u3002 \u69cb\u6210\u56f3 \u524d\u63d0\u6761\u4ef6 VPC\u3068EC2\u30a4 [&hellip;]","og_url":"https:\/\/blog.serverworks.co.jp\/monitoring-docker-on-ec2-minimum","og_site_name":"\u30dd\u30b1\u30b3\u30f3","article_published_time":"2025-11-08T22:47:40+00:00","og_image":[{"width":1300,"height":774,"url":"https:\/\/pokecon.jp\/job\/wp-content\/uploads\/2025\/11\/https3A2F2Fcdn-ak.f.st-hatena.com2Fimages2Ffotolife2Fs2Fswx-kazuma-doi2F202510152F202510151.png","type":"image\/png"}],"author":"info@pokecon.jp","twitter_card":"summary_large_image","twitter_misc":{"\u57f7\u7b46\u8005":"info@pokecon.jp","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"3\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.serverworks.co.jp\/monitoring-docker-on-ec2-minimum#article","isPartOf":{"@id":"https:\/\/pokecon.jp\/job\/22871\/"},"author":{"name":"info@pokecon.jp","@id":"https:\/\/pokecon.jp\/job\/#\/schema\/person\/16c9f07b1ba984d165d9aee259bda997"},"headline":"Docker on EC2\u306e\u30ed\u30b0\u76e3\u8996\u3001CloudWatch\u3067\u59cb\u3081\u308b\u6700\u5c0f\u69cb\u6210\u3010\u521d\u5fc3\u8005\u5411\u3051\u30ac\u30a4\u30c9\u3011 &#8211; \u30b5\u30fc\u30d0\u30fc\u30ef\u30fc\u30af\u30b9\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0","datePublished":"2025-11-08T22:47:40+00:00","mainEntityOfPage":{"@id":"https:\/\/pokecon.jp\/job\/22871\/"},"wordCount":178,"image":{"@id":"https:\/\/blog.serverworks.co.jp\/monitoring-docker-on-ec2-minimum#primaryimage"},"thumbnailUrl":"https:\/\/pokecon.jp\/job\/wp-content\/uploads\/2025\/11\/https3A2F2Fcdn-ak.f.st-hatena.com2Fimages2Ffotolife2Fs2Fswx-kazuma-doi2F202510152F202510151.png","articleSection":["\u4f01\u696d\u30c6\u30c3\u30af"],"inLanguage":"ja"},{"@type":"WebPage","@id":"https:\/\/pokecon.jp\/job\/22871\/","url":"https:\/\/blog.serverworks.co.jp\/monitoring-docker-on-ec2-minimum","name":"Docker on EC2\u306e\u30ed\u30b0\u76e3\u8996\u3001CloudWatch\u3067\u59cb\u3081\u308b\u6700\u5c0f\u69cb\u6210\u3010\u521d\u5fc3\u8005\u5411\u3051\u30ac\u30a4\u30c9\u3011 - \u30b5\u30fc\u30d0\u30fc\u30ef\u30fc\u30af\u30b9\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0 - \u30dd\u30b1\u30b3\u30f3","isPartOf":{"@id":"https:\/\/pokecon.jp\/job\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blog.serverworks.co.jp\/monitoring-docker-on-ec2-minimum#primaryimage"},"image":{"@id":"https:\/\/blog.serverworks.co.jp\/monitoring-docker-on-ec2-minimum#primaryimage"},"thumbnailUrl":"https:\/\/pokecon.jp\/job\/wp-content\/uploads\/2025\/11\/https3A2F2Fcdn-ak.f.st-hatena.com2Fimages2Ffotolife2Fs2Fswx-kazuma-doi2F202510152F202510151.png","datePublished":"2025-11-08T22:47:40+00:00","author":{"@id":"https:\/\/pokecon.jp\/job\/#\/schema\/person\/16c9f07b1ba984d165d9aee259bda997"},"breadcrumb":{"@id":"https:\/\/blog.serverworks.co.jp\/monitoring-docker-on-ec2-minimum#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.serverworks.co.jp\/monitoring-docker-on-ec2-minimum"]}]},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/blog.serverworks.co.jp\/monitoring-docker-on-ec2-minimum#primaryimage","url":"https:\/\/pokecon.jp\/job\/wp-content\/uploads\/2025\/11\/https3A2F2Fcdn-ak.f.st-hatena.com2Fimages2Ffotolife2Fs2Fswx-kazuma-doi2F202510152F202510151.png","contentUrl":"https:\/\/pokecon.jp\/job\/wp-content\/uploads\/2025\/11\/https3A2F2Fcdn-ak.f.st-hatena.com2Fimages2Ffotolife2Fs2Fswx-kazuma-doi2F202510152F202510151.png","width":1300,"height":774},{"@type":"BreadcrumbList","@id":"https:\/\/blog.serverworks.co.jp\/monitoring-docker-on-ec2-minimum#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u30db\u30fc\u30e0","item":"https:\/\/pokecon.jp\/job\/"},{"@type":"ListItem","position":2,"name":"Docker on EC2\u306e\u30ed\u30b0\u76e3\u8996\u3001CloudWatch\u3067\u59cb\u3081\u308b\u6700\u5c0f\u69cb\u6210\u3010\u521d\u5fc3\u8005\u5411\u3051\u30ac\u30a4\u30c9\u3011 &#8211; \u30b5\u30fc\u30d0\u30fc\u30ef\u30fc\u30af\u30b9\u30a8\u30f3\u30b8\u30cb\u30a2\u30d6\u30ed\u30b0"}]},{"@type":"WebSite","@id":"https:\/\/pokecon.jp\/job\/#website","url":"https:\/\/pokecon.jp\/job\/","name":"\u30dd\u30b1\u30b3\u30f3","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/pokecon.jp\/job\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ja"},{"@type":"Person","@id":"https:\/\/pokecon.jp\/job\/#\/schema\/person\/16c9f07b1ba984d165d9aee259bda997","name":"info@pokecon.jp","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/secure.gravatar.com\/avatar\/2b0549cd9f7907c092ca5fbb283baf72337f235726e4b46fa39ec0b701ac2fe2?s=96&d=wavatar&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/2b0549cd9f7907c092ca5fbb283baf72337f235726e4b46fa39ec0b701ac2fe2?s=96&d=wavatar&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2b0549cd9f7907c092ca5fbb283baf72337f235726e4b46fa39ec0b701ac2fe2?s=96&d=wavatar&r=g","caption":"info@pokecon.jp"},"url":"https:\/\/pokecon.jp\/job\/author\/infopokecon-jp\/"}]}},"_links":{"self":[{"href":"https:\/\/pokecon.jp\/job\/wp-json\/wp\/v2\/posts\/22871","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pokecon.jp\/job\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pokecon.jp\/job\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pokecon.jp\/job\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pokecon.jp\/job\/wp-json\/wp\/v2\/comments?post=22871"}],"version-history":[{"count":1,"href":"https:\/\/pokecon.jp\/job\/wp-json\/wp\/v2\/posts\/22871\/revisions"}],"predecessor-version":[{"id":22873,"href":"https:\/\/pokecon.jp\/job\/wp-json\/wp\/v2\/posts\/22871\/revisions\/22873"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pokecon.jp\/job\/wp-json\/wp\/v2\/media\/22872"}],"wp:attachment":[{"href":"https:\/\/pokecon.jp\/job\/wp-json\/wp\/v2\/media?parent=22871"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pokecon.jp\/job\/wp-json\/wp\/v2\/categories?post=22871"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pokecon.jp\/job\/wp-json\/wp\/v2\/tags?post=22871"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}