{"id":519,"date":"2019-01-30T11:40:58","date_gmt":"2019-01-30T02:40:58","guid":{"rendered":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2019\/01\/30\/aws-batch-terraform"},"modified":"2019-01-30T11:40:58","modified_gmt":"2019-01-30T02:40:58","slug":"aws-batch-terraform","status":"publish","type":"post","link":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2019\/01\/30\/aws-batch-terraform\/","title":{"rendered":"AWS Batch\u3092Terraform\u3067\u3064\u304f\u308b"},"content":{"rendered":"

AWS Batch\u4f7f\u3046\u3053\u3068\u3067\u30d0\u30c3\u30c1\u51e6\u306e\u74b0\u5883\u3092\u7c21\u5358\u306b\u3064\u304f\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4eca\u56de\u306f\u3001Terraform\u3092\u4f7f\u3044\u306a\u304c\u3089AWS Batch\u306e\u57fa\u672c\u7684\u306a\u74b0\u5883\u3092\u4f5c\u3063\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n

\u7528\u8a9e<\/h2>\n

AWS Batch\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306b\u306f\u4e0b\u8a18\u306e3\u3064\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n\n\n\n\n\n
\u540d\u524d<\/th>\n\u76ee\u7684<\/th>\n<\/tr>\n<\/thead>\n
\u30b8\u30e7\u30d6<\/td>\nAWS Batch\u306e\u4f5c\u696d\u5358\u4f4d\u3002<\/td>\n<\/tr>\n
\u30b8\u30e7\u30d6\u30ad\u30e5\u30fc<\/td>\n\u30b8\u30e7\u30d6\u3092\u767b\u9332\u3059\u308b\u30ad\u30e5\u30fc\u3002\u30b3\u30f3\u30d4\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0\u74b0\u5883\u3092\u7d10\u4ed8\u3051\u308b\u3002<\/td>\n<\/tr>\n
\u30b8\u30e7\u30d6\u5b9a\u7fa9<\/td>\n\u4f7f\u7528\u3059\u308bDocker\u30a4\u30e1\u30fc\u30b8\u3001\u30b3\u30de\u30f3\u30c9\u3092\u5b9a\u7fa9\u3067\u304d\u308b\u3002<\/td>\n<\/tr>\n
\u30b3\u30f3\u30d4\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0\u74b0\u5883<\/td>\n\u30b8\u30e7\u30d6\u306e\u5b9f\u884c\u74b0\u5883\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u305d\u308c\u305e\u308c\u8a73\u3057\u304f\u898b\u3066\u3086\u304d\u307e\u3059\u3002<\/p>\n

\u30b8\u30e7\u30d6\u5b9a\u7fa9<\/h2>\n

\u307e\u305a\u306f\u30b8\u30e7\u30d6\u5b9a\u7fa9\u3092\u3064\u304f\u3063\u3066\u3044\u304d\u307e\u3059\u3002Terraform\u306e\u30b3\u30fc\u30c9\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n

resource "aws_batch_job_definition" "default" {\n    name = "${var.name}"\n    type = "container"\n    container_properties = <<CONTAINER_PROPERTIES\n{\n    "command": ["ls", "-la"],\n    "image": "busybox",\n    "memory": 1024,\n    "vcpus": 1,\n    "volumes": [\n      {\n        "host": {\n          "sourcePath": "\/tmp"\n        },\n        "name": "tmp"\n      }\n    ],\n    "environment": [\n        {"name": "VARNAME", "value": "VARVAL"}\n    ],\n    "mountPoints": [\n        {\n          "sourceVolume": "tmp",\n          "containerPath": "\/tmp",\n          "readOnly": false\n        }\n    ],\n    "ulimits": [\n      {\n        "hardLimit": 1024,\n        "name": "nofile",\n        "softLimit": 1024\n      }\n    ]\n}\nCONTAINER_PROPERTIES\n}<\/code><\/pre>\n

container_properties<\/code>\u3067\u30b3\u30f3\u30c6\u30ca\u306e\u8a2d\u5b9a\u304c\u3067\u304d\u3066\u3001\u3053\u3061\u3089<\/a>\u306b\u3042\u308b\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u5b9a\u7fa9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4eca\u56de\u306f\u30b5\u30f3\u30d7\u30eb\u306a\u306e\u3067image<\/code>\u3092busybox<\/code>\u3068\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u5b9f\u969b\u306f\u3001ECS\u306b\u767b\u9332\u3057\u305f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306eDocker\u30a4\u30e1\u30fc\u30b8\u306a\u3069\u3092\u6307\u5b9a\u3001command<\/code>\u3067\u5b9f\u884c\u30b3\u30de\u30f3\u30c9\u3092\u6307\u5b9a\u3067\u304d\u307e\u3059\u3002<\/p>\n