{"id":397,"date":"2017-08-31T15:37:26","date_gmt":"2017-08-31T06:37:26","guid":{"rendered":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2017\/08\/31\/easily_build_an_asynchronous_job_system_on_aws_batch"},"modified":"2017-08-31T15:37:26","modified_gmt":"2017-08-31T06:37:26","slug":"easily_build_an_asynchronous_job_system_on_aws_batch","status":"publish","type":"post","link":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2017\/08\/31\/easily_build_an_asynchronous_job_system_on_aws_batch\/","title":{"rendered":"AWS Batch\u3067\u975e\u540c\u671f\u30b8\u30e7\u30d6\u30b7\u30b9\u30c6\u30e0\u304c\u7c21\u5358\u306b\u69cb\u7bc9\u51fa\u6765\u305f\u8a71"},"content":{"rendered":"
\u524d\u7530\u3067\u3059\u3002
\n\u53d7\u8a17\u958b\u767a\u3067API\u3092Golang\u3067\u958b\u767a\u4e2d\u3067\u3059\u304c\u3001\u6a5f\u80fd\u8981\u4ef6\u306e\u4e2d\u3067\u6642\u9593\u304c\u304b\u304b\u308b\u51e6\u7406\u3092\u3055\u3070\u304f\u5fc5\u8981\u304c\u3042\u308a\u3001\u975e\u540c\u671f\u51e6\u7406\u3092\u3069\u3046\u5b9f\u88c5\u3057\u3088\u3046\u304b\u691c\u8a0e\u3057\u305f\u7d50\u679c\u3001AWS Batch\u3092\u4f7f\u3063\u3066\u5b9f\u88c5\u3057\u3088\u3046\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n
AWS\u306e\u30de\u30cd\u30fc\u30b8\u30c9\u30b5\u30fc\u30d3\u30b9\u3067\u975e\u540c\u671f\u30bf\u30b9\u30af\u3068\u3057\u3066\u5b9f\u884c\u51fa\u6765\u308b\u306e\u306f\u3001\u305f\u3068\u3048\u3070AWS Lambda\u306a\u3069\u304c\u3042\u308a\u307e\u3059\u304cAWS Lambda\u3068\u7570\u306a\u308b\u70b9\u306f\u3001\u300c5\u5206\u4ee5\u5185\u3068\u3044\u3046\u5236\u9650\u304c\u306a\u3044\u300d\u300cDocker\u30a4\u30e1\u30fc\u30b8\u3067\u5b9f\u884c\u3055\u305b\u308b\u306e\u3067\u5236\u9650\u304c\u5c11\u306a\u3044\u300d\u3068\u3044\u3046\u30e1\u30ea\u30c3\u30c8\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n
\u4eca\u56de\u306f\u7279\u306b\u300c\u51e6\u7406\u6642\u9593\u304c\u9577\u304f\u306a\u308b\u5834\u5408\u304c\u308a\u3001\u78ba\u5b9f\u306b\u51e6\u7406\u3092\u7d42\u4e86\u3055\u305b\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u300d\u3068\u3044\u3046\u8981\u4ef6\u304c\u3042\u308a\u3001AWS Batch\u30b5\u30fc\u30d3\u30b9\u304c\u3074\u3063\u305f\u308a\u3060\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n
\u5b9f\u969b\u306bAWS Batch\u3092\u69cb\u7bc9\u3057\u305f\u969b\u3001\u521d\u3081\u3066\u306e\u69cb\u7bc9\u3068\u3044\u3046\u3053\u3068\u3082\u3042\u308a\u30cf\u30de\u3063\u305f\u7b87\u6240\u3082\u3042\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u666e\u901a\u3067\u3042\u308c\u3070\u30b8\u30e7\u30d6\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u7acb\u3066\u3066\u3001\u306a\u3069\u8272\u3005\u691c\u8a0e\u3057\u306a\u3051\u308c\u3070\u3044\u3051\u306a\u3044\u3053\u3068\u304c\u5927\u5e45\u306b\u524a\u6e1b\u51fa\u6765\u305f\u306e\u3067\u30c8\u30fc\u30bf\u30eb\u306e\u30b3\u30b9\u30c8\u3068\u3057\u3066\u306f\u305d\u308c\u307b\u3069\u304b\u304b\u3089\u306a\u304b\u3063\u305f\u306e\u3067\u306f\u306a\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n
\u53d7\u8a17\u30b7\u30b9\u30c6\u30e0\u3067\u958b\u767a\u3057\u305f\u8a2d\u8a08\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u611f\u3058\u3067\u3057\u305f\u304cAWS Batch\u3092\u4f7f\u3048\u3070\u7c21\u5358\u306b\u69cb\u7bc9\u3067\u304d\u307e\u3059\u3002<\/p>\n
<\/p>\n
\u4eca\u56de\u306f\u30ed\u30fc\u30ab\u30eb\u306eawscli\u304b\u3089AWS Batch\u3092\u30ad\u30c3\u30af\u3057\u3066\u30b8\u30e7\u30d6\u3092\u52d5\u304b\u3059\u3068\u3053\u308d\u307e\u3067\u5fa9\u7fd2\u3092\u8fbc\u3081\u3066\u3084\u308a\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n
AWS Batch\u306e\u69cb\u6210\u8981\u7d20\u306b\u306f\u4e0b\u8a18\u306e3\u3064\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n
\u540d\u524d<\/th>\n | \u76ee\u7684<\/th>\n<\/tr>\n<\/thead>\n |
---|---|
Job queues<\/td>\n | \u30b8\u30e7\u30d6\u30ad\u30e5\u30fc\u3002\u3053\u3053\u306b\u30b5\u30d6\u30df\u30c3\u30c8\u3059\u308b\u3002<\/td>\n<\/tr>\n |
Job definitions<\/td>\n | \u3069\u3093\u306a\u30b8\u30e7\u30d6\u304b\u306e\u5b9a\u7fa9\u5834\u6240\u3002\u3069\u3093\u306aDocker\u30a4\u30e1\u30fc\u30b8\u3092\u4f7f\u3046\u304b\u3001\u3082\u5b9a\u7fa9\u3059\u308b\u3002<\/td>\n<\/tr>\n |
Compute environments<\/td>\n | \u30b8\u30e7\u30d6\u3092\u52d5\u304b\u3059ECS(EC2)\u3092\u5b9a\u7fa9\u3059\u308b\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n \u9806\u756a\u7684\u306b\u306fCompute environments\u304bJob definition\u3092\u5148\u306b\u4f5c\u308a\u3001\u6700\u5f8c\u306bJob queue\u3092\u4f5c\u308b\u306e\u304c\u3044\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n \u3067\u306f\u4f5c\u6210\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n AWS Batch\u30b3\u30f3\u30bd\u30fc\u30eb\u3092\u958b\u304d\u3001\u300cGet started\u300d\u3092\u62bc\u3057\u307e\u3059\u3002<\/p>\n <\/p>\n Define job\u306e\u753b\u9762\u306b\u306a\u308a\u307e\u3059\u304c\u3001wizard\u3092\u4f7f\u308f\u306a\u3044\u3067\u4eca\u56de\u306f\u500b\u5225\u306b\u4f5c\u3063\u3066\u3044\u304d\u307e\u3059\u3002 <\/p>\n Compute environments\u304b\u3089\u4f5c\u3063\u3066\u3044\u304d\u307e\u3059\u3002 <\/p>\n \u300cService role\u300d\u306fAWS Batch\u306b\u5272\u308a\u5f53\u3066\u308b\u30ed\u30fc\u30eb\u3067\u3001\u300cInstance role\u300d\u306fAWS Batch\u3067\u8d77\u52d5\u3055\u305b\u308bEC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306b\u5272\u308a\u5f53\u3066\u308b\u30ed\u30fc\u30eb\u3067\u3059\u3002 \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30bf\u30a4\u30d7\u3092\u9078\u629e\u3057\u307e\u3059\u304c\u3001\u4eca\u56de\u306fm3.medium(vCPU 1)\u3092\u9078\u629e\u3057\u307e\u3057\u305f\u3002 \u666e\u6bb5\u306fJob\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u8d77\u52d5\u3057\u306a\u3044\u306e\u3067\u3042\u308c\u3070\u3001Minimum vCPUs\u306f0\u306b\u3057\u3066\u304a\u304d\u307e\u3059\u3002 \u6ce8\u610f\u70b9\u3068\u3057\u3066\u306f\u3001\u3053\u3053\u3067\u9078\u629e\u3059\u308bSubnet(EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u7f6e\u304b\u308c\u308b)\u306f\u3001\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u306b\u30a2\u30af\u30bb\u30b9\u51fa\u6765\u308bSubnet\u3067\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002 \u30d5\u30a9\u30fc\u30e0\u57cb\u3081\u304c\u7d42\u308f\u3063\u305f\u3089\u6700\u5f8c\u306b\u300cCreate\u300d\u3092\u62bc\u3057\u3066\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n <\/p>\n <\/p>\n \u6b21\u306bJob definition\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002 ECR\u306b\u30a4\u30e1\u30fc\u30b8\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u3066\u304a\u3044\u3066\u3001Container image\u306b \u3042\u3068\u306f\u7a7a\u767d\u3067Create\u3057\u307e\u3059\u3002<\/p>\n <\/p>\n \u6700\u5f8c\u306bJob queue\u3067\u3059\u3002 Compute environments\u306b\u5148\u307b\u3069\u4f5c\u6210\u3057\u305ftest-compute-environment\u3092\u9078\u629e\u3057\u3066Create\u3057\u307e\u3059\u3002<\/p>\n <\/p>\n \u4ee5\u4e0a\u3067AWS Batch\u3067\u30b8\u30e7\u30d6\u3092\u52d5\u304b\u3059\u74b0\u5883\u304c\u6574\u3044\u307e\u3057\u305f\u3002<\/p>\n awscli\u304b\u3089\u30b8\u30e7\u30d6\u3092\u30ad\u30e5\u30fc\u30a4\u30f3\u30b0\u3057\u3066\u307f\u307e\u3059\u3002 \u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u30b8\u30e7\u30d6\u3092\u30b5\u30d6\u30df\u30c3\u30c8\u3057\u307e\u3059\u3002 \u5b9f\u884c\u7d50\u679c\u306fCloudWatch Logs\u306b\u9001\u3089\u308c\u307e\u3059\u3002 <\/p>\n \u4ee5\u4e0a\u3067AWS Batch\u3067\u975e\u540c\u671f\u30b8\u30e7\u30d6\u3092\u5b9f\u884c\u3059\u308b\u74b0\u5883\u304c\u69cb\u7bc9\u51fa\u6765\u307e\u3057\u305f\u3002 \u524d\u7530\u3067\u3059\u3002 \u53d7\u8a17\u958b\u767a\u3067API\u3092Golang\u3067\u958b\u767a\u4e2d\u3067\u3059\u304c\u3001\u6a5f\u80fd\u8981\u4ef6\u306e\u4e2d\u3067\u6642\u9593\u304c\u304b\u304b\u308b\u51e6\u7406\u3092\u3055\u3070\u304f\u5fc5\u8981\u304c\u3042\u308a\u3001\u975e\u540c\u671f\u51e6\u7406\u3092\u3069\u3046\u5b9f\u88c5\u3057\u3088\u3046\u304b\u691c\u8a0e\u3057\u305f\u7d50\u679c\u3001AWS Batch\u3092\u4f7f\u3063\u3066\u5b9f\u88c5\u3057\u3088\u3046\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3057\u305f\u3002 AWS\u306e\u30de\u30cd\u30fc\u30b8\u30c9\u30b5\u30fc\u30d3\u30b9\u3067\u975e\u540c\u671f\u30bf\u30b9\u30af\u3068\u3057\u3066\u5b9f\u884c\u51fa\u6765\u308b\u306e\u306f\u3001\u305f\u3068\u3048\u3070AWS Lambda\u306a\u3069\u304c\u3042\u308a\u307e\u3059\u304cAWS Lambda\u3068\u7570\u306a\u308b\u70b9\u306f\u3001\u300c5\u5206\u4ee5\u5185\u3068\u3044\u3046\u5236\u9650\u304c\u306a\u3044\u300d\u300cDocker\u30a4\u30e1\u30fc […]<\/p>\n","protected":false},"author":1,"featured_media":826,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[13,18],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/397"}],"collection":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/comments?post=397"}],"version-history":[{"count":0,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/397\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media\/826"}],"wp:attachment":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media?parent=397"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/categories?post=397"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/tags?post=397"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}} |