{"id":255944,"date":"2015-04-24T13:33:02","date_gmt":"2015-04-24T09:33:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=255944"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=255944","title":{"rendered":"\u0421\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0433\u043e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f EC2-instance \u0432 AMI"},"content":{"rendered":"<p> \t\t\t\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442.<\/p>\n<p>  \u0425\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c \u0434\u043b\u044f $subj. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043a\u043e\u043c\u0443-\u0442\u043e \u043e\u043d \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0435\u0437\u0435\u043d.<\/p>\n<p>  \u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438: \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e EC2-\u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0432 AWS, \u0440\u0430\u0437\u0431\u0440\u043e\u0441\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u0440\u0430\u0437\u043d\u044b\u043c \u0440\u0435\u0433\u0438\u043e\u043d\u0430\u043c. \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0435 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u043b\u0435\u0433\u043a\u0438\u043c \u0438 \u0431\u044b\u0441\u0442\u0440\u044b\u043c.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0441\u0430\u043c \u0441\u043a\u0440\u0438\u043f\u0442: <a href=\"https:\/\/github.com\/jazzl0ver\/aws-missing-tools\/blob\/master\/ec2-automate-backup\/ec2-automate-backup2ami.sh\">ec2-automate-backup2ami.sh<\/a><br \/>  \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435: <a href=\"https:\/\/github.com\/jazzl0ver\/aws-missing-tools\/blob\/master\/ec2-automate-backup\/README.backup2ami.md\">README.backup2ami.md<\/a><br \/>  \u0421\u043a\u0440\u0438\u043f\u0442-\u043e\u0431\u0435\u0440\u0442\u043a\u0430 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u043e \u043a\u0440\u043e\u043d\u0443: <a href=\"https:\/\/github.com\/jazzl0ver\/aws-missing-tools\/blob\/master\/ec2-automate-backup\/ec2-backup-wrapper.sh\">ec2-backup-wrapper.sh<\/a><\/p>\n<p>  \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e:   <\/p>\n<ul>\n<li>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0430\u043a\u0435\u0442 <a href=\"http:\/\/aws.amazon.com\/developertools\/351\">ec2-api-tools<\/a> (\u0443 \u043c\u0435\u043d\u044f \u043e\u043d \u0432\u0435\u0440\u0441\u0438\u0438 1.6.7.3)<\/li>\n<li>\u041f\u043e\u0434\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442-\u043e\u0431\u0435\u0440\u0442\u043a\u0443, \u0443\u043a\u0430\u0437\u0430\u0432 \u043f\u0443\u0442\u044c \u043a ec2-automate-backup2ami.sh \u0438 \u043a \u043b\u043e\u0433-\u0444\u0430\u0439\u043b\u0443<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0432 AWS IAM \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0434\u043b\u044f \u0431\u044d\u043a\u0430\u043f\u043e\u0432 \u0438 \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u0435\u043c\u0443 \u043f\u043e\u0445\u043e\u0436\u0443\u044e \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0443:<br \/> \n<pre><code class=\"markdown\">{   &quot;Version&quot;: &quot;2012-10-17&quot;,   &quot;Statement&quot;: [     {       &quot;Sid&quot;: &quot;Stmt1389911824000&quot;,       &quot;Effect&quot;: &quot;Allow&quot;,       &quot;Action&quot;: [         &quot;ec2:CreateImage&quot;,         &quot;ec2:CreateSnapshot&quot;,         &quot;ec2:CreateTags&quot;,         &quot;ec2:DeleteSnapshot&quot;,         &quot;ec2:DeregisterImage&quot;,         &quot;ec2:DescribeRegions&quot;,         &quot;ec2:DescribeSnapshotAttribute&quot;,         &quot;ec2:ModifySnapshotAttribute&quot;,         &quot;ec2:DescribeImages&quot;,         &quot;ec2:DescribeInstances&quot;,         &quot;ec2:DescribeSnapshots&quot;,         &quot;ec2:DescribeTags&quot;,         &quot;ec2:DescribeVolumeAttribute&quot;,         &quot;ec2:DescribeVolumeStatus&quot;,         &quot;ec2:DescribeVolumes&quot;       ],       &quot;Resource&quot;: [         &quot;*&quot;       ]     }   ] } <\/code><\/pre>\n<p>  <\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<br \/> \n<pre><code class=\"markdown\">[ec2-user@zenoss ~]$ cat .stage export AWS_ACCESS_KEY=access_key export AWS_SECRET_KEY=secret_key export AWS_ACCESS_KEY_ID=access_key export AWS_SECRET_ACCESS_KEY=secret_key <\/code><\/pre>\n<\/li>\n<li>\u0423\u043a\u0430\u0437\u0430\u0442\u044c EC2_HOME<\/li>\n<li> \u041f\u043e\u043c\u0435\u0442\u0438\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u043d\u0441\u0442\u0430\u043d\u0441, \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0438\u0439 \u0431\u044d\u043a\u0430\u043f\u0430, \u0442\u044d\u0433\u043e\u043c <b>Backup<\/b> \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c <b>true<\/b><\/li>\n<\/ul>\n<p>  \u041a\u0440\u043e\u043d\u0442\u0430\u0431 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"markdown\">[ec2-user@backup ~]$ crontab -l PATH=$PATH:\/usr\/kerberos\/bin:\/usr\/local\/bin:\/bin:\/usr\/bin EC2_HOME=\/usr\/local SHELL=\/bin\/bash  00 2 * * * .\/ec2-backup-wrapper.sh stage &quot;alerts1@mydomain.cc alerts2@mydomain.cc&quot; <\/code><\/pre>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043b\u043e\u0433-\u0444\u0430\u0439\u043b \u0432\u0438\u0434\u0430 ec2-automate-backup2ami.stage.log. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u043d\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u0435 \u0430\u0434\u0440\u0435\u0441\u0430.<\/p>\n<p>  \u0421\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0444\u0430\u0439\u043b \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <b>.<\/b>stage, \u0430 \u0441\u043a\u0440\u0438\u043f\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0435\u0437 \u0442\u043e\u0447\u043a\u0438.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0432 AWS AMI \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0437 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c ec2ab_server.domain.cc_YYYY-MM-DD \u0438 \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0442\u044d\u0433\u0430\u043c\u0438:  <\/p>\n<ul>\n<li><b>Name<\/b> \u2014 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0430 EC2<\/li>\n<li><b>InitiatingHost<\/b> \u2014 FQDN \u0431\u044d\u043a\u0430\u043f-\u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/li>\n<li><b>PurgeAfterFE<\/b> \u2014 \u0434\u0430\u0442\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u0440\u0430\u0437\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 unix time<\/li>\n<li><b>PurgeAfter<\/b> \u2014 \u0434\u0430\u0442\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u0440\u0430\u0437\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 YYYY-MM-DD (\u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0430\u0434\u043c\u0438\u043d\u0430, \u0441\u043a\u0440\u0438\u043f\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 PurgeAfterFE)<\/li>\n<li><b>PurgeAllow<\/b> \u2014 \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0437\u0430 (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u2014 true)<\/li>\n<li><b>Instance<\/b> \u2014 ID \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0430 EC2<\/li>\n<li><b>Created<\/b> \u2014 \u0434\u0430\u0442\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u0440\u0430\u0437\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 YYYY-MM-DD<\/li>\n<\/ul>\n<p>  PS \u0421\u043a\u0440\u0438\u043f\u0442 \u0441\u043e\u0437\u0434\u0430\u043d \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 <a href=\"https:\/\/github.com\/colinbjohnson\/aws-missing-tools\/tree\/master\/ec2-automate-backup\">ec2-automate-backup<\/a> (\u0431\u044d\u043a\u0430\u043f EBS-\u0434\u0438\u0441\u043a\u043e\u0432, \u0431\u0435\u0437 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e \u0440\u0435\u0433\u0438\u043e\u043d\u0430\u043c) \u043e\u0442 <a href=\"https:\/\/github.com\/colinbjohnson\">colinbjohnson<\/a>, \u0437\u0430 \u0447\u0442\u043e \u0435\u043c\u0443 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0441\u043f\u0430\u0441\u0438\u0431\u043e!<\/p>\n<p>  PPS \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u0434 Mac OS\/X \u0441\u043a\u0440\u0438\u043f\u0442 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e (\u0441\u043c. \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u0443\u044e \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 get_purge_after_date()), \u043d\u043e \u0443 \u043c\u0435\u043d\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043d\u0435\u0442.<\/p>\n<p>  PPPS \u041f\u0435\u0440\u0435\u0434 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u0441\u043d\u044d\u043f\u0448\u043e\u0442\u043e\u0432 \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0435 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 \u0431\u0443\u0444\u0435\u0440\u044b \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u044d\u043a\u0430\u043f \u043c\u043e\u0436\u0435\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u043a\u043e\u043d\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u044b\u043c. \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u044b\u0445 \u0441\u043d\u044d\u043f\u0448\u043e\u0442\u043e\u0432 \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/github.com\/alestic\/ec2-consistent-snapshot\">ec2-consistent-snapshot<\/a> \t\t\t<\/p>\n<div class=\"clear\"><\/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=\"http:\/\/habrahabr.ru\/post\/256515\/\"> http:\/\/habrahabr.ru\/post\/256515\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p> \t\t\t\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442.<\/p>\n<p>  \u0425\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c \u0434\u043b\u044f $subj. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043a\u043e\u043c\u0443-\u0442\u043e \u043e\u043d \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0435\u0437\u0435\u043d.<\/p>\n<p>  \u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438: \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e EC2-\u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0432 AWS, \u0440\u0430\u0437\u0431\u0440\u043e\u0441\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u0440\u0430\u0437\u043d\u044b\u043c \u0440\u0435\u0433\u0438\u043e\u043d\u0430\u043c. \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0435 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u043b\u0435\u0433\u043a\u0438\u043c \u0438 \u0431\u044b\u0441\u0442\u0440\u044b\u043c.  <\/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-255944","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/255944","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=255944"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/255944\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=255944"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=255944"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=255944"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}