<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>aws Archives - Big Data Processing</title>
	<atom:link href="https://bigdataproc.com/tag/aws/feed/" rel="self" type="application/rss+xml" />
	<link>https://bigdataproc.com/tag/aws/</link>
	<description>Big Data Solution for GCP, AWS, Azure and on-prem</description>
	<lastBuildDate>Sat, 15 Aug 2020 23:08:21 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.3.2</generator>
	<item>
		<title>AWS S3: How to recover deleted files?</title>
		<link>https://bigdataproc.com/aws-s3-how-to-recover-deleted-files/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=aws-s3-how-to-recover-deleted-files</link>
					<comments>https://bigdataproc.com/aws-s3-how-to-recover-deleted-files/#respond</comments>
		
		<dc:creator><![CDATA[Gaurang]]></dc:creator>
		<pubDate>Sat, 15 Aug 2020 22:57:16 +0000</pubDate>
				<category><![CDATA[aws]]></category>
		<category><![CDATA[s3]]></category>
		<guid isPermaLink="false">http://allabouthadoop.net/?p=179</guid>

					<description><![CDATA[<p>Few days back while fixing some production issue my team deleted a big database. it had more than 100 tables and around 100 GB of&#8230;</p>
<div class="more-link-wrapper"><a class="more-link" href="https://bigdataproc.com/aws-s3-how-to-recover-deleted-files/">Continue reading<span class="screen-reader-text">AWS S3: How to recover deleted files?</span></a></div>
<p>The post <a rel="nofollow" href="https://bigdataproc.com/aws-s3-how-to-recover-deleted-files/">AWS S3: How to recover deleted files?</a> appeared first on <a rel="nofollow" href="https://bigdataproc.com">Big Data Processing </a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Few days back while fixing some production issue my team deleted a big database. it had more than 100 tables and around 100 GB of data.  And so re-processing and loading tables before business people query it was next to impossible task.  Good thing, we had versioning enabled on bucket. </p>



<p>If you have a versioning enable on your S3 buckets, Every time you make changes to your file it creates a new version. similar to git, and if you delete a file, rather than deleting a file physically it just marks file as deleted. And so, if you want to recover a file, all you need to do is delete the delete marker from file. </p>



<h2 class="wp-block-heading">Now let&#8217;s see how to do it step-by-step.</h2>



<h3 class="wp-block-heading">let&#8217;s take the following bucket, prefix for example</h3>



<pre class="lang:text theme:twilight" title="how to recover deleted s3 files">[gshah@aws-dev restore]$ aws s3 ls s3://aws-dev01-sample-bucket/SIT/USER/gshah/                                                                              
2020-07-20 13:50:12          0 1.txt                                                                                                                                       
2020-07-20 13:50:18          0 2.txt                                                                                                                                       
2020-07-20 13:50:25          0 3.txt                                                                                                                                       
2020-07-20 13:42:28          0 abc.txt                                                                                                                                     
2020-07-20 13:43:01          0 xyz.txt
</pre>



<h3 class="wp-block-heading">Now let&#8217;s delete delete file files.</h3>



<pre class="lang:text theme:twilight" title="how to recover deleted s3 files">[gshah@aws-dev restore]$ aws s3 rm s3://aws-dev01-sample-bucket/SIT/USER/gshah/abc.txt                                                                       
delete: s3://aws-dev01-sample-bucket/SIT/USER/gshah/abc.txt                                                                                                           
[gshah@aws-dev restore]$ aws s3 rm s3://aws-dev01-sample-bucket/SIT/USER/gshah/xyz.txt                                                                       
delete: s3://aws-dev01-sample-bucket/SIT/USER/gshah/xyz.txt                                                                                                           
[gshah@aws-dev restore]$ aws s3 ls s3://aws-dev01-sample-bucket/SIT/USER/gshah/                                                                              
2020-07-20 13:50:12          0 1.txt                                                                                                                                       
2020-07-20 13:50:18          0 2.txt                                                                                                                                       
2020-07-20 13:50:25          0 3.txt
</pre>



<h3 class="wp-block-heading">Now let&#8217;s see those deleted files</h3>



<pre class="lang:text theme:twilight" title="how to recover deleted s3 files">[gshah@aws-dev restore]$ aws s3api list-object-versions \                                                                                                         
&gt; --bucket aws-dev01-sample-bucket \                                                                                                                                    
&gt; --prefix SIT/USER/gshah/  \                                                                                                                                            
&gt; --output json \                                                                                                                                                          
&gt; --query 'DeleteMarkers[?IsLatest==<code data-enlighter-language="raw" class="EnlighterJSRAW">true</code>]'                                                                                                                               
[                                                                                                                                                                          
    {                                                                                                                                                                      
        "Owner": {                                                                                                                                                         
            "ID": "514384a9e158b47a163ad2a0b3e7d767dfbc46b167f6899de54b0eb7d4413cd9"                                                                                       
        },                                                                                                                                                                 
        "IsLatest": true,                                                                                                                                                  
        "VersionId": "oGhCi9bGRS_xYNstvGEgjGv24Dv94VzW",                                                                                                                   
        "Key": "SIT/USER/gshah/4.txt",                                                                                                                                   
        "LastModified": "2020-07-20T13:51:33.000Z"                                                                                                                         
    },                                                                                                                                                                     
    {                                                                                                                                                                      
        "Owner": {                                                                                                                                                         
            "ID": "514384a9e158b47a163ad2a0b3e7d767dfbc46b167f6899de54b0eb7d4413cd9"                                                                                       
        },                                                                                                                                                                 
        "IsLatest": true,                                                                                                                                                  
        "VersionId": "_Air1UwjRGOqln65oSp5xiCO06ZPwocP",                                                                                                                   
        "Key": "SIT/USER/gshah/abc.txt",                                                                                                                                 
        "LastModified": "2020-07-20T13:59:52.000Z"                                                                                                                         
    },                                                                                                                                                                     
    {                                                                                                                                                                      
        "Owner": {                                                                                                                                                         
            "ID": "514384a9e158b47a163ad2a0b3e7d767dfbc46b167f6899de54b0eb7d4413cd9"                                                                                       
        },                                                                                                                                                                 
        "IsLatest": true,                                                                                                                                                  
        "VersionId": "e1LYLX92jBtLgbXp92.nZdf0yFKZ8m3I",                                                                                                                   
        "Key": "SIT/USER/gshah/xyz.txt",                                                                                                                                 
        "LastModified": "2020-07-20T13:59:58.000Z"                                                                                                                         
    }                                                                                                                                                                      
]</pre>



<blockquote class="wp-block-quote"><p>This will show all the deleted files, not just recently deleted files. For recently deleted files put time inside query argument. i.e.&nbsp;<strong>&#8216;DeleteMarkers[?IsLatest==<code data-enlighter-language="raw" class="EnlighterJSRAW">true</code> &amp;&amp; LastModified &gt;= <code data-enlighter-language="raw" class="EnlighterJSRAW">2020-07-20T13:59:52.000Z</code>]&#8217;</strong>. You can see that it shows 4.txt as well, which I deleted sometime in past. </p></blockquote>



<h3 class="wp-block-heading">Now let&#8217;s recover those files. <br>for this I need to delete the delete market for this files. </h3>



<pre class="lang:text theme:twilight" title="how to recover deleted s3 files">
[gshah@aws-dev restore]$ aws s3api delete-object --bucket aws-dev01-sample-bucket --key SIT/USER/gshah/xyz.txt                                                                                                                                                                                                                                                                                                                                                                                    
{                                                                                                                                                                          
    "VersionId": "xpLtEqtX7PBYy3NmstxbvwlVqV6thjwt",                                                                                                                       
    "DeleteMarker": true                                                                                                                                                   
}                                                                                                                                                                          
[gshah@aws-dev restore]$ aws s3api delete-object --bucket aws-dev01-sample-bucket --key SIT/USER/gshah/abc.txt                                                                                                                                                                                                                                                         
{                                                                                                                                                                          
    "VersionId": "gKv_9EaQF2UPtZFQDrQkKFobd.OhORXV",                                                                                                                       
    "DeleteMarker": true                                                                                                                                                   
}
</pre>



<h3 class="wp-block-heading">Let&#8217;s see if we got those files back </h3>



<pre class="lang:text theme:twilight" title="how to recover deleted s3 files">[gshah@aws-dev restore]$ aws s3 ls s3://aws-dev01-sample-bucket/SIT/USER/gshah/                                                                              
2020-07-20 13:50:12          0 1.txt
2020-07-20 13:50:18          0 2.txt
2020-07-20 13:50:25          0 3.txt
2020-07-20 13:42:28          0 abc.txt
2020-07-20 13:43:01          0 xyz.txt
</pre>



<p></p>
<p>The post <a rel="nofollow" href="https://bigdataproc.com/aws-s3-how-to-recover-deleted-files/">AWS S3: How to recover deleted files?</a> appeared first on <a rel="nofollow" href="https://bigdataproc.com">Big Data Processing </a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://bigdataproc.com/aws-s3-how-to-recover-deleted-files/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
