{"id":7547,"date":"2018-06-06T17:09:53","date_gmt":"2018-06-06T09:09:53","guid":{"rendered":"http:\/\/rmohan.com\/?p=7547"},"modified":"2018-06-06T17:09:53","modified_gmt":"2018-06-06T09:09:53","slug":"backup-amazon-ebs-volume-snapshots-from-amazon-ec2","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=7547","title":{"rendered":"Backup Amazon EBS Volume Snapshots from Amazon Ec2"},"content":{"rendered":"<div class=\"vk_ans\">\n<p>ata is the most important factor in any business and taking its backup on a regular interval of time is a handsome practice. We have come up the technique to auto backup Amazon EBS volume snapshots from running Amazon Ec2 instance using AWS CLI.<\/p>\n<h2><u>Prerequisite<\/u><\/h2>\n<ul>\n<li class=\"lang-bash prettyprint prettyprinted\">Amazon AWS\u00a0account for creating Access key ID and\u00a0Secret access key.<\/li>\n<li class=\"lang-bash prettyprint prettyprinted\">Running Amazon Ec2 Instance.<\/li>\n<li class=\"lang-bash prettyprint prettyprinted\">AWS Command Line Interface.<\/li>\n<\/ul>\n<hr \/>\n<h2><u>Create\u00a0Access key ID and\u00a0Secret access key<\/u><\/h2>\n<\/div>\n<ul>\n<li>Log in to your Amazon Dashboard Console Account.<\/li>\n<li>Click on IAM management console.<\/li>\n<li>Click on\u00a0<strong>ADD<\/strong>\u00a0<strong>Users<\/strong>\u00a0to create a new user for backing up EBS Volume.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/06\/user001.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7548\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/06\/user001.jpg\" alt=\"\" width=\"2486\" height=\"615\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/user001.jpg 2486w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/user001-300x74.jpg 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/user001-768x190.jpg 768w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/user001-1024x253.jpg 1024w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/user001-150x37.jpg 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/user001-400x99.jpg 400w\" sizes=\"(max-width: 2486px) 100vw, 2486px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/06\/user002.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7549\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/06\/user002.jpg\" alt=\"\" width=\"2459\" height=\"854\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/user002.jpg 2459w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/user002-300x104.jpg 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/user002-768x267.jpg 768w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/user002-1024x356.jpg 1024w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/user002-150x52.jpg 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/user002-400x139.jpg 400w\" sizes=\"(max-width: 2459px) 100vw, 2459px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/06\/user003.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7550\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/06\/user003.jpg\" alt=\"\" width=\"2536\" height=\"563\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/user003.jpg 2536w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/user003-300x67.jpg 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/user003-768x170.jpg 768w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/user003-1024x227.jpg 1024w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/user003-150x33.jpg 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/user003-400x89.jpg 400w\" sizes=\"(max-width: 2536px) 100vw, 2536px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/06\/user004.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7551\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/06\/user004.jpg\" alt=\"\" width=\"2456\" height=\"266\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/user004.jpg 2456w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/user004-300x32.jpg 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/user004-768x83.jpg 768w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/user004-1024x111.jpg 1024w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/user004-150x16.jpg 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/user004-400x43.jpg 400w\" sizes=\"(max-width: 2456px) 100vw, 2456px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h2><u>Installing AWS Command Line Interface<\/u><\/h2>\n<p>We are using centos7 machine for the demonstration<\/p>\n<p>&nbsp;<\/p>\n<p>python &#8211;version<br \/>\ncurl &#8220;https:\/\/bootstrap.pypa.io\/get-pip.py&#8221; -o &#8220;get-pip.py&#8221;<br \/>\npython get-pip.py<br \/>\npip -V<br \/>\npip install awscli<br \/>\npip install &#8211;upgrade awscli<\/p>\n<h2><u>Configure AWS CLI on Linux<\/u><\/h2>\n<p><span class=\"pln\">After installing awscli, there is a requirement of configuring awscli on Amazon Ec2 instance. Hit command aws configure and Enter the\u00a0AWS Access Key ID,\u00a0AWS Secret Access Key, and\u00a0<a href=\"https:\/\/docs.aws.amazon.com\/AWSEC2\/latest\/UserGuide\/using-regions-availability-zones.html\">Default region name<\/a>\u00a0when prompted. Default output format can be left blank.<\/span><\/p>\n<pre>aws configure<\/pre>\n<pre>AWS Access Key ID [None]: AKIAIUARU2RSR74GQRXA\r\nAWS Secret Access Key [None]: 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\r\nDefault region name [None]: us-east-1\r\nDefault output format [None]:\r\n<\/pre>\n<p>We are done with all the Prerequisite, now we will go ahead and schedule auto backups for Amazon EBS volume from Amazon Ec2 instances using awscli.<\/p>\n<hr \/>\n<h2><u>Auto Backup Amazon EBS Volumes From Amazon Ec2<\/u><\/h2>\n<p>Use the below command to create a snapshot of Amazon EBS volume from Ec2 Instance. Enter your EBS volume ID for which you want to take backup or create a snapshot and give a right description message.<\/p>\n<h4><u>Command<\/u><\/h4>\n<pre>aws ec2 create-snapshot --volume-id vol-xxxxxxxx --description \"Relevant description Message\"\r\n\r\n\r\n<\/pre>\n<h4><u>How to obtain the EBS volume ID<\/u><\/h4>\n<p>Log into AWS Dashboard\u00a0<strong>&gt;&gt;<\/strong>\u00a0Clicking on service Ec2<strong>\u00a0&gt;&gt;<\/strong>\u00a0Select the Ec2 instance\u00a0<strong>&gt;&gt;<\/strong>\u00a0Choose Block Device<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h4><u>Apply Cronjob to Auto Backup Snapshots of Amazon EBS.<\/u><\/h4>\n<pre>crontab -e<\/pre>\n<pre>######## Automating EBS Volume Snapshots ########\r\n\r\n00 09 * * * aws ec2 create-snapshot --volume-id vol-0234f278482d2e197 --description \"Disk Backup for Linux Together Demo Server\"\r\n\r\n<\/pre>\n<p>This brings an end to the tutorial. In the above tutorial, we have elaborated the technique to backup Amazon EBS volume using awscli. Write down your questions and queries in the comment section. Do like and share the share the blog, We will be back with more interesting\u00a0tutorials asap.\u00a0 Thanks!<\/p>\n","protected":false},"excerpt":{"rendered":"\n<p>ata is the most important factor in any business and taking its backup on a regular interval of time is a handsome practice. We have come up the technique to auto backup Amazon EBS volume snapshots from running Amazon Ec2 instance using AWS CLI.<\/p>\n<p> Prerequisite Amazon AWS account for creating Access key ID and [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[49],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7547"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7547"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7547\/revisions"}],"predecessor-version":[{"id":7552,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7547\/revisions\/7552"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7547"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7547"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7547"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}