{"id":306834,"date":"2020-07-13T09:00:41","date_gmt":"2020-07-13T09:00:41","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=306834"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=306834","title":{"rendered":"\u041f\u0440\u0438\u043c\u0435\u0440 event-driven \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0432\u0435\u0431\u0445\u0443\u043a\u043e\u0432 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u043c S3-\u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 Mail.ru Cloud Solutions"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/mailru\/blog\/510110\/\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ic\/ep\/ws\/icepws8nxu5gflwyanygq9qcaue.jpeg\"><\/div>\n<p>  <a href=\"https:\/\/www.behance.net\/gallery\/18175033\/Rube-Goldberg-coffee-machine-\"><i>Rube Goldberg coffee machine<\/i><\/a><\/p>\n<p>  Event-driven architecture \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442 \u0446\u0435\u043d\u043e\u0432\u0443\u044e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u0438 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u0438 \u043d\u0443\u0436\u043d\u044b. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u0430\u0441\u0441\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432, \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 worker-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0418 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043d\u0435 \u043f\u0440\u043e FaaS, \u0430 \u043f\u0440\u043e \u0432\u0435\u0431\u0445\u0443\u043a\u0438. \u042f \u043f\u043e\u043a\u0430\u0436\u0443 \u0443\u0447\u0435\u0431\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0435\u0431\u0445\u0443\u043a\u043e\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u041f\u0430\u0440\u0430 \u0441\u043b\u043e\u0432 \u043e\u0431 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0438 \u043e \u0432\u0435\u0431\u0445\u0443\u043a\u0430\u0445. \u041e\u0431\u044a\u0435\u043a\u0442\u043d\u044b\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043e\u0431\u043b\u0430\u043a\u0435 \u0432 \u0432\u0438\u0434\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u043f\u043e S3 \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u043c\u0443 API (\u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438) \u0447\u0435\u0440\u0435\u0437 HTTP\/HTTPS. \u0412\u0435\u0431\u0445\u0443\u043a\u0438 (webhooks) \u0432 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u2014 \u044d\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u043f\u043e HTTP. \u041e\u0431\u044b\u0447\u043d\u043e \u043e\u043d\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0435\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u043e\u0439 \u043a\u043e\u0434\u0430 \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0438\u043b\u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u043c, \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u043c\u044b\u043c \u0432 \u0431\u043b\u043e\u0433\u0435. \u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435, \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0441\u0430\u0439\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 URL-\u0430\u0434\u0440\u0435\u0441, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u0432\u0435\u0431\u0445\u0443\u043a\u0430. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0441\u0430\u0439\u0442\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u043b\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u043c (<a href=\"https:\/\/ru.wikipedia.org\/wiki\/Webhook\">wiki<\/a>). \u0412 \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u0441\u0430\u0439\u0442\u043e\u043c \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435, \u0432 \u0440\u043e\u043b\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u044e\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043a\u0435\u0439\u0441\u043e\u0432, \u043a\u043e\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044e:<\/p>\n<ol>\n<li>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043e\u043f\u0438\u0439 \u0432\u0441\u0435\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u043e\u0431\u043b\u0430\u0447\u043d\u043e\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435. \u041a\u043e\u043f\u0438\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u00ab\u043d\u0430 \u043b\u0435\u0442\u0443\u00bb, \u043f\u0440\u0438 \u043b\u044e\u0431\u043e\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0438\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0444\u0430\u0439\u043b\u043e\u0432.<\/li>\n<li>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0435\u0440\u0438\u0439 \u043c\u0438\u043d\u0438\u0430\u0442\u044e\u0440 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u043e\u0434\u044f\u043d\u044b\u0445 \u0437\u043d\u0430\u043a\u043e\u0432 \u043a \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044f\u043c, \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439.<\/li>\n<li>\u041e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u0435 \u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0435 \u043d\u043e\u0432\u044b\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (\u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0430\u044f \u0431\u0443\u0445\u0433\u0430\u043b\u0442\u0435\u0440\u0441\u043a\u0430\u044f \u0441\u043b\u0443\u0436\u0431\u0430 \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u0432 \u043e\u0431\u043b\u0430\u043a\u043e \u043e\u0442\u0447\u0435\u0442\u044b, \u0430 \u0444\u0438\u043d\u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u043e \u043d\u043e\u0432\u044b\u0445 \u043e\u0442\u0447\u0435\u0442\u0430\u0445, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0438\u0445).<\/li>\n<li>\u0427\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043a\u0435\u0439\u0441\u044b \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u044e\u0442, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a Kubernetes, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043f\u043e\u0434 \u0441 \u043d\u0443\u0436\u043d\u044b\u043c\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u043c\u0438, \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0432 \u043d\u0435\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u0430\u0434\u0430\u0447\u0438 \u0438 \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440.<\/li>\n<\/ol>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0437\u0430\u0434\u0430\u0447\u0438 1, \u043a\u043e\u0433\u0434\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0431\u0430\u043a\u0435\u0442\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 Mail.ru Cloud Solutions (MCS) \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0435\u0431\u0445\u0443\u043a\u043e\u0432 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 AWS. \u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043d\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u043c \u043a\u0435\u0439\u0441\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u0437\u0430 \u0441\u0447\u0435\u0442 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0432\u0435\u0431\u0445\u0443\u043a\u043e\u0432 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438, \u043d\u043e \u0434\u043b\u044f \u0443\u0447\u0435\u0431\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0431\u0435\u0437 \u044d\u0442\u043e\u0433\u043e.<\/p>\n<h3>\u0421\u0445\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b<\/h3>\n<p>  \u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d \u0432 <a href=\"https:\/\/mcs.mail.ru\/help\/storage-api\/webhooks-s3\">\u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u043f\u043e S3-\u0432\u0435\u0431\u0445\u0443\u043a\u0430\u043c \u043d\u0430 MCS<\/a>. \u0412 \u0441\u0445\u0435\u043c\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0435\u0441\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b:<\/p>\n<ul>\n<li><strong>\u0421\u0435\u0440\u0432\u0438\u0441 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 S3-\u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0438 \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u0442 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043f\u0440\u0438 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0438 webnhook.<\/li>\n<li><strong>\u0421\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u0438\u0435\u043c\u0430 \u0432\u0435\u0431\u0445\u0443\u043a\u043e\u0432<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043b\u0443\u0448\u0430\u0435\u0442 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e HTTP \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f. \u0421\u0435\u0440\u0432\u0435\u0440 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u044f\u0437\u044b\u043a\u0435, \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430 Go.<\/li>\n<\/ul>\n<p>  \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0435\u0431\u0445\u0443\u043a\u043e\u0432 \u0432 S3 API \u2014 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043f\u0440\u0438\u0435\u043c\u0430 \u0432\u0435\u0431\u0445\u0443\u043a\u043e\u0432 \u043d\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u0438\u0435\u043c\u0430 \u0432\u0435\u0431\u0445\u0443\u043a\u043e\u0432 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443 \u043d\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 (\u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u0445 \u0432\u0435\u0431\u0445\u0443\u043a\u043e\u0432 \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f). <\/p>\n<p>  \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u0438\u0435\u043c\u0430 \u0432\u0435\u0431\u0445\u0443\u043a\u043e\u0432 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0434\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438:<\/p>\n<ul>\n<li>\u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438,<\/li>\n<li>\u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f.<\/li>\n<\/ul>\n<p>  <\/p>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043f\u0440\u0438\u0435\u043c\u0430 \u0432\u0435\u0431\u0445\u0443\u043a\u043e\u0432<\/h3>\n<p>  \u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043f\u0440\u0438\u0435\u043c\u0430 \u0432\u0435\u0431\u0445\u0443\u043a\u043e\u0432 \u043d\u0443\u0436\u0435\u043d Linux-\u0441\u0435\u0440\u0432\u0435\u0440. \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0430\u043d\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u0435\u043c \u043d\u0430 MCS.<\/p>\n<p>  \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u041f\u041e \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u0438\u0435\u043c\u0430 \u0432\u0435\u0431\u0445\u0443\u043a\u043e\u0432.<\/p>\n<pre><code class=\"bash\">ubuntu@ubuntu-basic-1-2-10gb:~$ sudo apt-get install git Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required:   bc dns-root-data dnsmasq-base ebtables landscape-common liblxc-common  liblxc1 libuv1 lxcfs lxd lxd-client python3-attr python3-automat  python3-click python3-constantly python3-hyperlink   python3-incremental python3-pam python3-pyasn1-modules  python3-service-identity python3-twisted python3-twisted-bin  python3-zope.interface uidmap xdelta3 Use 'sudo apt autoremove' to remove them. Suggested packages:   git-daemon-run | git-daemon-sysvinit git-doc git-el git-email git-gui  gitk gitweb git-cvs git-mediawiki git-svn The following NEW packages will be installed:   git 0 upgraded, 1 newly installed, 0 to remove and 46 not upgraded. Need to get 3915 kB of archives. After this operation, 32.3 MB of additional disk space will be used. Get:1 http:\/\/MS1.clouds.archive.ubuntu.com\/ubuntu bionic-updates\/main  amd64 git amd64 1:2.17.1-1ubuntu0.7 [3915 kB] Fetched 3915 kB in 1s (5639 kB\/s) Selecting previously unselected package git. (Reading database ... 53932 files and directories currently installed.) Preparing to unpack ...\/git_1%3a2.17.1-1ubuntu0.7_amd64.deb ... Unpacking git (1:2.17.1-1ubuntu0.7) ... Setting up git (1:2.17.1-1ubuntu0.7) ...<\/code><\/pre>\n<p>  \u041a\u043b\u043e\u043d\u0438\u0440\u0443\u0435\u043c \u043f\u0430\u043f\u043a\u0443 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u043f\u0440\u0438\u0435\u043c\u0430 \u0432\u0435\u0431\u0445\u0443\u043a\u043e\u0432:<\/p>\n<pre><code class=\"bash\">ubuntu@ubuntu-basic-1-2-10gb:~$ git clone https:\/\/github.com\/RomanenkoDenys\/s3-webhook.git Cloning into 's3-webhook'... remote: Enumerating objects: 48, done. remote: Counting objects: 100% (48\/48), done. remote: Compressing objects: 100% (27\/27), done. remote: Total 114 (delta 20), reused 45 (delta 18), pack-reused 66 Receiving objects: 100% (114\/114), 23.77 MiB | 20.25 MiB\/s, done. Resolving deltas: 100% (49\/49), done.<\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0441\u0435\u0440\u0432\u0435\u0440:<\/p>\n<pre><code class=\"bash\">ubuntu@ubuntu-basic-1-2-10gb:~$ cd s3-webhook\/ ubuntu@ubuntu-basic-1-2-10gb:~\/s3-webhook$ sudo .\/s3-webhook -port 80<\/code><\/pre>\n<p>  <\/p>\n<h3>\u041f\u043e\u0434\u043f\u0438\u0441\u043a\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438<\/h3>\n<p>  \u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u0438\u0435\u043c\u0430 \u0432\u0435\u0431\u0445\u0443\u043a\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0447\u0435\u0440\u0435\u0437 API \u043b\u0438\u0431\u043e web-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 web-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441:<\/p>\n<ol>\n<li><a href=\"https:\/\/mcs.mail.ru\/app\/%20services\/storage\/buckets\/\">\u0418\u0434\u0435\u043c \u0432 \u0440\u0430\u0437\u0434\u0435\u043b \u0431\u0430\u043a\u0435\u0442\u043e\u0432<\/a> \u0432 \u043a\u0430\u0431\u0438\u043d\u0435\u0442\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/li>\n<li>\u0417\u0430\u0445\u043e\u0434\u0438\u043c \u0432 \u0431\u0430\u043a\u0435\u0442, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c w\u0435bhooks, \u0438 \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043d\u0430 \u0448\u0435\u0441\u0442\u0435\u0440\u0435\u043d\u043a\u0443:<\/li>\n<\/ol>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/sj\/1j\/8m\/sj1j8mzuqswuhgv0dv5kprojevg.png\"><\/p>\n<p>  \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u0432\u043a\u043b\u0430\u0434\u043a\u0443 Webhooks \u0438 \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/qq\/pt\/hm\/qqpthmqqeeojuuwvkszkib_ffsy.png\"><br \/>  \u0417\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043f\u043e\u043b\u044f:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/qm\/u6\/ds\/qmu6ds0lsxthfj_rdzw8gbpv92w.png\"><\/p>\n<p>  ID \u2014 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u0435\u0431\u0445\u0443\u043a\u0430.<\/p>\n<p>  Event \u2014 \u043a\u0430\u043a\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c. \u041c\u044b \u0437\u0430\u0434\u0430\u043b\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0432\u0441\u0435\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0442 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 (\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435).<\/p>\n<p>  URL \u2014 \u0430\u0434\u0440\u0435\u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043f\u0440\u0438\u0435\u043c\u0430 \u0432\u0435\u0431\u0445\u0443\u043a\u043e\u0432.<\/p>\n<p>  Filter prefix\/suffix \u2014 \u0444\u0438\u043b\u044c\u0442\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u0431\u0445\u0443\u043a\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0442\u043e\u0431\u044b \u0432\u0435\u0431\u0445\u0443\u043a \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0430\u0439\u043b\u044b \u0441 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435\u043c .png, \u0432 <strong>Filter suffix<\/strong> \u043d\u0430\u0434\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u00abpng\u00bb.<\/p>\n<p>  \u0412 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u043f\u0440\u0438\u0435\u043c\u0430 \u0432\u0435\u0431\u0445\u0443\u043a\u043e\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0440\u0442\u044b 80 \u0438 443.<\/p>\n<p>  \u041d\u0430\u0436\u043c\u0435\u043c <strong>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c hook<\/strong> \u0438 \u0443\u0432\u0438\u0434\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/tw\/km\/z_\/twkmz_ayftzwl738dyfclla3n1q.png\"><br \/>  Hook \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d. <\/p>\n<p>  \u0421\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u0438\u0435\u043c\u0430 \u0432\u0435\u0431\u0445\u0443\u043a\u043e\u0432 \u0432 \u043b\u043e\u0433\u0430\u0445 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0445\u0443\u043a\u0430:<\/p>\n<pre><code class=\"bash\">ubuntu@ubuntu-basic-1-2-10gb:~\/s3-webhook$ sudo .\/s3-webhook -port 80 2020\/06\/15 12:01:14 [POST] incoming HTTP request from  95.163.216.92:42530 2020\/06\/15 12:01:14 Got timestamp: 2020-06-15T15:01:13+03:00 TopicArn:  mcs5259999770|myfiles-ash|s3:ObjectCreated:*,s3:ObjectRemoved:* Token:  E2itMqAMUVVZc51pUhFWSp13DoxezvRxkUh5P7LEuk1dEe9y URL:  http:\/\/89.208.199.220\/webhook 2020\/06\/15 12:01:14 Generate responce signature:  3754ce36636f80dfd606c5254d64ecb2fd8d555c27962b70b4f759f32c76b66d<\/code><\/pre>\n<p>  \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d\u0430. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043f\u0440\u0438\u0435\u043c\u0430 \u0432\u0435\u0431\u0445\u0443\u043a\u043e\u0432.<\/p>\n<h3>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043f\u0440\u0438\u0435\u043c\u0430 \u0432\u0435\u0431\u0445\u0443\u043a\u043e\u0432<\/h3>\n<p>  \u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 Go. \u0420\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<pre><code class=\"go\">package main  \/\/ Generate hmac_sha256_hex func HmacSha256hex(message string, secret string) string { }  \/\/ Generate hmac_sha256 func HmacSha256(message string, secret string) string { }  \/\/ Send subscription confirmation func SubscriptionConfirmation(w http.ResponseWriter, req *http.Request, body []byte) { }  \/\/ Send subscription confirmation func GotRecords(w http.ResponseWriter, req *http.Request, body []byte) { }  \/\/ Liveness probe func Ping(w http.ResponseWriter, req *http.Request) {     \/\/ log request     log.Printf(&quot;[%s] incoming HTTP Ping request from %s\\n&quot;, req.Method, req.RemoteAddr)     fmt.Fprintf(w, &quot;Pong\\n&quot;) }  \/\/Webhook func Webhook(w http.ResponseWriter, req *http.Request) { }  func main() {      \/\/ get command line args     bindPort := flag.Int(&quot;port&quot;, 80, &quot;number between 1-65535&quot;)     bindAddr := flag.String(&quot;address&quot;, &quot;&quot;, &quot;ip address in dot format&quot;)     flag.StringVar(&amp;actionScript, &quot;script&quot;, &quot;&quot;, &quot;external script to execute&quot;)     flag.Parse()      http.HandleFunc(&quot;\/ping&quot;, Ping)     http.HandleFunc(&quot;\/webhook&quot;, Webhook)  log.Fatal(http.ListenAndServe(*bindAddr+&quot;:&quot;+strconv.Itoa(*bindPort), nil)) }<\/code><\/pre>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<ul>\n<li>Ping() \u2014 \u0440\u043e\u0443\u0442, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u043f\u043e URL\/ping, \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f liveness probe.<\/li>\n<li>Webhook() \u2014 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0440\u043e\u0443\u0442, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a URL\/\u0432\u0435\u0431\u0445\u0443\u043a\u0430:<br \/> \n<ul>\n<li>\u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u043d\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 (\u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e SubscriptionConfirmation),<\/li>\n<li>\u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0432\u0435\u0431\u0445\u0443\u043a\u0438 (\u0444\u0443\u043d\u043a\u0446\u0438\u044f Gotrecords).<\/li>\n<\/ul>\n<\/li>\n<li>\u0424\u0443\u043d\u043a\u0446\u0438\u0438 HmacSha256 \u0438 HmacSha256hex \u2014 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f HMAC-SHA256 \u0438 HMAC-SHA256 \u0441 \u0432\u044b\u0432\u043e\u0434\u043e\u043c \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 16-\u0440\u0438\u0447\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0434\u043b\u044f \u043f\u043e\u0434\u0441\u0442\u0447\u0435\u0442\u0430 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b.<\/li>\n<li>main \u2014 \u0433\u043b\u0430\u0432\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 URL.<\/li>\n<\/ul>\n<p>  \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c\u044b\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c:<\/p>\n<ul>\n<li>-port \u2014 \u043f\u043e\u0440\u0442, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0443\u0448\u0430\u0442\u044c.<\/li>\n<li>-address \u2014 IP-\u0430\u0434\u0440\u0435\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0443\u0448\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440.<\/li>\n<li>-script \u2014 \u0432\u043d\u0435\u0448\u043d\u044f\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u0440\u0438\u0448\u0435\u0434\u0448\u0438\u0439 \u0445\u0443\u043a.<\/li>\n<\/ul>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<pre><code class=\"go\">\/\/Webhook func Webhook(w http.ResponseWriter, req *http.Request) {      \/\/ Read body     body, err := ioutil.ReadAll(req.Body)     defer req.Body.Close()     if err != nil {         http.Error(w, err.Error(), 500)         return     }      \/\/ log request     log.Printf(&quot;[%s] incoming HTTP request from %s\\n&quot;, req.Method, req.RemoteAddr)     \/\/ check if we got subscription confirmation request     if strings.Contains(string(body),  &quot;\\&quot;Type\\&quot;:\\&quot;SubscriptionConfirmation\\&quot;&quot;) {         SubscriptionConfirmation(w, req, body)     } else {         GotRecords(w, req, body)     }  }<\/code><\/pre>\n<p>  \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u0447\u0442\u043e \u043f\u0440\u0438\u0448\u043b\u043e \u2014 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043b\u0438\u0431\u043e \u0432\u0435\u0431\u0445\u0443\u043a. \u041a\u0430\u043a \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437 <a href=\"https:\/\/mcs.mail.ru\/help\/storage-api\/webhooks-s3\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 Json \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 Post:<\/p>\n<pre><code class=\"html\">POST http:\/\/test.com HTTP\/1.1 x-amz-sns-messages-type: SubscriptionConfirmation content-type: application\/json  {     &quot;Timestamp&quot;:&quot;2019-12-26T19:29:12+03:00&quot;,     &quot;Type&quot;:&quot;SubscriptionConfirmation&quot;,     &quot;Message&quot;:&quot;You have chosen to subscribe to the topic $topic. To confirm the subscription you need to response with calculated signature&quot;,     &quot;TopicArn&quot;:&quot;mcs2883541269|bucketA|s3:ObjectCreated:Put&quot;,     &quot;SignatureVersion&quot;:1,     &quot;Token&quot;:\u00abRPE5UuG94rGgBH6kHXN9FUPugFxj1hs2aUQc99btJp3E49tA\u00bb }<\/code><\/pre>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c:<\/p>\n<pre><code class=\"html\">content-type: application\/json  {&quot;signature&quot;:\u00abea3fce4bb15c6de4fec365d36bcebbc34ccddf54616d5ca12e1972f82b6d37af\u00bb}<\/code><\/pre>\n<p>  \u0413\u0434\u0435 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a:<\/p>\n<pre><code class=\"html\">signature = hmac_sha256(url, hmac_sha256(TopicArn,  hmac_sha256(Timestamp, Token)))<\/code><\/pre>\n<p>  <a name=\"postreq\"><\/a>\u0415\u0441\u043b\u0438 \u0436\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0432\u0435\u0431\u0445\u0443\u043a, \u0442\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 Post-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"html\">POST &lt;url&gt; HTTP\/1.1 x-amz-sns-messages-type: SubscriptionConfirmation  { &quot;Records&quot;:     [         {             &quot;s3&quot;: {                 &quot;object&quot;: {                     &quot;eTag&quot;:&quot;aed563ecafb4bcc5654c597a421547b2&quot;,                     &quot;sequencer&quot;:1577453615,                     &quot;key&quot;:&quot;some-file-to-bucket&quot;,                     &quot;size&quot;:100                 },             &quot;configurationId&quot;:&quot;1&quot;,             &quot;bucket&quot;: {                 &quot;name&quot;: &quot;bucketA&quot;,                 &quot;ownerIdentity&quot;: {                     &quot;principalId&quot;:&quot;mcs2883541269&quot;}                 },                 &quot;s3SchemaVersion&quot;:&quot;1.0&quot;             },             &quot;eventVersion&quot;:&quot;1.0&quot;,             &quot;requestParameters&quot;:{                 &quot;sourceIPAddress&quot;:&quot;185.6.245.156&quot;             },             &quot;userIdentity&quot;: {                 &quot;principalId&quot;:&quot;2407013e-cbc1-415f-9102-16fb9bd6946b&quot;             },             &quot;eventName&quot;:&quot;s3:ObjectCreated:Put&quot;,             &quot;awsRegion&quot;:&quot;ru-msk&quot;,             &quot;eventSource&quot;:&quot;aws:s3&quot;,             &quot;responseElements&quot;: {                 &quot;x-amz-request-id&quot;:&quot;VGJR5rtJ&quot;             }         }     ] }<\/code><\/pre>\n<p>  \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435. \u042f \u0432\u044b\u0431\u0440\u0430\u043b \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0437\u0430\u043f\u0438\u0441\u044c <code>&quot;Type&quot;:&quot;SubscriptionConfirmation&quot;<\/code>, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d\u0430 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043d\u0430 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438 \u0438 \u043d\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u0432\u0435\u0431\u0445\u0443\u043a\u0435. \u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u043d\u0430\u043b\u0438\u0447\u0438\u044f\/\u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 POST-\u0437\u0430\u043f\u0440\u043e\u0441\u0435, \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442 \u043b\u0438\u0431\u043e \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>SubscriptionConfirmation<\/code>, \u043b\u0438\u0431\u043e \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>GotRecords<\/code>.<\/p>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044e SubscriptionConfirmation \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u043c, \u043e\u043d\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u043f\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430\u043c, \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c \u0432 <a href=\"https:\/\/mcs.mail.ru\/help\/storage-api\/webhooks-s3\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>. \u0418\u0437\u0443\u0447\u0438\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0432 <a href=\"https:\/\/github.com\/RomanenkoDenys\/s3-webhook\/blob\/ac403f77d0f7d4a94e18c459fe8f3c92ee342ae4\/s3-webhook.go#L36\">git-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/a>.<\/p>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f GotRecords \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u0442 \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 Record \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 (\u0438\u043c\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u044b\u043b\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043e \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 -script) \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438:<\/p>\n<ul>\n<li>\u0438\u043c\u044f \u0431\u0430\u043a\u0435\u0442\u0430<\/li>\n<li>\u043a\u043b\u044e\u0447 \u043e\u0431\u044a\u0435\u043a\u0442\u0430<\/li>\n<li>\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435:<br \/> \n<ul>\n<li>copy \u2014 \u0435\u0441\u043b\u0438 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435 EventName = ObjectCreated | PutObject | PutObjectCopy<\/li>\n<li>delete \u2014 \u0435\u0441\u043b\u0438 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435 EventName = ObjectRemoved | DeleteObject<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u043b\u0435\u0442\u0435\u043b \u0445\u0443\u043a c Post-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c, \u043a\u0430\u043a \u043e\u043f\u0438\u0441\u0430\u043d\u043e <a href=\"#postreq\">\u0432\u044b\u0448\u0435<\/a>, \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 -script=script.sh \u0442\u043e \u0441\u043a\u0440\u0438\u043f\u0442 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"html\">script.sh  bucketA some-file-to-bucket copy<\/code><\/pre>\n<p>  \u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u0438\u0435\u043c\u0430 \u0432\u0435\u0431\u0445\u0443\u043a\u043e\u0432 \u2014 \u044d\u0442\u043e \u043d\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d\u043d\u043e\u0435 production-\u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0430 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<h3>\u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u044b<\/h3>\n<p>  \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044e \u0444\u0430\u0439\u043b\u043e\u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0431\u0430\u043a\u0435\u0442\u0430 \u0432 MCS \u0432 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u044b\u0439 \u0431\u0430\u043a\u0435\u0442 \u0432 AWS. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0431\u0430\u043a\u0435\u0442 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f myfiles-ash, \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u044b\u0439 \u2014 myfiles-backup (\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0431\u0430\u043a\u0435\u0442\u0430 \u0432 AWS \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438). \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u0444\u0430\u0439\u043b \u043a\u043b\u0430\u0434\u0435\u0442\u0441\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0431\u0430\u043a\u0435\u0442, \u0435\u0433\u043e \u043a\u043e\u043f\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u0432 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u043c, \u043a\u043e\u0433\u0434\u0430 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u2014 \u0443\u0434\u0430\u043b\u044f\u0442\u044c\u0441\u044f \u0432 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u043c.<\/p>\n<p>  \u0420\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0431\u0430\u043a\u0435\u0442\u0430\u043c\u0438 \u0431\u0443\u0434\u0435\u043c \u0443\u0442\u0438\u043b\u0438\u0442\u043e\u0439 awscli, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e \u043a\u0430\u043a \u043e\u0431\u043b\u0430\u0447\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 MCS, \u0442\u0430\u043a \u0438 \u043e\u0431\u043b\u0430\u0447\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 AWS.<\/p>\n<pre><code class=\"bash\">ubuntu@ubuntu-basic-1-2-10gb:~$ sudo apt-get install awscli Reading package lists... Done Building dependency tree Reading state information... Done After this operation, 34.4 MB of additional disk space will be used. Unpacking awscli (1.14.44-1ubuntu1) ... Setting up awscli (1.14.44-1ubuntu1) ...<\/code><\/pre>\n<p>  \u0421\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u043a API S3 MCS:<\/p>\n<pre><code class=\"bash\">ubuntu@ubuntu-basic-1-2-10gb:~$ aws configure --profile mcs AWS Access Key ID [None]: hdywEPtuuJTExxxxxxxxxxxxxx AWS Secret Access Key [None]: hDz3SgxKwXoxxxxxxxxxxxxxxxxxx Default region name [None]: Default output format [None]:<\/code><\/pre>\n<p>  \u0421\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u043a API S3 AWS:<\/p>\n<pre><code class=\"bash\">ubuntu@ubuntu-basic-1-2-10gb:~$ aws configure --profile aws AWS Access Key ID [None]: AKIAJXXXXXXXXXXXX AWS Secret Access Key [None]: dfuerphOLQwu0CreP5Z8l5fuXXXXXXXXXXXXXXXX Default region name [None]: Default output format [None]:<\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u044b:<\/p>\n<p>  \u041a AWS:<\/p>\n<pre><code class=\"bash\">ubuntu@ubuntu-basic-1-2-10gb:~$ aws s3 ls --profile aws 2020-07-06 08:44:11 myfiles-backup<\/code><\/pre>\n<p>  \u0414\u043b\u044f MCS, \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0430\u0434\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c &#8212;endpoint-url:<\/p>\n<pre><code class=\"bash\">ubuntu@ubuntu-basic-1-2-10gb:~$ aws s3 ls --profile mcs --endpoint-url  https:\/\/hb.bizmrg.com 2020-02-04 06:38:05 databasebackups-0cdaaa6402d4424e9676c75a720afa85 2020-05-27 10:08:33 myfiles-ash<\/code><\/pre>\n<p>  \u0414\u043e\u0441\u0442\u0443\u043f \u043f\u043e\u043b\u0443\u0447\u0435\u043d.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0445\u0443\u043a\u0430, \u043d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0433\u043e s3_backup_mcs_aws.sh<\/p>\n<pre><code class=\"bash\">#!\/bin\/bash # Require aws cli # if file added \u2014 copy it to backup bucket # if file removed \u2014 remove it from backup bucket # Variables ENDPOINT_MCS=&quot;https:\/\/hb.bizmrg.com&quot; AWSCLI_MCS=`which aws`&quot; --endpoint-url ${ENDPOINT_MCS} --profile mcs s3&quot; AWSCLI_AWS=`which aws`&quot; --profile aws s3&quot; BACKUP_BUCKET=&quot;myfiles-backup&quot;  SOURCE_BUCKET=&quot;${1}&quot; SOURCE_FILE=&quot;${2}&quot; ACTION=&quot;${3}&quot;  SOURCE=&quot;s3:\/\/${SOURCE_BUCKET}\/${SOURCE_FILE}&quot; TARGET=&quot;s3:\/\/${BACKUP_BUCKET}\/${SOURCE_FILE}&quot; TEMP=&quot;\/tmp\/${SOURCE_BUCKET}\/${SOURCE_FILE}&quot;  case ${ACTION} in     &quot;copy&quot;)     ${AWSCLI_MCS} cp &quot;${SOURCE}&quot; &quot;${TEMP}&quot;     ${AWSCLI_AWS} cp &quot;${TEMP}&quot; &quot;${TARGET}&quot;     rm ${TEMP}     ;;      &quot;delete&quot;)     ${AWSCLI_AWS} rm ${TARGET}     ;;      *)     echo &quot;Usage: ${0} sourcebucket sourcefile copy\/delete&quot;     exit 1     ;; esac<\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440:<\/p>\n<pre><code class=\"bash\">ubuntu@ubuntu-basic-1-2-10gb:~\/s3-webhook$ sudo .\/s3-webhook -port 80 - script scripts\/s3_backup_mcs_aws.sh<\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0427\u0435\u0440\u0435\u0437 <a href=\"https:\/\/mcs.mail.ru\/app\/services\/storage\/buckets\/\">\u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 MCS<\/a> \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0444\u0430\u0439\u043b test.txt \u0432 \u0431\u0430\u043a\u0435\u0442 myfiles-ash. \u0412 \u043b\u043e\u0433\u0430\u0445 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0431\u044b\u043b \u0441\u0434\u0435\u043b\u0430\u043d \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0432\u0435\u0431\u0445\u0443\u043a\u043e\u0432:<\/p>\n<pre><code class=\"bash\">2020\/07\/06 09:43:08 [POST] incoming HTTP request from  95.163.216.92:56612 download: s3:\/\/myfiles-ash\/test.txt to ..\/..\/..\/tmp\/myfiles-ash\/test.txt upload: ..\/..\/..\/tmp\/myfiles-ash\/test.txt to  s3:\/\/myfiles-backup\/test.txt<\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0431\u0430\u043a\u0435\u0442\u0430 myfiles-backup \u0432 AWS:<\/p>\n<pre><code class=\"bash\">ubuntu@ubuntu-basic-1-2-10gb:~\/s3-webhook$ aws s3 --profile aws ls  myfiles-backup 2020-07-06 09:43:10       1104 test.txt<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0447\u0435\u0440\u0435\u0437 \u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0443\u0434\u0430\u043b\u0438\u043c \u0444\u0430\u0439\u043b \u0438\u0437 \u0431\u0430\u043a\u0435\u0442\u0430 myfiles-ash.<\/p>\n<p>  \u041b\u043e\u0433\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430:<\/p>\n<pre><code class=\"bash\">2020\/07\/06 09:44:46 [POST] incoming HTTP request from  95.163.216.92:58224 delete: s3:\/\/myfiles-backup\/test.txt<\/code><\/pre>\n<p>  \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0431\u0430\u043a\u0435\u0442\u0430:<\/p>\n<pre><code class=\"bash\">ubuntu@ubuntu-basic-1-2-10gb:~\/s3-webhook$ aws s3 --profile aws ls  myfiles-backup ubuntu@ubuntu-basic-1-2-10gb:~$<\/code><\/pre>\n<p>  \u0424\u0430\u0439\u043b \u0443\u0434\u0430\u043b\u0435\u043d, \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0448\u0435\u043d\u0430.<\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438 ToDo<\/h3>\n<p>  \u0412\u0435\u0441\u044c \u043a\u043e\u0434, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u043b\u0435\u0436\u0438\u0442 <a href=\"https:\/\/github.com\/RomanenkoDenys\/s3-webhook\">\u0432 \u043c\u043e\u0435\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/a>. \u0422\u0430\u043c \u0436\u0435 \u043b\u0435\u0436\u0430\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0430 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440 \u0434\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0432\u0435\u0431\u0445\u0443\u043a\u043e\u0432. <\/p>\n<p>  \u0414\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u2014 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c S3-\u0432\u0435\u0431\u0445\u0443\u043a\u0438 \u0432 \u0441\u0432\u043e\u0435\u0439 \u0434\u0435\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041a\u0430\u043a \u044f \u0441\u043a\u0430\u0437\u0430\u043b \u0432 \u043d\u0430\u0447\u0430\u043b\u0435, \u0435\u0441\u043b\u0438 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u043a\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0432 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0438\u0432\u0435, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u043e\u0434 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443: \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0432\u0435\u0431\u0445\u0443\u043a\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 (RabbitMQ \u0438\u043b\u0438 NATS), \u0430 \u043e\u0442\u0442\u0443\u0434\u0430 \u0438\u0445 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c worker-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438. \u0418\u043d\u0430\u0447\u0435 \u043f\u0440\u0438 \u043c\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0435 \u0432\u0435\u0431\u0445\u0443\u043a\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u0441 \u043d\u0435\u0445\u0432\u0430\u0442\u043a\u043e\u0439 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447. \u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u0436\u0435 \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u043d\u043e\u0441\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440 \u0438 workers, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0440\u0435\u0448\u0430\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0441 \u043f\u043e\u0432\u0442\u043e\u0440\u043e\u043c \u0437\u0430\u0434\u0430\u0447 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0431\u043e\u0435\u0432. \u0422\u0430\u043a \u0436\u0435 \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u0435\u043d\u044f\u0442\u044c \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0435 \u0438 \u0431\u043e\u043b\u0435\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435.<\/p>\n<p>  \u0423\u0441\u043f\u0435\u0445\u043e\u0432!<\/p>\n<p>  \u0415\u0449\u0435 \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e \u0442\u0435\u043c\u0435:<\/p>\n<ul>\n<li><a href=\"https:\/\/habr.com\/ru\/company\/mailru\/blog\/507470\/\">\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u044b\u043c S3-\u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435\u043c Mail.ru Cloud Solutions \u043a\u0430\u043a \u0441 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439.<\/a><\/li>\n<li><a href=\"https:\/\/vc.ru\/services\/134157-kak-ispolzuyut-obektnoe-hranilishche-chtoby-obygrat-konkurentov\">\u041a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u044b\u0433\u0440\u0430\u0442\u044c \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043e\u0432.<\/a><\/li>\n<\/ul>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/mailru\/blog\/510110\/\"> https:\/\/habr.com\/ru\/company\/mailru\/blog\/510110\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/mailru\/blog\/510110\/\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ic\/ep\/ws\/icepws8nxu5gflwyanygq9qcaue.jpeg\"><\/div>\n<p>  <a href=\"https:\/\/www.behance.net\/gallery\/18175033\/Rube-Goldberg-coffee-machine-\"><i>Rube Goldberg coffee machine<\/i><\/a><\/p>\n<p>  Event-driven architecture \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442 \u0446\u0435\u043d\u043e\u0432\u0443\u044e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u0438 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u0438 \u043d\u0443\u0436\u043d\u044b. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u0430\u0441\u0441\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432, \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 worker-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0418 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043d\u0435 \u043f\u0440\u043e FaaS, \u0430 \u043f\u0440\u043e \u0432\u0435\u0431\u0445\u0443\u043a\u0438. \u042f \u043f\u043e\u043a\u0430\u0436\u0443 \u0443\u0447\u0435\u0431\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0435\u0431\u0445\u0443\u043a\u043e\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-306834","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/306834","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=306834"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/306834\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=306834"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=306834"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=306834"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}