{"id":282792,"date":"2016-12-20T21:05:06","date_gmt":"2016-12-20T18:05:06","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=282792"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=282792","title":{"rendered":"\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0441\u0432\u043e\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 AWS S3 \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u043a\u043e\u0434\u043e\u043c"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/07c\/31a\/d04\/07c31ad042d243de830f1bf77e8c079e.jpg\"\/><\/p>\n<p>  Amazon S3 (Simple Storage Service, \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430) \u2014 \u043e\u0447\u0435\u043d\u044c \u043c\u043e\u0449\u043d\u044b\u0439 \u043e\u043d\u043b\u0430\u0439\u043d \u0441\u0435\u0440\u0432\u0438\u0441 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0433\u043e Amazon Web Services. \u0414\u0443\u043c\u0430\u0439\u0442\u0435 \u043e \u043d\u0435\u043c, \u043a\u0430\u043a \u043e\u0431 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u043c \u0434\u0438\u0441\u043a\u0435, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f\u0445, \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0438 \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0438\u0445. \u041a\u043e\u043c\u043f\u0430\u043d\u0438\u0438, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a DropBox, Netflix, Pinterest, Slideshare, Tumblr \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0435, \u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043d\u0435\u0433\u043e.<\/p>\n<p>  \u0425\u043e\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441 \u0438 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439, \u0435\u0433\u043e \u043a\u043e\u0434 \u043d\u0435 \u043e\u0442\u043a\u0440\u044b\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0434\u043e\u0432\u0435\u0440\u044f\u0442\u044c Amazon \u0441\u0432\u043e\u0438 \u0434\u0430\u043d\u043d\u044b\u0435, \u0438 \u0445\u043e\u0442\u044c \u043e\u043d\u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e\u043c\u0443 \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0443 \u043d\u0430 \u0433\u043e\u0434, \u0432\u044b \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u0432\u0435\u0441\u0442\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043a\u0440\u0435\u0434\u0438\u0442\u043d\u043e\u0439 \u043a\u0430\u0440\u0442\u0435 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430. \u0422.\u043a. S3 \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u043d\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u043d\u0436\u0435\u043d\u0435\u0440-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442, \u044f \u0445\u043e\u0447\u0443, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0438 \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u044b \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u043b\u0438 \u043e\u043f\u044b\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0438\u043c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0435\u0433\u043e \u0432 \u0441\u0432\u043e\u0438\u0445 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445, \u0438 \u0435\u0449\u0435 \u044f \u043d\u0435 \u0445\u043e\u0447\u0443, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u0437\u0430 \u044d\u0442\u043e \u043f\u043b\u0430\u0442\u0438\u043b\u0438. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u044b \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0435\u0437\u0434\u043e\u043a, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e\u0435 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0438 \u0434\u043e\u0440\u043e\u0433\u043e\u0439 \u0442\u0440\u0430\u0444\u0438\u043a, \u043b\u0438\u0431\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u043e\u043b\u043d\u043e\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0412\u043e\u0442 \u043f\u043e\u0447\u0435\u043c\u0443 \u044f \u043d\u0430\u0447\u0430\u043b \u0438\u0441\u043a\u0430\u0442\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b \u044d\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043b\u0438 S3 API, \u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435. \u041a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e, \u043c\u0438\u0440 Open Source \u043d\u0435 \u0440\u0430\u0437\u043e\u0447\u0430\u0440\u043e\u0432\u0430\u043b \u043c\u0435\u043d\u044f \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0439, \u0432\u043e\u0442 \u043c\u043e\u0438 \u043b\u044e\u0431\u0438\u043c\u044b\u0435:<\/p>\n<ul>\n<li>\u041f\u0435\u0440\u0432\u043e\u0435, \u043d\u0430 \u0447\u0442\u043e \u044f \u043d\u0430\u0442\u043a\u043d\u0443\u043b\u0441\u044f, \u0431\u044b\u043b\u043e <a href=\"https:\/\/github.com\/jubos\/fake-s3\">Fake S3<\/a>, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u043d\u0430 Ruby \u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0435 \u043a\u0430\u043a \u0433\u0435\u043c, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u043a\u0443\u043d\u0434 \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f. \u042d\u0442\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c, \u043d\u043e \u043e\u043d \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0432\u0441\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b S3 \u0438 \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435.<\/li>\n<li>\u0412\u0442\u043e\u0440\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2014 \u044d\u0442\u043e <a href=\"http:\/\/www8.hp.com\/us\/en\/cloud\/helion-eucalyptus.html\">HPE Helion Eucalyptus<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0448\u0438\u0440\u043e\u043a\u0438\u0439 \u0441\u043f\u0435\u043a\u0442\u0440 \u044d\u043c\u0443\u043b\u044f\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 AWS (CloudFormation, Cloudwatch, ELB&#8230;), \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 <a href=\"https:\/\/eucalyptus.atlassian.net\/wiki\/display\/STOR\/S3+API+Support+in+Eucalyptus+Object+Storage\">S3<\/a>. \u042d\u0442\u043e \u0432\u0435\u0441\u044c\u043c\u0430 \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 (\u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u0435 \u043d\u0430 CentOS), \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043d\u0430 \u044d\u043d\u0442\u0435\u0440\u043f\u0440\u0430\u0439\u0437 \u0438, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0442\u044f\u0436\u0435\u043b\u043e\u0432\u0435\u0441\u043d\u043e\u0435 \u0434\u043b\u044f \u043b\u0438\u0447\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043b\u0438 \u0434\u043b\u044f \u043c\u0430\u043b\u043e\u0433\u043e \u0431\u0438\u0437\u043d\u0435\u0441\u0430.<\/li>\n<li>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0438 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0439 \u043c\u043d\u043e\u044e \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2014 \u044d\u0442\u043e <a href=\"https:\/\/github.com\/scality\/s3\">\u0441\u0435\u0440\u0432\u0435\u0440 Scality S3<\/a>. \u0414\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u0432\u0438\u0434\u0435 Docker-\u043e\u0431\u0440\u0430\u0437\u0430, \u0447\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043b\u0435\u0433\u043a\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0435\u0433\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0438 \u043d\u0430\u0447\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u043b\u0438\u0447\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u043a\u0430\u0436\u0434\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0447\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u043a\u0443\u043d\u0434 \u0431\u0435\u0437 \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438. \u041d\u043e \u043e\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0438 \u0434\u043b\u044f \u044d\u043d\u0442\u0435\u0440\u043f\u0440\u0430\u0439\u0437\u0430, \u0442.\u043a. \u043e\u043d\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u043e \u0438 \u0433\u043e\u0442\u043e\u0432\u043e \u043a \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0443. \u041b\u0443\u0447\u0448\u0435\u0435 \u0438\u0437 \u0434\u0432\u0443\u0445 \u043c\u0438\u0440\u043e\u0432.<\/li>\n<\/ul>\n<p>  <\/p>\n<h2>\u041d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c Scality S3<\/h2>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u044d\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c AWS S3 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 Scality S3, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0435\u0433\u043e \u043e\u0436\u0438\u0432\u0438\u043c!<\/p>\n<p>  \u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 <a href=\"https:\/\/docs.docker.com\/engine\/installation\/\">Docker<\/a><\/li>\n<li>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 <a href=\"https:\/\/www.ruby-lang.org\/ru\/documentation\/installation\/\">Ruby<\/a><\/li>\n<\/ul>\n<p>  \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 Docker-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 Scality S3:<\/p>\n<pre><code class=\"bash\">$ docker run -d --name s3server -p 8000:8000 scality\/s3server Unable to find image 'scality\/s3server:latest' locally latest: Pulling from scality\/s3server 357ea8c3d80b: Pull complete 52befadefd24: Pull complete 3c0732d5313c: Pull complete ceb711c7e301: Pull complete 868b1d0e2aad: Pull complete 3a438db159a5: Pull complete 38d1470647f9: Pull complete 4d005fb96ed5: Pull complete a385ffd009d5: Pull complete Digest: sha256:4fe4e10cdb88da8d3c57e2f674114423ce4fbc57755dc4490d72bc23fe27409e Status: Downloaded newer image for scality\/s3server:latest 7c61434e5223d614a0739aaa61edf21763354592ba3cc5267946e9995902dc18 $ <\/code><\/pre>\n<p>  \u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e Docker-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0438\u0441\u043f\u0440\u0430\u0432\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<\/p>\n<pre><code class=\"bash\">$ docker ps CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                    NAMES ed54e677b1b3        scality\/s3server    &quot;npm start&quot;         5 days ago          Up 5 days           0.0.0.0:8000-&gt;8000\/tcp   s3server <\/code><\/pre>\n<p>  \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 Ruby-\u0433\u0435\u043c AWS SDK v2 (\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f <a href=\"http:\/\/docs.aws.amazon.com\/sdkforruby\/api\/\">\u0437\u0434\u0435\u0441\u044c<\/a>):<\/p>\n<pre><code class=\"bash\">$ gem install aws-sdk <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u0432 \u043d\u0430\u0448\u0443 \u043a\u043e\u0440\u0437\u0438\u043d\u0443:<\/p>\n<pre><code class=\"bash\">$ touch myfavoritefile <\/code><\/pre>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0432\u0430\u0448 \u043b\u044e\u0431\u0438\u043c\u044b\u0439 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440, \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0444\u0430\u0439\u043b, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0432\u0430\u0448 \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 Ruby, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0433\u043e \u2018s3_script.rb\u2019:<\/p>\n<pre><code class=\"ruby\">#!\/usr\/bin\/ruby require 'aws-sdk' s3 = Aws::S3::Client.new(     :access_key_id =&gt; 'accessKey1',     :secret_access_key =&gt; 'verySecretKey1',     :region =&gt; 'us-west-2',     :endpoint =&gt; 'http:\/\/0.0.0.0:8000\/',     :force_path_style =&gt; true ) s3.create_bucket({bucket: &quot;mybucket&quot;}) File.open('myfavoritefile', 'rb') do |file|     s3.put_object(bucket: 'mybucket', key: 'myfavoritefile', body: file) end resp = s3.list_objects_v2(bucket: 'mybucket') puts resp.contents.map(&:key) <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0441\u043a\u0440\u0438\u043f\u0442:<\/p>\n<pre><code class=\"bash\">$ ruby s3_script.rb $ myfavoritefile <\/code><\/pre>\n<p>  \u041f\u043e\u0437\u0434\u0440\u0430\u0432\u043b\u044f\u044e, \u0432\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0432\u0430\u0448\u0443 \u043f\u0435\u0440\u0432\u0443\u044e S3-\u043a\u043e\u0440\u0437\u0438\u043d\u0443 \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043b\u0438 \u0432 \u043d\u0435\u0435 \u0444\u0430\u0439\u043b!<\/p>\n<h2>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043a\u043e\u0434<\/h2>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d Ruby \u0438 \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c <a href=\"https:\/\/github.com\/aws\/aws-sdk-ruby\">\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 AWS SDK<\/a>:<\/p>\n<pre><code class=\"ruby\">#!\/usr\/bin\/ruby require 'aws-sdk' <\/code><\/pre>\n<p>  \u041c\u044b \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0443 S3, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u043c\u0443 \u0432 \u043d\u0430\u0448\u0435\u043c Docker-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435. \u0417\u0430\u043c\u0435\u0442\u044c\u0442\u0435, \u0447\u0442\u043e \u2018accessKey1\u2019 \u0438 \u2018verySecretKey1\u2019 \u2014 \u043a\u043b\u044e\u0447 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0438 \u043a\u043b\u044e\u0447 \u0441\u0435\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c\u044b\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c Scality S3:<\/p>\n<pre><code class=\"ruby\">s3 = Aws::S3::Client.new(     :access_key_id =&gt; 'accessKey1',     :secret_access_key =&gt; 'verySecretKey1',     :region =&gt; 'us-west-2',     :endpoint =&gt; 'http:\/\/127.0.0.1:8000\/',     :force_path_style =&gt; true ) <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c S3-\u043a\u043e\u0440\u0437\u0438\u043d\u0443 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u2018mybucket\u2019:<\/p>\n<pre><code class=\"ruby\">s3.create_bucket({bucket: &quot;mybucket&quot;}) <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0432 \u043d\u0430\u0448\u0443 \u043a\u043e\u0440\u0437\u0438\u043d\u0443 \u2018mybucket\u2019 \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u2018myfavoritefile\u2019:<\/p>\n<pre><code class=\"ruby\">File.open('myfavoritefile', 'rb') do |file|     s3.put_object(bucket: 'mybucket', key: 'myfavoritefile', body: file) end <\/code><\/pre>\n<p>  \u0418 \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043a\u043e\u0440\u0437\u0438\u043d\u044b \u2018mybucket\u2019 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c \u0435\u0433\u043e \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u043c \u0432\u044b\u0432\u043e\u0434\u0435:<\/p>\n<pre><code class=\"ruby\">resp = s3.list_objects_v2(bucket: \u201cmybucket\u201d) puts resp.contents.map(&:key) <\/code><\/pre>\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:\/\/habrahabr.ru\/post\/318086\/\"> https:\/\/habrahabr.ru\/post\/318086\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/07c\/31a\/d04\/07c31ad042d243de830f1bf77e8c079e.jpg\"\/><\/p>\n<p>  Amazon S3 (Simple Storage Service, \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430) \u2014 \u043e\u0447\u0435\u043d\u044c \u043c\u043e\u0449\u043d\u044b\u0439 \u043e\u043d\u043b\u0430\u0439\u043d \u0441\u0435\u0440\u0432\u0438\u0441 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0433\u043e Amazon Web Services. \u0414\u0443\u043c\u0430\u0439\u0442\u0435 \u043e \u043d\u0435\u043c, \u043a\u0430\u043a \u043e\u0431 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u043c \u0434\u0438\u0441\u043a\u0435, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f\u0445, \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0438 \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0438\u0445. \u041a\u043e\u043c\u043f\u0430\u043d\u0438\u0438, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a DropBox, Netflix, Pinterest, Slideshare, Tumblr \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0435, \u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043d\u0435\u0433\u043e.<\/p>\n<p>  \u0425\u043e\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441 \u0438 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439, \u0435\u0433\u043e \u043a\u043e\u0434 \u043d\u0435 \u043e\u0442\u043a\u0440\u044b\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0434\u043e\u0432\u0435\u0440\u044f\u0442\u044c Amazon \u0441\u0432\u043e\u0438 \u0434\u0430\u043d\u043d\u044b\u0435, \u0438 \u0445\u043e\u0442\u044c \u043e\u043d\u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e\u043c\u0443 \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0443 \u043d\u0430 \u0433\u043e\u0434, \u0432\u044b \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u0432\u0435\u0441\u0442\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043a\u0440\u0435\u0434\u0438\u0442\u043d\u043e\u0439 \u043a\u0430\u0440\u0442\u0435 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430. \u0422.\u043a. S3 \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u043d\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u043d\u0436\u0435\u043d\u0435\u0440-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442, \u044f \u0445\u043e\u0447\u0443, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0438 \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u044b \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u043b\u0438 \u043e\u043f\u044b\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0438\u043c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0435\u0433\u043e \u0432 \u0441\u0432\u043e\u0438\u0445 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445, \u0438 \u0435\u0449\u0435 \u044f \u043d\u0435 \u0445\u043e\u0447\u0443, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u0437\u0430 \u044d\u0442\u043e \u043f\u043b\u0430\u0442\u0438\u043b\u0438. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u044b \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0435\u0437\u0434\u043e\u043a, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e\u0435 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0438 \u0434\u043e\u0440\u043e\u0433\u043e\u0439 \u0442\u0440\u0430\u0444\u0438\u043a, \u043b\u0438\u0431\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u043e\u043b\u043d\u043e\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442\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-282792","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/282792","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=282792"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/282792\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=282792"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=282792"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=282792"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}