<?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>SSIS Amazon Storage Task Archives | ZappySys Blog</title>
	<atom:link href="https://zappysys.com/blog/category/ssis/tasks/ssis-amazon-storage-task/feed/" rel="self" type="application/rss+xml" />
	<link>https://zappysys.com/blog/category/ssis/tasks/ssis-amazon-storage-task/</link>
	<description>SSIS / ODBC Drivers / API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more</description>
	<lastBuildDate>Wed, 13 Sep 2023 17:09:53 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.4</generator>

<image>
	<url>https://zappysys.com/blog/wp-content/uploads/2023/01/cropped-zappysys-symbol-large-32x32.png</url>
	<title>SSIS Amazon Storage Task Archives | ZappySys Blog</title>
	<link>https://zappysys.com/blog/category/ssis/tasks/ssis-amazon-storage-task/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Download the Latest File from Amazon S3 Storage using SSIS</title>
		<link>https://zappysys.com/blog/download-latest-file-amazon-s3-storage-using-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Fri, 27 Dec 2019 12:33:04 +0000</pubDate>
				<category><![CDATA[S3 (Simple Storage Service)]]></category>
		<category><![CDATA[SSIS Amazon S3 Connection]]></category>
		<category><![CDATA[SSIS Amazon Storage Task]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[s3]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[storage]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=8626</guid>

					<description><![CDATA[<p>Introduction In our previous article, we saw SSIS Amazon S3 Storage Task examples. Now let&#8217;s look at how to Download the Latest File from Amazon S3 Storage using SSIS. Microsoft SSIS includes the Amazon S3 Storage Task that allows us to upload files to Amazon S3 Storage, download files, creating local and remote directories an more. In [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/download-latest-file-amazon-s3-storage-using-ssis/">Download the Latest File from Amazon S3 Storage using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2><span id="Introduction">Introduction</span></h2>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/s3-e1553183075864.png"><img decoding="async" class="wp-image-6547 size-full alignleft" src="https://zappysys.com/blog/wp-content/uploads/2019/03/s3-e1553183075864.png" alt="Amazon S3" width="150" height="150" /></a></p>
<p>In our previous article, we saw <a href="https://zappysys.com/blog/ssis-amazon-s3-storage-task-examples-download-upload-move-delete-files-folders/" target="_blank" rel="noopener">SSIS Amazon S3 Storage Task examples</a>. Now let&#8217;s look at how to Download the Latest File from Amazon S3 Storage using SSIS. Microsoft SSIS includes the Amazon S3 Storage Task that allows us to upload files to Amazon S3 Storage, download files, creating local and remote directories an more. In this article, we will show how to use the <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-task/" target="_blank" rel="noopener">SSIS Amazon S3 Storage task</a> included in ZappySys <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a>.</p>
<p>In nutshell, this post will focus on how to Download the Latest File from Amazon S3 Storage.</p>
<div style="clear: both;"><div class="content_block" id="custom_post_widget-2523"><h2><span id="Prerequisites">Prerequisites</span></h2>
Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:
<ol style="margin-left: 1.5em;">
 	<li><abbr title="SQL Server Integration Services">SSIS</abbr> designer installed. Sometimes it is referred to as <abbr title="Business Intelligence Development Studio">BIDS</abbr> or <abbr title="SQL Server Data Tools">SSDT</abbr> (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from the Microsoft site</a>).</li>
 	<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
 	<li>Make sure <span style="text-decoration: underline;"><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a></span> is installed (<a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">download it</a>, if you haven't already).</li>
 	<li>(<em>Optional step</em>)<em>.</em> <a href="https://zappysys.zendesk.com/hc/en-us/articles/360035974593" target="_blank" rel="noopener">Read this article</a>, if you are planning to deploy packages to a server and schedule their execution later.</li>
</ol></div></div>
<h2><span id="What_is_Amazon_S3_Storage">What is Amazon S3 Storage</span></h2>
<p>Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance. This means customers of all sizes and industries can use it to store and protect any amount of data for a range of use cases, such as websites, mobile applications, backup and restore, archive, enterprise applications, IoT devices, and big data analytics. Amazon S3 provides easy-to-use management features so you can organize your data and configure finely-tuned access controls to meet your specific business, organizational, and compliance requirements. Amazon S3 is designed for 99.999999999% (11 9’s) of durability, and stores data for millions of applications for companies all around the world.</p>
<h2><span id="Getting_Started">Getting Started</span></h2>
<p>In order to start, we will show several examples. ZappySys includes an <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-task/" target="_blank" rel="noopener">SSIS Amazon S3 Storage Task</a> that will allow you to access files/folders from Amazon S3 Storage to the Local machine, Upload files(s) to Amazon S3 Storage. It will also support Delete, Rename, List, Get Property, Copy, Move, Create, Set Permission … and many more operations. Here we are showing you is, How to Download the Latest File from Amazon S3 Storage.</p>
<h2><span id="SSIS_Amazon_S3_Storage_Task_Examples">Step-By-Step to Download the Latest File from Amazon S3 Storage</span></h2>
<p>Let´s start with an example. In this SSIS Amazon S3 Storage Task File task example, we will download the latest file using <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-task/" target="_blank" rel="noopener">Amazon S3 Storage Task</a>.</p>
<ol>
<li>First of All, Drag and Drop Amazon S3 Storage Task from SSIS Toolbox and double click it to edit
<div id="attachment_6708" style="width: 706px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-add-s3-task.png" target="_blank" rel="noopener"><img fetchpriority="high" decoding="async" aria-describedby="caption-attachment-6708" class="wp-image-6708 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-add-s3-task.png" alt="Drag and Drop Amazon S3 Storage Task" width="696" height="404" srcset="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-add-s3-task.png 696w, https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-add-s3-task-300x174.png 300w" sizes="(max-width: 696px) 100vw, 696px" /></a><p id="caption-attachment-6708" class="wp-caption-text">Drag and Drop Amazon S3 Storage Task</p></div></li>
<li>The following options are available in Amazon S3 Storage Task:
<div id="attachment_6709" style="width: 723px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-aws-s3-storage-task-options.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6709" class="wp-image-6709 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-aws-s3-storage-task-options.png" alt="Options to upload, download files in SSIS" width="713" height="689" srcset="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-aws-s3-storage-task-options.png 713w, https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-aws-s3-storage-task-options-300x290.png 300w" sizes="(max-width: 713px) 100vw, 713px" /></a><p id="caption-attachment-6709" class="wp-caption-text">Options to upload, download files in SSIS</p></div></li>
<li>You can also overwrite files and folder, skip all, overwrite if the source is older, overwrite if the file size is different, rename files and more:
<div id="attachment_6678" style="width: 692px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/overwrite-action-ssis-za-am-task.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6678" class="wp-image-6678 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/03/overwrite-action-ssis-za-am-task.png" alt="Overwrite files in SSIS" width="682" height="492" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/overwrite-action-ssis-za-am-task.png 682w, https://zappysys.com/blog/wp-content/uploads/2019/03/overwrite-action-ssis-za-am-task-300x216.png 300w" sizes="(max-width: 682px) 100vw, 682px" /></a><p id="caption-attachment-6678" class="wp-caption-text">Overwrite files in SSIS</p></div></li>
<li>Let&#8217;s select the <strong>Download Amazon file(s) to local directory</strong>. Now select/add The Source path, Check Recursive Scan<em>(*Optional)</em> to get all the sub-files and subfolders and files, after that add Target Path if you want to, This option will download files. In Path AccessMode we can use Direct to write the path directly or to use an SSIS variable.
<div id="attachment_6735" style="width: 595px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-az-blob-aws-s3-download-files.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6735" class="wp-image-6735 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-az-blob-aws-s3-download-files.png" alt="ssis-az-blob-aws-s3-download-files" width="585" height="522" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-az-blob-aws-s3-download-files.png 585w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-az-blob-aws-s3-download-files-300x268.png 300w" sizes="(max-width: 585px) 100vw, 585px" /></a><p id="caption-attachment-6735" class="wp-caption-text">SSIS Amazon S3 Storage Task – Download files from Amazon S3 Storage</p></div></li>
<li>Now go to Advanced Filter &amp; Sorting and configure it like below screen to download the latest file only.
<div id="attachment_8629" style="width: 606px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-amazon-s3-and-azure-storage-task-filter-sorting.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8629" class="wp-image-8629 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-amazon-s3-and-azure-storage-task-filter-sorting.png" alt="Storage Task configuration to download the latest file only using sorting" width="596" height="567" srcset="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-amazon-s3-and-azure-storage-task-filter-sorting.png 596w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-amazon-s3-and-azure-storage-task-filter-sorting-300x285.png 300w" sizes="(max-width: 596px) 100vw, 596px" /></a><p id="caption-attachment-8629" class="wp-caption-text">Storage Task configuration to download the latest file only using sorting</p></div></li>
<li>That&#8217;s it now execute the package and it will download the latest file from the Amazon S3 Storage Task to Local File Machine.</li>
<li>Sometimes you may need to make advanced filtering on file path, file date, size, etc. for that refer to <a href="https://zappysys.com/blog/advanced-path-filtering-for-amazon-azure-storage-ssis-task/" target="_blank" rel="noopener">this article</a> for more details.</li>
</ol>
<h2>Conclusion</h2>
<p>To conclude, we can say that working with Amazon S3 Storage is now very simple. In this article, we looked at how to Download the Latest File from Amazon S3 Storage using SSIS. We used Adnavced Filtering &amp; sorting option. If you liked the tasks you can start using them by downloading SSIS PowerPack from our <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">web site here</a>.</p>
<p>Thanks for your time.</p>
<h2>References</h2>
<ul>
<li><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">About SSIS PowerPack</a></li>
<li><a href="https://docs.microsoft.com/en-us/sql/integration-services/expressions/integration-services-ssis-expressions" target="_blank" rel="noopener">Integration Services (SSIS) Expressions</a></li>
<li>Help File: <a href="https://zappysys.com/onlinehelp/ssis-powerpack/index.htm#page=amazon-s3-storage-task.htm" target="_blank" rel="noopener">Amazon Storage Task</a></li>
</ul>
<p>The post <a href="https://zappysys.com/blog/download-latest-file-amazon-s3-storage-using-ssis/">Download the Latest File from Amazon S3 Storage using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SSIS Amazon S3 Storage Task examples (Download, Upload, Delete Files / Folders)</title>
		<link>https://zappysys.com/blog/ssis-amazon-s3-storage-task-examples-download-upload-move-delete-files-folders/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Sat, 06 Apr 2019 10:22:55 +0000</pubDate>
				<category><![CDATA[SSIS Amazon S3 Connection]]></category>
		<category><![CDATA[SSIS Amazon Storage Task]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[s3]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[storage]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=6707</guid>

					<description><![CDATA[<p>Introduction In this article, we will show SSIS Amazon S3 Storage task examples. Uploading files using Amazon S3 Storage Task or downloading files are common requirements in SSIS. In order to work with Amazon S3 Storage, Microsoft SSIS includes the Amazon S3 Storage Task that allows to upload files to Amazon S3 Storage, download files, creating [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/ssis-amazon-s3-storage-task-examples-download-upload-move-delete-files-folders/">SSIS Amazon S3 Storage Task examples (Download, Upload, Delete Files / Folders)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2><span id="Introduction_8211_Using_SSIS_SFTP_task_FTP_SFTP_FTPS">Introduction</span></h2>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/s3-e1553183075864.png"><img loading="lazy" decoding="async" class="wp-image-6547 size-full alignleft" src="https://zappysys.com/blog/wp-content/uploads/2019/03/s3-e1553183075864.png" alt="Amazon S3" width="150" height="150" /></a>In this article, we will show <strong>SSIS Amazon S3 Storage task examples</strong>. Uploading files using Amazon S3 Storage Task or downloading files are common requirements in SSIS. In order to work with Amazon S3 Storage, Microsoft SSIS includes the Amazon S3 Storage Task that allows to upload files to Amazon S3 Storage, download files, creating local and remote directories an more. In this article, we will show how to use the <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-task/" target="_blank" rel="noopener">SSIS Amazon S3 Storage task</a> included in ZappySys <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a>.</p>
<p>Amazon S3 Storage Task can be used to perform various operations with Amazon S3 Storage objects (files and containers) (e.g. Download, Upload, Copy, Move, Rename, Delete, etc). You can also get single property of any Amazon file or get a list of Amazon files as ADO.net Table and which can be easily looped through using ForEachLoop Task. Most of the operations in this task support recursive search using wild card pattern (e.g. Myfile*.txt).</p>
<h2><span id="Prerequisite"><span id="Requirements">Prerequisite<br />
</span></span></h2>
<ol>
<li>First, you will need to have SSIS installed</li>
<li>Secondly, make sure to have SSDT</li>
<li>You have obtained Amazon S3 account access key / secret key.</li>
<li>Finally, do not forget to install <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a></li>
</ol>
<h2><span id="What_is_Amazon_S3_Storage">What is Amazon S3 Storage</span></h2>
<p>Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance. This means customers of all sizes and industries can use it to store and protect any amount of data for a range of use cases, such as websites, mobile applications, backup and restore, archive, enterprise applications, IoT devices, and big data analytics. Amazon S3 provides easy-to-use management features so you can organize your data and configure finely-tuned access controls to meet your specific business, organizational, and compliance requirements. Amazon S3 is designed for 99.999999999% (11 9’s) of durability, and stores data for millions of applications for companies all around the world.</p>
<h2>Getting Started</h2>
<p>In order to start, we will show several examples. ZappySys includes an <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-task/" target="_blank" rel="noopener">SSIS Amazon S3 Storage Task</a> that will allow you to access files / folders from Amazon S3 Storage to the Local machine, Upload files(s) to Amazon S3 Storage. It will also support Delete, Rename, List, Get Property, Copy, Move, Create, Set Permission … and many more operations. Here we are showing you is, How to upload, download, move and delete files / folders from Amazon S3 Storage.</p>
<h2>SSIS Amazon S3 Storage Task Examples</h2>
<p>Let´s start with an example. In this SSIS Amazon S3 Storage Task File task example, we will upload, download, move and delete files / folders from Amazon S3 Storage.</p>
<ol>
<li>First of All, Drag and Drop Amazon S3 Storage Task from SSIS Toolbox and double click it to edit
<div id="attachment_6708" style="width: 706px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-add-s3-task.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6708" class="wp-image-6708 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-add-s3-task.png" alt="Drag and Drop Amazon S3 Storage Task" width="696" height="404" srcset="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-add-s3-task.png 696w, https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-add-s3-task-300x174.png 300w" sizes="(max-width: 696px) 100vw, 696px" /></a><p id="caption-attachment-6708" class="wp-caption-text">Drag and Drop Amazon S3 Storage Task</p></div></li>
<li>The following options are available in Amazon S3 Storage Task:
<div id="attachment_6709" style="width: 723px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-aws-s3-storage-task-options.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6709" class="wp-image-6709 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-aws-s3-storage-task-options.png" alt="Options to upload, download files in SSIS" width="713" height="689" srcset="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-aws-s3-storage-task-options.png 713w, https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-aws-s3-storage-task-options-300x290.png 300w" sizes="(max-width: 713px) 100vw, 713px" /></a><p id="caption-attachment-6709" class="wp-caption-text">Options to upload, download files in SSIS</p></div></li>
<li>You can also overwrite files and folder, skip all, overwrite if source is older, overwrite if the file size is different, rename files and more:
<div id="attachment_6678" style="width: 692px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/overwrite-action-ssis-za-am-task.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6678" class="wp-image-6678 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/03/overwrite-action-ssis-za-am-task.png" alt="Overwrite files in SSIS" width="682" height="492" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/overwrite-action-ssis-za-am-task.png 682w, https://zappysys.com/blog/wp-content/uploads/2019/03/overwrite-action-ssis-za-am-task-300x216.png 300w" sizes="(max-width: 682px) 100vw, 682px" /></a><p id="caption-attachment-6678" class="wp-caption-text">Overwrite files in SSIS</p></div></li>
<li>Let&#8217;s select the <strong>Download Amazon file(s) to local directory</strong>. Now select/add The Source path, Check Recursive Scan to get all the sub files and sub folders and it&#8217;s files and add Target Path, This option will download files. In Path AccessMode we can use Direct to write the path directly or to use an SSIS variable.
<div id="attachment_6735" style="width: 595px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-az-blob-aws-s3-download-files.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6735" class="wp-image-6735 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-az-blob-aws-s3-download-files.png" alt="ssis-az-blob-aws-s3-download-files" width="585" height="522" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-az-blob-aws-s3-download-files.png 585w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-az-blob-aws-s3-download-files-300x268.png 300w" sizes="(max-width: 585px) 100vw, 585px" /></a><p id="caption-attachment-6735" class="wp-caption-text">SSIS Amazon S3 Storage Task – Download files from Amazon S3 Storage</p></div></li>
<li>That&#8217;s it now execute the package and it will download all the files and sub folders from the Amazon S3 Storage Task to Local File Machine.</li>
<li>Now Let&#8217;s configure the task to upload the local directory files and folder to Amazon S3 Storage like below and execute the package. And also in this example i created the variable and stored target folder path in it and used that variable Target Path Variable.
<div id="attachment_6739" style="width: 592px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-az-blob-aws-s3-upload-files.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6739" class="wp-image-6739 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-az-blob-aws-s3-upload-files.png" alt="SSIS Amazon S3 Storage Task – Upload files from Amazon S3 Storage" width="582" height="523" /></a><p id="caption-attachment-6739" class="wp-caption-text">SSIS Amazon S3 Storage Task – Upload files from Amazon S3 Storage</p></div></li>
<li>Let&#8217;s configure the task to delete Amazon S3 Storage files like below and execute the package.
<div id="attachment_6743" style="width: 591px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-az-blob-aws-s3-delete-files.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6743" class="wp-image-6743 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-az-blob-aws-s3-delete-files.png" alt="SSIS Azure Blob Storage Task – Delete files from Azure Blob Storage" width="581" height="523" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-az-blob-aws-s3-delete-files.png 581w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-az-blob-aws-s3-delete-files-300x270.png 300w" sizes="(max-width: 581px) 100vw, 581px" /></a><p id="caption-attachment-6743" class="wp-caption-text">SSIS Amazon S3 Storage Task – Delete files from Amazon S3 Storage</p></div></li>
<li>Let&#8217;s configure the task to move Amazon S3 Storage files to another directory like below and execute the package.
<div id="attachment_6746" style="width: 566px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-az-blob-aws-s3-move-files.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6746" class="wp-image-6746 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-az-blob-aws-s3-move-files.png" alt="SSIS Azure Blob Storage Task – Move files from Azure Blob Storage" width="556" height="476" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-az-blob-aws-s3-move-files.png 556w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-az-blob-aws-s3-move-files-300x257.png 300w" sizes="(max-width: 556px) 100vw, 556px" /></a><p id="caption-attachment-6746" class="wp-caption-text">SSIS Amazon S3 Storage Task – Move files from Amazon S3 Storage</p></div></li>
<li>That&#8217;s it like upper examples you can configure Amazon S3 Storage Task to use it&#8217;s other options also.</li>
<li>Let&#8217;s see other SSIS Amazon S3 Storage Task examples in below sections</li>
</ol>
<h2>Working with advanced filters</h2>
<p>In order to understand filters, we will create an example for you. This time we will create SSIS Amazon S3 Storage task example to show how to exclude some files from the downloading process.</p>
<ol>
<li>In addition, it is also possible to add advanced filters to the SSIS Amazon S3 Storage task to exclude or include files and folders. The following example shows how to use the Advanced filters. In the <strong>Amazon S3 Storage Task, </strong>go to the Advanced Filter page and in Exclude RegX we will write \.exe$ to exclude the file with exe extension to be downloaded. You can use RegX (regular expressions) in the advanced filter:
<div id="attachment_6693" style="width: 691px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-working-with-advanced-filters.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6693" class="wp-image-6693 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-working-with-advanced-filters.png" alt="Advanced filters" width="681" height="487" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-working-with-advanced-filters.png 681w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-working-with-advanced-filters-300x215.png 300w" sizes="(max-width: 681px) 100vw, 681px" /></a><p id="caption-attachment-6693" class="wp-caption-text">Advanced filters</p></div></li>
</ol>
<p>&nbsp;</p>
<h2>Working with wildcards in SSIS Amazon S3 Storage task (Multiple files only)</h2>
<p>In order to understand wildcards, the new example will show how to work with Wildcards will help you to work with multiple files or folder with common characteristics.</p>
<ol>
<li>The following example shows how to copy all the files will all the extensions in the source folder. We use the *.*, which means that any file name with any extension will be downloaded:
<div id="attachment_6695" style="width: 690px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-working-with-wildcards.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6695" class="wp-image-6695 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-working-with-wildcards.png" alt="Working with Wildcards" width="680" height="487" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-working-with-wildcards.png 680w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-working-with-wildcards-300x215.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></a><p id="caption-attachment-6695" class="wp-caption-text">Working with Wildcards</p></div></li>
<li>If we want to download all the files with extension txt, use the following Path:<br />
<pre class="crayon-plain-tag">/source/*.txt;</pre>
</li>
<li>Another example would be to download all the files with the following names: file1.txt, file2.txt and file3.txt.  We could use the following Path:<br />
<pre class="crayon-plain-tag">/source/file?.txt</pre>
</li>
</ol>
<h2></h2>
<h2><strong>Working with SSIS expressions and variables in Amazon S3 Storage Task</strong></h2>
<p>In order to understand expressions, the following example will show how to work with SSIS expressions combined with variables in the SSIS Amazon S3 Storage task. In this example we will delete files in Amazon S3 Storage using variables and expressions.</p>
<div class="messageTextWrapper">
<p class="urlPreviewText">ZappySys Providers simple and powerful Placeholders. You can still use SSIS expression language. Placeholders allow direct Variable Use easy to see compared to hidden SSIS Expression (C# style). Placeholders have simple embedding use of variables.</p>
</div>
<ol>
<li> First, we will first create a variable in SSIS. In this example the file name is <strong>MyFile</strong> and the Value<strong> file1</strong>.
<div id="attachment_2994" style="width: 782px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/03/ssis.sftp-variable.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2994" class="size-full wp-image-2994" src="https://zappysys.com/blog/wp-content/uploads/2018/03/ssis.sftp-variable.png" alt="Create a SSIS variable" width="772" height="205" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/ssis.sftp-variable.png 772w, https://zappysys.com/blog/wp-content/uploads/2018/03/ssis.sftp-variable-300x80.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/03/ssis.sftp-variable-768x204.png 768w" sizes="(max-width: 772px) 100vw, 772px" /></a><p id="caption-attachment-2994" class="wp-caption-text">Create an SSIS variable</p></div></li>
<li>As a second step, we will write in path the value<strong> \destination\{{User.MyFile}}.txt. </strong>This will concatenate the folder destination with the variable MyFile. The task will delete the file1.txt from the Amazon S3 Storage folder.
<div id="attachment_6699" style="width: 687px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-working-with-variable-in-path.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6699" class="wp-image-6699 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-working-with-variable-in-path.png" alt="Using SSIS expressions" width="677" height="487" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-working-with-variable-in-path.png 677w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-working-with-variable-in-path-300x216.png 300w" sizes="(max-width: 677px) 100vw, 677px" /></a><p id="caption-attachment-6699" class="wp-caption-text">Using SSIS expressions</p></div></li>
<li>The next example will show how to create a Amazon S3 Storage file using expressions and variables in SSIS:
<div id="attachment_6700" style="width: 689px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-az-aws-task-create-file.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6700" class="wp-image-6700 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-az-aws-task-create-file.png" alt="Create file" width="679" height="481" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-az-aws-task-create-file.png 679w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-az-aws-task-create-file-300x213.png 300w" sizes="(max-width: 679px) 100vw, 679px" /></a><p id="caption-attachment-6700" class="wp-caption-text">Create file</p></div></li>
<li>Content to write is the content of the file. In <strong>Target, </strong>go to path and write the following: For more information on placeholders <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-format-specifiers.htm#A1" target="_blank" rel="noopener">check this post</a> and also check <a href="https://zappysys.zendesk.com/hc/en-us/articles/115004918633-How-to-format-Path-URL-using-date-time-format" target="_blank" rel="noopener">this post</a>.<br />
<pre class="crayon-plain-tag">/destination/{{User::FileName,MM-dd-yyyy}}</pre>
</li>
<li>We are using a variable in SSIS named FileName of type DateTime. We are concatenating the Amazon S3 Storage folder destination with the variable. As you can see, the expressions with ZappySys are very simple.</li>
</ol>
<h2>Example to verify if file exists in SSIS Amazon S3 Storage task</h2>
<p>Finally, we will verify if a file in Amazon S3 Storage exists or not using the SSIS Amazon S3 Storage task.</p>
<ol>
<li>In order to start, we will use the SSIS variables, create a variable of Boolean type named FileExists. In <strong>Storage Action, </strong>select <strong>Get Amazon file exist status. </strong>In path, select the path of the file to verify if it exists or not.
<div id="attachment_6749" style="width: 593px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-az-blob-aws-s3-file-exist.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6749" class="wp-image-6749 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-az-blob-aws-s3-file-exist.png" alt="SSIS Azure Blob Storage Task – Check File Exist in Azure Blob Storage" width="583" height="523" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-az-blob-aws-s3-file-exist.png 583w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-az-blob-aws-s3-file-exist-300x269.png 300w" sizes="(max-width: 583px) 100vw, 583px" /></a><p id="caption-attachment-6749" class="wp-caption-text">SSIS Amazon S3 Storage Task – Check File Exist in Amazon S3 Storage</p></div></li>
<li>Secondly, we will use the <strong>ZS Logging Task </strong>to check the value of the variable File Exists. This task will show the value of the variable in the log. Drag and drop the task and join it with the ZS Amazon S3 Storage Task:
<div id="attachment_6710" style="width: 272px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-aws-s3-to-log-task.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6710" class="wp-image-6710 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/04/ssis-aws-s3-to-log-task.png" alt="The SSIS Log task" width="262" height="268" /></a><p id="caption-attachment-6710" class="wp-caption-text">The SSIS Log task</p></div></li>
<li>In order to get the value, we will insert it in the Logging Task. To do that, insert the Variable and select the FileExists variable:
<div id="attachment_3005" style="width: 634px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/03/ssis-ftp-verify-folder-exists.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3005" class="size-full wp-image-3005" src="https://zappysys.com/blog/wp-content/uploads/2018/03/ssis-ftp-verify-folder-exists.png" alt="Configuring variable" width="624" height="501" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/ssis-ftp-verify-folder-exists.png 624w, https://zappysys.com/blog/wp-content/uploads/2018/03/ssis-ftp-verify-folder-exists-300x241.png 300w" sizes="(max-width: 624px) 100vw, 624px" /></a><p id="caption-attachment-3005" class="wp-caption-text">Add the variable in the task logging</p></div></li>
<li>Finally, run the package and verify the Output (you can use View and Output to see the output) and check the value of the Logging Task. If the file exists, the value will be true. If it does not exist, the value will be false.
<div id="attachment_3004" style="width: 1036px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/03/SFTP-read-variables.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3004" class="wp-image-3004 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/03/SFTP-read-variables.png" alt="Verify the value of the variable in the SSIS output" width="1026" height="234" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/SFTP-read-variables.png 1026w, https://zappysys.com/blog/wp-content/uploads/2018/03/SFTP-read-variables-300x68.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/03/SFTP-read-variables-768x175.png 768w, https://zappysys.com/blog/wp-content/uploads/2018/03/SFTP-read-variables-1024x234.png 1024w" sizes="(max-width: 1026px) 100vw, 1026px" /></a><p id="caption-attachment-3004" class="wp-caption-text">Verify the variable in Output</p></div></li>
</ol>
<h2>How to loop through Amazon S3 Storage files in SSIS</h2>
<p>You can also loop through files to perform custom action file by by. Amazon S3 Storage Task support Action to <strong>get File List as ADO.net Recordset</strong></p>
<p>To get File list from Amazon S3 Storage Server perform the following steps.</p>
<ol>
<li>From Storage Action select <strong><strong>Get Amazon files as ADO.net DataTable<br />
</strong></strong></p>
<div id="attachment_6703" style="width: 615px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-get-files-as-ado.net-datatable.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6703" class="wp-image-6703 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-get-files-as-ado.net-datatable.png" alt="Get files as ADO.net DataTable" width="605" height="295" srcset="https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-get-files-as-ado.net-datatable.png 605w, https://zappysys.com/blog/wp-content/uploads/2019/03/ssis-get-files-as-ado.net-datatable-300x146.png 300w" sizes="(max-width: 605px) 100vw, 605px" /></a><p id="caption-attachment-6703" class="wp-caption-text">Get files as ADO.net DataTable</p></div>
<p>&nbsp;</li>
<li>Create new Amazon S3 Storage Connection by clicking New next to connection dropdown.</li>
<li>Select Source Path (e.g  <strong>\myroot\folder\*.txt </strong> )</li>
<li>Select or create new SSIS Variable (e.g. <strong>varFiles</strong> ) which will hold file list result (Must be Object datatype variable).</li>
<li>Click OK to close.</li>
<li>Create 3 more SSIS variables to hold File Path (String), Name (String) and Size (Int32). We will use in the next step.</li>
<li>Now drag SSIS ForEach Loop Container Task from SSIS Toolbox</li>
<li>Edit Loop Task and Select <strong>Foreach ADO Enumerator</strong> from the Enumerator dropdown</li>
<li>Select variable (e.g. <strong><strong>varFiles)<br />
</strong></strong></p>
<div id="attachment_346" style="width: 635px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/02/ssis-looping-through-files-ado-net-recordset.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-346" class="wp-image-346 size-full" src="https://zappysys.com/blog/wp-content/uploads/2016/02/ssis-looping-through-files-ado-net-recordset.png" alt="Loop through files in SSIS using ForEach Loop Task (use ADO.net Recordset variable)" width="625" height="563" srcset="https://zappysys.com/blog/wp-content/uploads/2016/02/ssis-looping-through-files-ado-net-recordset.png 625w, https://zappysys.com/blog/wp-content/uploads/2016/02/ssis-looping-through-files-ado-net-recordset-300x270.png 300w" sizes="(max-width: 625px) 100vw, 625px" /></a><p id="caption-attachment-346" class="wp-caption-text">Loop through files in SSIS using ForEach Loop Task (use ADO.net Recordset variable)</p></div></li>
<li>Click on Variable Mappings Tab and configure like below.
<div id="attachment_345" style="width: 582px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/02/ssis-looping-through-files-ado-net-recordset-variable-mapping.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-345" class="size-full wp-image-345" src="https://zappysys.com/blog/wp-content/uploads/2016/02/ssis-looping-through-files-ado-net-recordset-variable-mapping.png" alt="Variable Mappings for ForEach Loop Task - Loop through files in a folder using SSIS" width="572" height="272" srcset="https://zappysys.com/blog/wp-content/uploads/2016/02/ssis-looping-through-files-ado-net-recordset-variable-mapping.png 572w, https://zappysys.com/blog/wp-content/uploads/2016/02/ssis-looping-through-files-ado-net-recordset-variable-mapping-300x143.png 300w" sizes="(max-width: 572px) 100vw, 572px" /></a><p id="caption-attachment-345" class="wp-caption-text">Variable Mappings for ForEach Loop Task &#8211; Loop through files in a folder using SSIS</p></div></li>
<li>Drag ZS Logging Task and place inside Loop and Display variables</li>
<li>That&#8217;s it</li>
</ol>
<p>For more information to <a href="//zappysys.com/blog/get-list-of-files-and-folders-in-ssis-for-looping/" target="_blank" rel="noopener">loop through files on local machine using SSIS check this article</a>.</p>
<h2>Conclusion</h2>
<p>To conclude, we can say that working with Amazon S3 Storage is now very simple. In this article, we looked at SSIS Amazon S3 Storage Task examples on how to upload, download, delete files and folders. We used variables, wildcards and expressions. If you liked the tasks you can start using them by downloading SSIS PowerPack from our <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">web site here</a>. We saw different SSIS Amazon S3 Storage Task examples to understand how to use the task in different scenarios.</p>
<p>Thanks for your time.</p>
<h2>References</h2>
<ul>
<li><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">About SSIS PowerPack</a></li>
<li><a href="https://docs.microsoft.com/en-us/sql/integration-services/expressions/integration-services-ssis-expressions" target="_blank" rel="noopener">Integration Services (SSIS) Expressions</a></li>
<li>Help File : <a href="https://zappysys.com/onlinehelp/ssis-powerpack/index.htm#page=amazon-s3-storage-task.htm" target="_blank" rel="noopener">Amazon Storage Task</a></li>
</ul>
<p>The post <a href="https://zappysys.com/blog/ssis-amazon-s3-storage-task-examples-download-upload-move-delete-files-folders/">SSIS Amazon S3 Storage Task examples (Download, Upload, Delete Files / Folders)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Setting Metadata key / value in SSIS Amazon S3 / Azure Storage Task</title>
		<link>https://zappysys.com/blog/setting-metadata-key-value-ssis-amazon-s3-azure-storage-task/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Thu, 17 Jan 2019 15:21:54 +0000</pubDate>
				<category><![CDATA[SSIS Amazon Storage Task]]></category>
		<category><![CDATA[SSIS Azure Blob Storage Task]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[azure]]></category>
		<category><![CDATA[s3]]></category>
		<category><![CDATA[ssis]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=6107</guid>

					<description><![CDATA[<p>Introduction In this post we will see how to set Metadata key/value in Azure Blob Storage Task and Amazon Storage Task (S3 Task). We will also see how to set them dynamically at runtime (Use SSIS Expression). Set Amazon S3 Task Metadata (Key / Value Pairs) Here is how you can set Metadata in Amazon [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/setting-metadata-key-value-ssis-amazon-s3-azure-storage-task/">Setting Metadata key / value in SSIS Amazon S3 / Azure Storage Task</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p>In this post we will see how to set Metadata key/value in <a href="https://zappysys.com/products/ssis-powerpack/ssis-azure-blob-storage-task/">Azure Blob Storage Task</a> and <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-task/">Amazon Storage Task (S3 Task)</a>. We will also see how to set them dynamically at runtime (Use SSIS Expression).</p>
<div class="content_block" id="custom_post_widget-2523"><h2><span id="Prerequisites">Prerequisites</span></h2>
Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:
<ol style="margin-left: 1.5em;">
 	<li><abbr title="SQL Server Integration Services">SSIS</abbr> designer installed. Sometimes it is referred to as <abbr title="Business Intelligence Development Studio">BIDS</abbr> or <abbr title="SQL Server Data Tools">SSDT</abbr> (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from the Microsoft site</a>).</li>
 	<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
 	<li>Make sure <span style="text-decoration: underline;"><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a></span> is installed (<a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">download it</a>, if you haven't already).</li>
 	<li>(<em>Optional step</em>)<em>.</em> <a href="https://zappysys.zendesk.com/hc/en-us/articles/360035974593" target="_blank" rel="noopener">Read this article</a>, if you are planning to deploy packages to a server and schedule their execution later.</li>
</ol></div>
<h2>Set Amazon S3 Task Metadata (Key / Value Pairs)</h2>
<p>Here is how you can set Metadata in Amazon S3 Task.</p>
<div style="width: 525px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="figureimage" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-s3-task/ui-amazon-s3-task-metadata.png" alt="Setting Amazon S3 Metadata (Key/Value Pairs) in SSIS Amazon Storage Task" width="515" height="333" /><p class="wp-caption-text">Setting Amazon S3 Metadata (Key/Value Pairs) in SSIS Amazon Storage Task</p></div>
<h2>Set Azure Blob Storage Task Metadata (Key / Value Pairs)</h2>
<p>Just like S3 Task you can use same UI in Azure blob storage task too.</p>
<h2>Set Metadata Key/Value Dynamically (SSIS Expression)</h2>
<p>So far you have set metadata using static value. What if you have to set Dynamically at runtime?</p>
<p>Basically Metadata is passed as XML Format in the task like below.</p><pre class="crayon-plain-tag">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;ArrayOfStringKeyValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
	&lt;StringKeyValue&gt;
		&lt;Key&gt;x-amz-key1&lt;/Key&gt;
		&lt;Value&gt;AAAAAAA&lt;/Value&gt;
	&lt;/StringKeyValue&gt;
	&lt;StringKeyValue&gt;
		&lt;Key&gt;x-amz-key2&lt;/Key&gt;
		&lt;Value&gt;BBBBBBB&lt;/Value&gt;
	&lt;/StringKeyValue&gt;	
&lt;/ArrayOfStringKeyValue&gt;</pre><p>
Whate we will do is take above format and make it dynamic using SSIS Expression.</p>
<p>Perform the following steps for that.</p>
<ol>
<li>Select your Amazon Storage Task or Azure Storage Task and right click &gt; Select Properties.</li>
<li>In the Properties Grid check Property name MetadataKeyValue. Copy XML Value from there (We will use it in expression)</li>
<li>Now double click Amazon Storage Task or Azure Storage Task</li>
<li>Click on Expression Button</li>
<li>Select MetadataKeyValue property and for Value enter below expression&#8230; Use previously copied XML text  and change Value part with your own SSIS variable. In below example we are passing Just one Metadata Key/Value pair ( Name=x-amz-meta-filename  , Value=Coming from @[User::MyFileNameVariable] )<br />
Note that we have escaped double quote with <pre class="crayon-plain-tag">\"</pre>  and replaced static value with <pre class="crayon-plain-tag">&lt;Value&gt;" + @[User::MyFileNameVariable] + "&lt;/Value&gt;</pre> .<br />
<pre class="crayon-plain-tag">"&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;"
+ "&lt;ArrayOfStringKeyValue xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"&gt;"
+ "	&lt;StringKeyValue&gt;"
+ "		&lt;Key&gt;x-amz-meta-file-name&lt;/Key&gt;"
+ "		&lt;Value&gt;" + @[User::MyFileNameVariable] + "&lt;/Value&gt;"
+ "	&lt;/StringKeyValue&gt;"
+ "	&lt;StringKeyValue&gt;"
+ "		&lt;Key&gt;x-amz-meta-something&lt;/Key&gt;"
+ "		&lt;Value&gt;BBBBBBB&lt;/Value&gt;"
+ "	&lt;/StringKeyValue&gt;"	
+ "&lt;/ArrayOfStringKeyValue&gt;"</pre>
<div id="attachment_6108" style="width: 1090px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/01/ssis-amazon-s3-storage-metadata-dynamic-expression.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6108" class="size-full wp-image-6108" src="https://zappysys.com/blog/wp-content/uploads/2019/01/ssis-amazon-s3-storage-metadata-dynamic-expression.png" alt="Set Amazon S3 File Metadata Key/Value dynamically" width="1080" height="892" srcset="https://zappysys.com/blog/wp-content/uploads/2019/01/ssis-amazon-s3-storage-metadata-dynamic-expression.png 1080w, https://zappysys.com/blog/wp-content/uploads/2019/01/ssis-amazon-s3-storage-metadata-dynamic-expression-300x248.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/01/ssis-amazon-s3-storage-metadata-dynamic-expression-768x634.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/01/ssis-amazon-s3-storage-metadata-dynamic-expression-1024x846.png 1024w" sizes="(max-width: 1080px) 100vw, 1080px" /></a><p id="caption-attachment-6108" class="wp-caption-text">Set Amazon S3 File Metadata Key/Value dynamically</p></div></li>
<li> Click OK and that&#8217;s it.</li>
</ol>
<p>The post <a href="https://zappysys.com/blog/setting-metadata-key-value-ssis-amazon-s3-azure-storage-task/">Setting Metadata key / value in SSIS Amazon S3 / Azure Storage Task</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Copy Amazon S3 Files in SSIS to different AWS Account</title>
		<link>https://zappysys.com/blog/copy-amazon-s3-files-ssis-different-aws-account/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Mon, 29 Oct 2018 21:12:58 +0000</pubDate>
				<category><![CDATA[SSIS Amazon Storage Task]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[s3]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=5251</guid>

					<description><![CDATA[<p>Introduction In our previous blog we saw how to upload data to Amazon S3 now let&#8217;s look at how to Copy Amazon Files from one AWS account to another AWS account (Server Side Copy) using SSIS Amazon Storage Task. (Must be version v2.7.9 or higher) If you are doing file copy within same account then there [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/copy-amazon-s3-files-ssis-different-aws-account/">Copy Amazon S3 Files in SSIS to different AWS Account</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p>In our previous blog we saw how to <a href="https://zappysys.com/blog/load-data-sql-server-to-amazon-s3/" target="_blank" rel="noopener">upload data to Amazon S3</a> now let&#8217;s look at how to Copy Amazon Files from one AWS account to another AWS account (Server Side Copy) using <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-task/" target="_blank" rel="noopener">SSIS Amazon Storage Task</a>. (Must be version <strong>v2.7.9</strong> or higher)</p>
<p>If you are doing file copy within same account then there is no issue. Just use Copy File feature. However if you want to copy between multiple AWS Accounts (e.g. Your Company AWS account to Vendor AWS Account) then you have to perform extra steps.</p>
<div class="content_block" id="custom_post_widget-2523"><h2><span id="Prerequisites">Prerequisites</span></h2>
Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:
<ol style="margin-left: 1.5em;">
 	<li><abbr title="SQL Server Integration Services">SSIS</abbr> designer installed. Sometimes it is referred to as <abbr title="Business Intelligence Development Studio">BIDS</abbr> or <abbr title="SQL Server Data Tools">SSDT</abbr> (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from the Microsoft site</a>).</li>
 	<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
 	<li>Make sure <span style="text-decoration: underline;"><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a></span> is installed (<a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">download it</a>, if you haven't already).</li>
 	<li>(<em>Optional step</em>)<em>.</em> <a href="https://zappysys.zendesk.com/hc/en-us/articles/360035974593" target="_blank" rel="noopener">Read this article</a>, if you are planning to deploy packages to a server and schedule their execution later.</li>
</ol></div>
<h2>Amazon S3 File Copy Scenario</h2>
<p>Now let&#8217;s think about a scenario where you have to copy some files from Account-A to Account-B. Account-B can be owned by totally different company (may be your Vendor) and you don&#8217;t have security control of it.</p>
<p>Before we can copy from Account-A to Account-B we first have to Configure permissions in Account-B. Basically when you use SSIS S3 Task for Copy operation it uses Source account (i.e. Account-A) to push files to destination account (Account-B). So you have Allow write permission for Source Account-A in Destination AWS Bucket (i.e. Account-B).</p>
<h2>Find Canonical ID of Source Account</h2>
<ol>
<li>First login to Account-A and findout Canonical ID (Usually 64-digit long)</li>
<li>To get Canonical ID click on <strong>Your Account Name</strong> &gt; <strong>My Security Credentials</strong></li>
<li>When prompted click <strong>Continue to Security Credentials</strong> option.</li>
<li>Expand Account Identifier and copy Canonical ID
<div id="attachment_5263" style="width: 847px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/10/amazon-aws-get-canonical-user-id-for-account.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5263" class="size-full wp-image-5263" src="https://zappysys.com/blog/wp-content/uploads/2018/10/amazon-aws-get-canonical-user-id-for-account.png" alt="How to find AWS Account ID and Canonical User ID" width="837" height="588" srcset="https://zappysys.com/blog/wp-content/uploads/2018/10/amazon-aws-get-canonical-user-id-for-account.png 837w, https://zappysys.com/blog/wp-content/uploads/2018/10/amazon-aws-get-canonical-user-id-for-account-300x211.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/10/amazon-aws-get-canonical-user-id-for-account-768x540.png 768w" sizes="(max-width: 837px) 100vw, 837px" /></a><p id="caption-attachment-5263" class="wp-caption-text">How to find AWS Account ID and Canonical User ID</p></div></li>
</ol>
<h2>Configure Target S3 Bucket Permissions to allow Source Account (Write Access)</h2>
<p>Now once you have Source account Canonical User ID, you can proceed to next step.</p>
<ol>
<li>Log in to Target account (i.e. Account B). Where you like to copy files.</li>
<li>Go to S3 Area and Click on the target bucket where you like to copy files</li>
<li>Go to Security Tab</li>
<li>Add Source Account Canonical ID and Check <strong>Write Permission</strong> (List is Optional for most).
<div id="attachment_5264" style="width: 998px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/10/grant-s3-bucket-permission-different-aws-account.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5264" class="size-full wp-image-5264" src="https://zappysys.com/blog/wp-content/uploads/2018/10/grant-s3-bucket-permission-different-aws-account.png" alt="Give Write permission in Target AWS S3 Bucket (Enter Amazon Source Account Canonical User ID)" width="988" height="491" srcset="https://zappysys.com/blog/wp-content/uploads/2018/10/grant-s3-bucket-permission-different-aws-account.png 988w, https://zappysys.com/blog/wp-content/uploads/2018/10/grant-s3-bucket-permission-different-aws-account-300x149.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/10/grant-s3-bucket-permission-different-aws-account-768x382.png 768w" sizes="(max-width: 988px) 100vw, 988px" /></a><p id="caption-attachment-5264" class="wp-caption-text">Give Write permission in Target AWS S3 Bucket (Enter Amazon Source Account Canonical User ID)</p></div></li>
</ol>
<h2>Copy Amazon S3 Files from one Account Bucket to Another</h2>
<p>Now once you configure permission on target bucket. We are ready to execute Amazon S3 File Copy Operation in SSIS</p>
<ol>
<li>Open SSIS Package in Visual Studio</li>
<li>Drag ZS Amazon Storage Task from SSIS Toolbox</li>
<li>Double click it to configure</li>
<li>Select Copy File Operation from Action Dropdown</li>
<li>Click New for Source Connection (Enter Source Account Credentials). Click Test and OK to save.</li>
<li>Now Click Browse to Select Source Files you like to Copy. You can use Wild card pattern for multiple file copy.<br />
Example:  <strong>mysourcebucket/subfolder/localsubfile*.csv</strong></li>
<li>Click New for Target Connection (Enter Target Account Credentials). Click Test and OK to save.</li>
<li>Now Click Browse to Select Target Folder Location where you like to Save Copied files.<br />
Example:  <strong>mytargetbucket/somefolder/</strong></li>
<li>Click OK to Save</li>
<li>Execute SSIS Package to test</li>
</ol>
<div id="attachment_5265" style="width: 815px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/10/ssis-copy-amazon-s3-files-between-multiple-s3-accounts-buckets.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5265" class="size-full wp-image-5265" src="https://zappysys.com/blog/wp-content/uploads/2018/10/ssis-copy-amazon-s3-files-between-multiple-s3-accounts-buckets.png" alt="Copy Amazon S3 Files using SSIS (Copy Files between multiple Accounts / S3 Buckets) " width="805" height="583" srcset="https://zappysys.com/blog/wp-content/uploads/2018/10/ssis-copy-amazon-s3-files-between-multiple-s3-accounts-buckets.png 805w, https://zappysys.com/blog/wp-content/uploads/2018/10/ssis-copy-amazon-s3-files-between-multiple-s3-accounts-buckets-300x217.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/10/ssis-copy-amazon-s3-files-between-multiple-s3-accounts-buckets-768x556.png 768w" sizes="(max-width: 805px) 100vw, 805px" /></a><p id="caption-attachment-5265" class="wp-caption-text">Copy Amazon S3 Files using SSIS (Copy Files between multiple Amazon Accounts / S3 Buckets)</p></div>
<h2><span id="Conclusion">Conclusion</span></h2>
<p>In this post you have seen how easy it is to copy S3 Files between multiple AWS accounts in few clicks. <a href="https://zappysys.com/products/ssis-powerpack/">Try SSIS PowerPack</a> for free and find out yourself how easy it is to Automate Amazon S3 related operations in SSIS.</p>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/copy-amazon-s3-files-ssis-different-aws-account/">Copy Amazon S3 Files in SSIS to different AWS Account</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to delete Amazon S3 File / Folder / Bucket in SSIS</title>
		<link>https://zappysys.com/blog/ssis-delete-amazon-s3-file-folder-bucket/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Thu, 20 Sep 2018 13:15:50 +0000</pubDate>
				<category><![CDATA[SSIS Amazon Storage Task]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[s3]]></category>
		<category><![CDATA[ssis]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=4890</guid>

					<description><![CDATA[<p>Introduction In our previous posts we looked at how to use SSIS Amazon Storage Task (Amazon S3 Task) to automate some Amazon S3 related tasks in SSIS. In this blog post will continue discovering more use cases. Let&#8217;s learn how to delete Amazon S3 File, delete Amazon S3 Folder and delete Amazon S3 Bucket. Deleting S3 Files [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/ssis-delete-amazon-s3-file-folder-bucket/">How to delete Amazon S3 File / Folder / Bucket in SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p><img loading="lazy" decoding="async" class="size-full alignleft" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-s3-task/ssis-amazon-s3-cloud-task.png" width="128" height="128" />In our <a href="https://zappysys.com/blog/category/ssis/tasks/ssis-amazon-storage-task/" target="_blank" rel="noopener">previous posts</a> we looked at how to use <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-task/" target="_blank" rel="noopener">SSIS Amazon Storage Task (Amazon S3 Task)</a> to automate some Amazon S3 related tasks in SSIS. In this blog post will continue discovering more use cases. Let&#8217;s learn how to delete Amazon S3 File, delete Amazon S3 Folder and delete Amazon S3 Bucket.</p>
<p>Deleting S3 Files are straight forward using <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-task/" target="_blank" rel="noopener">SSIS Amazon Storage Task (Amazon S3 Task</a> but deleting Bucket or Folders require some additional checks and steps, so let&#8217;s look at that in depth.</p>
<h2></h2>
<h2></h2>
<h2>Requirements</h2>
<p>Before we look into Step-By-Step section to call Amazon S3 related operations in SSIS let’s make sure you met the following requirements.</p>
<ol>
<li>SSIS designer installed. Sometimes it is referred as BIDS or SSDT (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from Microsoft site</a>).</li>
<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
<li><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack installed</a>. Click on the link to download a FREE trial.</li>
<li>You have obtained Amazon S3 account access key / secret key.</li>
</ol>
<h2>Configure SSIS Amazon S3 Connection</h2>
<p>Before we perform any S3 related action, you must configure <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/amazon-storage-connection-manager.htm" target="_blank" rel="noopener">Amazon Storage Connection</a>. This connection manager support connectivity to not only S3 Storage but also other AWS Storage such as <a href="https://zappysys.com/blog/tag/dynamodb/" target="_blank" rel="noopener">DynamoDB</a>, <a href="https://zappysys.com/blog/tag/redshift/" target="_blank" rel="noopener">Redshift</a></p>
<p>There are two ways you can create Amazon Storage Connection Manager in SSIS designer. You can right click in Connection Manager Panel and create new <strong>ZS-AMAZON-STORAGE</strong> connection type or use Task UI and click New connection.</p>
<p>For now, we will use easier method which is Create S3 Connection from S3 Storage Task UI.</p>
<ol>
<li>Open SSIS Package</li>
<li>Drag ZS Amazon S3 Storage Task from the toolbox</li>
<li>Double click it to edit. You can now click on New Connection like below.
<div style="width: 539px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-s3-task/configure-ssis-amazon-s3-storage-task-2.png" alt="Create New Amazon S3 Connection from Task UI" width="529" height="255" /><p class="wp-caption-text">Create New Amazon S3 Connection from Task UI</p></div></li>
<li>On the connection Manager UI. Select S3 as service type. Enter your Access Key, Secret Key and Select Region. We also support IAM Role for EC2 instances (For this package must run inside EC2 VM). <a href="https://zappysys.zendesk.com/hc/en-us/articles/360009749954-How-to-use-IAM-role-for-Amazon-S3-related-operations-in-SSIS" target="_blank" rel="noopener">Check this article</a>.
<div style="width: 590px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-s3-task/configure-ssis-amazon-s3-storage-task-3.png" alt="Configure SSIS Amazon S3 Connection - Select Region, Enter Access Key / Secret Key" width="580" height="508" /><p class="wp-caption-text">Configure SSIS Amazon S3 Connection &#8211; Select Region, Enter Access Key / Secret Key</p></div></li>
<li>Click Test connection to confirm its working. Click OK to Save Connection Manager UI.</li>
<li>Back to Task UI click OK to close save (We will configure task in later sections.</li>
</ol>
<h2>Using SSIS Amazon S3 Task for common actions</h2>
<p>Before we deep dive in delete scenarios let&#8217;s first look at what is  <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-task/" target="_blank" rel="noopener">SSIS Amazon Storage Task (Amazon S3 Task)</a>. This task is developed to achieve many S3 related operations. See below screenshot to get idea about many actions you can perform using just one task. In this post we will focus only on delete actions (for file, folder and bucket). In other posts we will cover different operations in depth.</p>
<div style="width: 610px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-s3-task/ssis-amazon-s3-storage task-operations-upload-download-delete-list-get-create-file-bucket.png" alt="SSIS Amazon S3 Task Operations - Upload, Download, Delete, Create, List, Rename Files, Folders, Buckets" width="600" height="587" /><p class="wp-caption-text">SSIS Amazon S3 Task Operations &#8211; Upload, Download, Delete, Create, List, Rename Files, Folders, Buckets</p></div>
<h2>Delete Amazon S3 Files</h2>
<p>Once you have configured SSIS S3 Connection Manager, we can perform different S3 related operations using many different Amazon S3 related tasks / components. For now let&#8217;s just look at how to delete files from S3 bucket.</p>
<h3>Delete Multiple S3 files &#8211; Using Simple Pattern Search (wildcard)</h3>
<p>Here is how to delete amazon s3 file / files using wildcard pattern search. Using * or ? allowed. (Example  SalesOrder_*.??? )</p>
<div id="attachment_4904" style="width: 612px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-delete-amazons3-file-multiple.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4904" class="size-full wp-image-4904" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-delete-amazons3-file-multiple.png" alt="Delete Amazon S3 File (Multiple) using Wildcard pattern" width="602" height="360" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-delete-amazons3-file-multiple.png 602w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-delete-amazons3-file-multiple-300x179.png 300w" sizes="(max-width: 602px) 100vw, 602px" /></a><p id="caption-attachment-4904" class="wp-caption-text">Delete Amazon S3 File (Multiple) using Wildcard pattern</p></div>
<h3>Delete Multiple S3 files &#8211; Using Advanced Search &#8211; Regex / SQL Expression</h3>
<p>Sometimes it&#8217;s necessary to filter file based on advanced attributes such as file Age (How old), File Size, Multiple File Patterns (e.g. Delete *.zip, *.gz, *.rar in one action)</p>
<p>You can use Advanced Tab to filter further. First supply primary filter on Source Tab (e.g. mybucket/*.* ) and then supply your advanced filter (e.g. you can exclude *.exe and *.msi file from your delete list as below screenshot, also only delete files between 1000 and 50000 bytes in file size).</p>
<div style="width: 686px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-s3-task/amazon-s3-file-file-advanced-search-regx-pattern.png" alt="Advanced Search in SSIS Amazon S3 Task - Use Regular Expression Patterns, SQL like expression for Sort / Filter" width="676" height="540" /><p class="wp-caption-text">Advanced Search in SSIS Amazon S3 Task &#8211; Use Regular Expression Patterns, SQL like expression for Sort / Filter</p></div>
<p>&nbsp;</p><pre class="crayon-plain-tag">//////////////////////////////
Examples:
//////////////////////////////
AgeInDays &lt; 5  //Get files created in last 5 days
LastEditInDays &gt; 3 //Get files modified before 3 days
AgeInDays &gt; 10 AND LastEditInDays &lt; 3  //Get files created before 10 days and modified in last 3 days
Size &lt; 1024  //Get files where File size is less than 1024 bytes
CreationDate BETWEEN #2015-01-01# AND #2015-01-01#   
Name IN ('File1.txt', 'Download.msi')
FullPath LIKE 'mybucket\somefolder\month_*')
Extension IN ('.txt','.csv')
LastModifiedDate &gt; #2013-01-01T16:00:00#
IsReadOnly = True
/////////////////////////////////////////
//Supported Columns for expression:
/////////////////////////////////////////
Name, FullPath, Extension, FolderPath, AgeInDays, LastEditInDays, Size, CreationDate, CreationDateUtc, LastModifiedDate, LastModifiedDateUtc, IsReadOnly</pre><p>
<h2></h2>
<h3>Delete Amazon S3 files older than X days</h3>
<p>If you like to delete files older than certain days then use below technique.</p>
<ol>
<li>First Specify primary search criteria on Source tab</li>
<li>Go to Advanced Filter Tab and specify Following Pattern in <strong>Where</strong> Textbox (For example delete Files older than 10 days )<br />
<pre class="crayon-plain-tag">AgeInDays &gt; 10</pre>
</li>
</ol>
<p>&nbsp;</p>
<h2>Delete Amazon S3 Bucket</h2>
<p>Now let&#8217;s look at how to delete Amazon S3 Bucket including all its content. There is an option to delete Bucket but it wont delete files and empty folders. So you have to first clear all its content before calling Delete bucket action.</p>
<p>Here is high level steps to delete bucket in SSIS using ZappySys S3 Task.</p>
<ol>
<li>First call Delete S3 Files Action using Source Path = <strong>mybucket/*.</strong> Delete file action won&#8217;t delete any real folders (i.e. name ends with slash).</li>
<li>Once files are deleted from bucket you can get list of empty folders
<ol>
<li>Select Action = Get Amazon folder list as ADO.net Table</li>
<li>In the path enter Path = <strong>mybucket/*</strong></li>
<li>In the Result Variable Create or Select variable (e.g. User::FolderList)</li>
</ol>
</li>
<li>Use ForEachLoop Task to Delete empty folders (Use <strong>Delete File Action</strong> because there is no folder concept in S3. File name ends with slash is treated as folder)
<ol>
<li>In the ForEachLoop Task select enumerator as  <strong>Foreach ADO enumerator</strong></li>
<li>In the variable select a variable which holds list of folders (obtained in previous step)</li>
<li>On the Variable Mappings Tab. Select Some variable (e.g. User::FolderPath) to map to Index =0</li>
<li>Drag new S3 Task inside ForEachLoop and Select <strong>Delete File Action</strong></li>
<li>In the File Path enter variable as {{User::FolderPath}}  (or whatever name you given which holds iteration FolderPath in previous step)</li>
</ol>
</li>
<li>Call Delete Bucket Action once bucket is totally empty.</li>
</ol>
<div id="attachment_4905" style="width: 315px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-delete-amazon-s3-bucket-including-files-folders.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4905" class="size-full wp-image-4905" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-delete-amazon-s3-bucket-including-files-folders.png" alt="Delete Amazon S3 Bucket (including files and folders)" width="305" height="549" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-delete-amazon-s3-bucket-including-files-folders.png 305w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-delete-amazon-s3-bucket-including-files-folders-167x300.png 167w" sizes="(max-width: 305px) 100vw, 305px" /></a><p id="caption-attachment-4905" class="wp-caption-text">Delete Amazon S3 Bucket (including files and folders)</p></div>
<h2>Delete Amazon S3 Folders</h2>
<p>There is no real folder concept in Amazon S3 file system. S3 File System is just key / value system. Key is basically file name (e.g. somefolder/subfolder/myfile.txt). You can use slash in name to indicate hierarchy which can be used by some client apps like ZappySys S3 File Picker to Mimic Treeview like structure so user feel like real file system but there are no rules if you have to use slash or not.</p>
<p>Most client tools for S3 treats any file name ends with slash as real folder.  See below step to delete amazon s3 folder (real folder which was created explicitly &#8211; mentioned in next section).</p>
<ol>
<li>Open S3 Task and select action = Delete Amazon File(s)</li>
<li>In the path enter your Folder Path (e.g. mybucketname/output/sub2/ )</li>
</ol>
<h2>Create Amazon S3 Folder</h2>
<p>Some time you may want to create real S3 folder which is not treated as file. In that case <a href="https://zappysys.zendesk.com/hc/en-us/articles/360009493993-How-to-create-folder-in-Amazon-S3-Bucket-using-SSIS" target="_blank" rel="noopener">use this technique</a> to create s3 folder.</p>
<p><img decoding="async" src="https://zappysys.zendesk.com/hc/article_attachments/360013007793/ssis-amazon-s3-create-new-folder-in-bucket.png" /></p>
<p>&nbsp;</p>
<h2>Conclusion</h2>
<p>In this post we saw how easy it is to use <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-task/" target="_blank" rel="noopener">SSIS Amazon Storage Task (Amazon S3 Task)</a> to delete Amazon S3 file, folder and bucket. You can also perform other common amazon storage related actions (e.g. Upload / Download / Create / List ). <a href="https://zappysys.com/products/ssis-powerpack/">Download SSIS PowerPack</a> to try this component and <strong>70+ other tasks / components</strong> which are not covered in this article.</p>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/ssis-delete-amazon-s3-file-folder-bucket/">How to delete Amazon S3 File / Folder / Bucket in SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Using Regular Expressions in SSIS</title>
		<link>https://zappysys.com/blog/using-regular-expressions-in-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Wed, 07 Mar 2018 17:38:24 +0000</pubDate>
				<category><![CDATA[SSIS Advanced File System Task]]></category>
		<category><![CDATA[SSIS Amazon Storage Task]]></category>
		<category><![CDATA[SSIS Azure Blob Storage Task]]></category>
		<category><![CDATA[SSIS Regex Parser Task]]></category>
		<category><![CDATA[SSIS SFTP Task]]></category>
		<category><![CDATA[SSIS Tasks]]></category>
		<category><![CDATA[SSIS Tips & How-Tos]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[Regular Expression]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=2858</guid>

					<description><![CDATA[<p>Introduction In this short article, you will learn how to write Regular expressions in SSIS (i.e. Regex) and what tool to use to test them. You will also find helpful resources on how to write more sophisticated expressions and learn more about them. For demo purposes, we will use FREE SSIS Regex Parser Task to parse and [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/using-regular-expressions-in-ssis/">Using Regular Expressions in SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2018/03/ssis-regex-parser-task.png"><img loading="lazy" decoding="async" class=" wp-image-2974 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2018/03/ssis-regex-parser-task.png" alt="" width="114" height="114" /></a>In this short article, you will learn how to write Regular expressions in SSIS (i.e. Regex) and what tool to use to test them. You will also find helpful resources on how to write more sophisticated expressions and learn more about them. For demo purposes, we will use <strong>FREE</strong> <a href="https://zappysys.com/products/ssis-powerpack/ssis-regex-parser-task/" target="_blank" rel="noopener">SSIS Regex Parser Task</a> to parse and extract the text using Regex.</p>
<p>&nbsp;</p>
<p>You can use Regular expressions in several SSIS PowerPack connectors:</p>
<ul>
<li><a href="https://zappysys.com/products/ssis-powerpack/ssis-regex-parser-task/" target="_blank" rel="noopener">SSIS Regex Parser Task (FREE)</a>,</li>
<li><a href="https://zappysys.com/products/ssis-powerpack/ssis-azure-blob-storage-task/" target="_blank" rel="noopener">Azure Blob Storage Task</a>,</li>
<li><a href="https://zappysys.com/products/ssis-powerpack/ssis-file-system-task-advanced/" target="_blank" rel="noopener">Advanced File System Task</a>,</li>
<li><a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-task/" target="_blank" rel="noopener">Amazon S3 Storage Task</a> and others.</li>
</ul>
<h2>Writing Regular Expressions in SSIS</h2>
<p>Based on the SSIS component you use it will include the filename in filtering options or match the text: See below Syntax to write Regex in ZappySys tools. We support additional construct {{X, Y}} at the end of Regex to control two parameters. This additional construct is useful for data extracted from matching regex. If you want to Test patterns and not worry about data extraction then no need to use last {{<pre class="crayon-plain-tag">Occurance_Index</pre>, <pre class="crayon-plain-tag">Group_Index_Or_Name</pre>}}</p>
<p><strong>Syntax:</strong><br />
<pre class="crayon-plain-tag">&lt;your Regular Expression&gt;[{{Occurance_Index|*[,Group_Index_Or_Name]}}]</pre>
<p><strong>Where:</strong><br />
<pre class="crayon-plain-tag">Occurance_Index</pre>=Occurrence index you want to extract (X=0 means the first match) and * means all matches. Use a minus sign to get an occurrence from reverse (e.g. {{-0}} returns the last match)<br />
<pre class="crayon-plain-tag">Group_Index_Or_Name</pre>=Group index/name within your search pattern (Groups are indicated by parentheses in regular expression, Y=0 means first group). If you named your group in the pattern then you can use the Group name. To use Group Name you must use the new version (the old version doesn&#8217;t support this)</p>
<p><strong>How to name a group?</strong></p>
<p>E.g. (\w+)@(<strong>?&lt;domain&gt;</strong>\w+.com)</p>
<p><strong>How to use the group name in the match extract?</strong></p>
<p>E.g. (\w+)@(<strong>?&lt;domain&gt;</strong>\w+.com){{0,<strong>domain</strong>}}</p>
<p><strong>Example Input:</strong></p>
<p>Let&#8217;s assume we have the following input text. We will test various Expressions.</p><pre class="crayon-plain-tag">Customer =&gt; AAA
Email =&gt; aaa@google.com
Phone =&gt; 101-222-3333
========
Customer =&gt; BBB
Email =&gt; bbb@yahoo.com
Phone =&gt; 102-222-3333
========
Customer =&gt; CCC
Email =&gt; ccc@hotmail.com
Phone =&gt; 103-222-3333
========
Customer =&gt; DDD
Email =&gt; ddd@outlook.com
Phone =&gt; 104-222-3333</pre><p>
<strong>Sample Regex Expressions</strong></p>
<div class="su-table su-table-alternate">
<table style="border-collapse: collapse;width: 100%;height: 332px" border="1">
<tbody>
<tr style="height: 22px">
<td style="width: 50%;height: 22px"><strong>Expression</strong></td>
<td style="width: 50%;height: 22px"><strong>Description</strong></td>
</tr>
<tr style="height: 46px">
<td style="width: 50%;height: 46px">(?s).*</td>
<td style="width: 50%;height: 46px">Match anything including new lines. To match anything without new line just use <pre class="crayon-plain-tag">(.*)</pre></td>
</tr>
<tr style="height: 22px">
<td style="width: 50%;height: 22px">\w+([-+.&#8217;]\w+)*@(?&lt;domain&gt;\w+([-.]\w+)*\.\w+([-.]\w+)*)</td>
<td style="width: 50%;height: 22px">Get first email id from text ({{0}} is omitted from end because {{0}} id default)</td>
</tr>
<tr style="height: 22px">
<td style="width: 50%;height: 22px">\w+([-+.&#8217;]\w+)*@(?&lt;domain&gt;\w+([-.]\w+)*\.\w+([-.]\w+)*){{-0}}</td>
<td style="width: 50%;height: 22px">Get last email id from text</td>
</tr>
<tr style="height: 22px">
<td style="width: 50%;height: 22px">\w+([-+.&#8217;]\w+)*@(?&lt;domain&gt;\w+([-.]\w+)*\.\w+([-.]\w+)*){{*}}</td>
<td style="width: 50%;height: 22px">Get all email addresses (separate them with new line). When you suffix Regular expression with {{*}} it will return all matches.</td>
</tr>
<tr style="height: 22px">
<td style="width: 50%;height: 22px">\w+([-+.&#8217;]\w+)*@(?&lt;domain&gt;\w+([-.]\w+)*\.\w+([-.]\w+)*){{2}}</td>
<td style="width: 50%;height: 22px">Get third email id from text (i.e. ends with {{X}} where X is occurrence index starting from 0)</td>
</tr>
<tr style="height: 22px">
<td style="width: 50%;height: 22px">\w+([-+.&#8217;]\w+)*@(?&lt;domain&gt;\w+([-.]\w+)*\.\w+([-.]\w+)*){{0,2}}</td>
<td style="width: 50%;height: 22px">Get first email pattern match (i.e. Index=0) and extract domain (i.e. 2nd group). Index starting from 0 for occurrence and group</td>
</tr>
<tr style="height: 22px">
<td style="width: 50%;height: 22px">(\d*)-(\d*)-(\d*)</td>
<td style="width: 50%;height: 22px">Get first phone number from text (If you don&#8217;t include {{X,Y}} at the end then it will be always [0,0])</td>
</tr>
<tr style="height: 22px">
<td style="width: 50%;height: 22px">^((?!demo|test).)*$</td>
<td style="width: 50%;height: 22px">Match whole input text if it does not contain words like demo or test. If word found then No Match</td>
</tr>
<tr style="height: 22px">
<td style="width: 50%;height: 22px">&lt;tag&gt;((.|\n)*?)&lt;/tag&gt;{{0,1}}</td>
<td style="width: 50%;height: 22px">Extract anything between &lt;tag&gt;&#8230;&lt;/tag&gt; (Include new line char i.e. \n)</td>
</tr>
<tr style="height: 22px">
<td style="width: 50%;height: 22px">&lt;tag&gt;(.*)&lt;/tag&gt;{{0,1}}</td>
<td style="width: 50%;height: 22px">Extract anything between &lt;tag&gt;&#8230;&lt;/tag&gt; (Exclude new line char i.e. \n)</td>
</tr>
<tr style="height: 22px">
<td style="width: 50%;height: 22px">&lt;!\[CDATA\[((.|\n)*?)\]\]\&gt;{{0,1}}</td>
<td style="width: 50%;height: 22px">Extract content from CData section of XML Data (This can be CSV, JSON or nested XML )</td>
</tr>
<tr style="height: 22px">
<td style="width: 50%;height: 22px">^$</td>
<td style="width: 50%;height: 22px">Match blank string</td>
</tr>
</tbody>
</table>
</div>
<h2>More Regular Expression Examples</h2>
<div class="su-table su-table-alternate">
<table>
<tbody>
<tr>
<td style="width: 196px"><strong>Input Text</strong></td>
<td style="width: 223px"><strong>Regex</strong></td>
<td style="width: 163px"><strong>Matched text</strong></td>
<td style="width: 752px"><strong>Comment</strong></td>
</tr>
<tr>
<td style="width: 196px">&lt;row id=&#8221;123&#8243; process=&#8221;Y&#8221;&gt;</td>
<td style="width: 223px">id=&#8221;([^&#8221;]*)&#8221;{{0,1}}</td>
<td style="width: 163px"><strong>123</strong></td>
<td style="width: 752px">This expression shows how to extract group value (i.e. {{0,1}} &#8211; first match and 2nd group ). It extracts text between double quotes using <strong>[^&#8221;]*</strong> pattern , match anything until double quote is found.  {{0,1}} syntax is ZappySys specific so it may not work with other Regex engines.</td>
</tr>
<tr>
<td style="width: 196px">&lt;data&gt;123&lt;/data&gt;</td>
<td style="width: 223px">&lt;data&gt;([^&lt;]*)&lt;\/data&gt;{{0,1}}</td>
<td style="width: 163px"><strong>123</strong></td>
<td style="width: 752px">This expression shows how to extract group value (i.e. {{0,1}} &#8211; first match and 2nd group ). It extracts text between double quotes using <strong>[^&lt;]*</strong> pattern , match anything until <strong>&lt;</strong>  is found.  {{0,1}} syntax is ZappySys specific so it may not work with other Regex engines.</td>
</tr>
<tr>
<td style="width: 196px" valign="top">File_20180930_source.txt</td>
<td style="width: 223px" valign="top">File</td>
<td style="width: 163px" valign="top"><strong>File</strong></td>
<td style="width: 752px" valign="top">Will match text/filename that has &#8220;File&#8221; keyword in it.</td>
</tr>
<tr>
<td style="width: 196px" valign="top">File_20180930_SOURCE.dat<br />
File_20180930_source.dat</td>
<td style="width: 223px" valign="top">source|SOURCE</td>
<td style="width: 163px" valign="top"><strong>SOURCE</strong> and <strong>source</strong></td>
<td style="width: 752px" valign="top">Will match text/filenames that contain either &#8220;source&#8221; <strong>or</strong> &#8220;SOURCE&#8221; keyword.</td>
</tr>
<tr>
<td style="width: 196px" valign="top">File_20180930_source.txt</td>
<td style="width: 223px" valign="top">File.+source</td>
<td style="width: 163px" valign="top"><strong>File_20180930_source</strong></td>
<td style="width: 752px" valign="top">Will match text/filename that contains keyword that starts with &#8220;File&#8221; <strong>and</strong> ends with &#8220;source&#8221;.<br />
Basically, you can use this pattern if you want to match two keywords in the text that appear in particular order.</td>
</tr>
<tr>
<td style="width: 196px" valign="top">File_20180930_source.txt<br />
File_20180830_source.dat</td>
<td style="width: 223px" valign="top">\.txt$|\.dat$</td>
<td style="width: 163px" valign="top"><strong>.txt</strong> and <strong>.dat</strong></td>
<td style="width: 752px" valign="top">Will match text/all filenames that end with &#8220;.txt&#8221; <strong>or</strong> &#8220;.dat&#8221;.</td>
</tr>
<tr>
<td style="width: 196px" valign="top">File_20180930_source.txt<br />
file_20190102_source.txt</td>
<td style="width: 223px" valign="top">^(F|f)ile_\d{8}</td>
<td style="width: 163px" valign="top"><strong>File_20180930</strong><br />
<strong>file_20190102</strong></td>
<td style="width: 752px" valign="top">Will match text/filename that starts with &#8220;File_&#8221; <strong>or</strong> &#8220;file_&#8221; <strong>and</strong> then followed by 8 digits.</td>
</tr>
<tr>
<td style="width: 196px" valign="top">File_20180930_source.txt<br />
File_20190101_none.txt</td>
<td style="width: 223px" valign="top">(.+)_(.+)_(.+){{0,2}}</td>
<td style="width: 163px" valign="top"><strong>20180930</strong></td>
<td style="width: 752px" valign="top">Will match text that has three groups of text strings, separated by &#8220;_&#8221;.<br />
Non-Regex {{0,2}} notation will bring back second group (index &#8220;2&#8221;) of first match (index &#8220;0&#8221;).</td>
</tr>
<tr>
<td style="width: 196px">File_20180930_source.txt<br />
File_20190101_none.txt</td>
<td style="width: 223px">(.+)_(.+)_(.+){{1,2}}</td>
<td style="width: 163px"><strong>20190101</strong></td>
<td style="width: 752px">Will match text that has three groups of text strings, separated by &#8220;_&#8221;.<br />
Non-Regex {{1,2}} notation will bring back second group (index &#8220;2&#8221;) of second match (index &#8220;1&#8221;).</td>
</tr>
<tr>
<td style="width: 196px">File_20180930_source.txt<br />
File_20190101_none.txt</td>
<td style="width: 223px">(.+)_(.+)_(.+){{*,2}}</td>
<td style="width: 163px"><strong>20180930<br />
20190101<br />
</strong></td>
<td style="width: 752px">Will match text that has three groups of text strings, separated by &#8220;_&#8221;.<br />
Non-Regex {{*,2}} notation will bring back second group (index &#8220;2&#8221;) of all matches (index &#8220;*&#8221;). Returned matches are separated by \r\n</td>
</tr>
<tr>
<td style="width: 196px">&lt;html&gt;<br />
&lt;img src=&#8221;/img-1.png&#8221; /&gt;<br />
&lt;img src=&#8221;/img-2.png&#8221; /&gt;<br />
&lt;img src=&#8221;/img-3.png&#8221; /&gt;<br />
<span style="font-family: inherit;font-size: inherit">&lt;/html&gt;</span></td>
<td style="width: 223px">&lt;img[^&gt;]+src=&#8221;([^&#8221;&gt;]+)&#8221;{{*,1}}</td>
<td style="width: 163px"><strong>/img-1.png<br />
/img-2.png<br />
/img-3.png<br />
</strong></td>
<td style="width: 752px">Will return image URLs from HTML content. We used {{*,1}} means it will pull all occurrences and for each match it will extract first group (which is just src attribute value).</td>
</tr>
<tr>
<td style="width: 196px">null</td>
<td style="width: 223px">^((?!null\b).)*$</td>
<td style="width: 163px"><strong>&lt;blank&gt;</strong></td>
<td style="width: 752px">Returns blank if null word found (match all except null)</td>
</tr>
<tr>
<td style="width: 196px">black white</td>
<td style="width: 223px">^((?!red|blue|orange).)*$</td>
<td style="width: 163px"><strong>black white</strong></td>
<td style="width: 752px">Returns full string as is if any of those 3 words (i.e. red, blue, orange) not found anywhere in the string</td>
</tr>
<tr>
<td style="width: 196px">black white red</td>
<td style="width: 223px">^((?!red|blue|orange).)*$</td>
<td style="width: 163px"><strong>&lt;blank&gt;</strong></td>
<td style="width: 752px">Returns blank if any of those 3 words (i.e. red, blue, orange) found anywhere in the string</td>
</tr>
</tbody>
</table>
</div>
<h2>Regex Examples (Using SSIS Regular Expression Parser Task)</h2>
<p>Here is an example how Regex <pre class="crayon-plain-tag">(.+)_(.+)_(.+){{1,2}}</pre> works in <a href="https://zappysys.com/products/ssis-powerpack/ssis-regex-parser-task/" target="_blank" rel="noopener">Regular Expression Parser Task (FREE)</a>:</p>
<div id="attachment_2978" style="width: 742px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/03/ssis_powerpack_regular_expression_parser_task.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2978" class="wp-image-2978 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/03/ssis_powerpack_regular_expression_parser_task-e1520866478970.png" alt="Using Regular Expressions in SSIS Regex Parser Task (Extract Groups)" width="732" height="612" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/ssis_powerpack_regular_expression_parser_task-e1520866478970.png 732w, https://zappysys.com/blog/wp-content/uploads/2018/03/ssis_powerpack_regular_expression_parser_task-e1520866478970-300x251.png 300w" sizes="(max-width: 732px) 100vw, 732px" /></a><p id="caption-attachment-2978" class="wp-caption-text">Using Regular Expressions in SSIS Regex Parser Task (Extract Groups)</p></div>
<h2>Using Groups / Occurrence Index</h2>
<p>Some tasks like <a href="https://zappysys.com/products/ssis-powerpack/ssis-regex-parser-task/" target="_blank" rel="noopener">SSIS Regex Parser Task (FREE)</a> supports extracting value from specific occurrence and specific part of matched pattern using special syntax at the end of your pattern (see below).</p><pre class="crayon-plain-tag">Your Regex Pattern Here{{OccuranceIndex,GroupIndex}}</pre><p>
<strong>Where :</strong><br />
OccuranceIndex is 0 based (0=extract first occurrence)<br />
GroupIndex is 0 based (0=extract first matching group from pattern. First group is always entire text. )</p>
<p>See above screenshot in previous section for example.</p>
<h2>Tools</h2>
<p>The best tool we&#8217;ve found to write and test Regex is <a href="http://regexhero.net/tester/" target="_blank" rel="noopener">Regex Hero</a> (will require IE with Silverlight if you want to use it online, in the browser):</p>
<p>Another great site for Regex testing is <a href="https://regex101.com" target="_blank" rel="noopener">https://regex101.com</a> (Works in any browser unlike previous one)</p>
<p>and few more sites as below</p>
<p><a href="http://www.regexr.com/" target="_blank" rel="noopener">http://www.regexr.com/</a><br />
<a href="http://www.regexlib.com/" target="_blank" rel="noopener">http://www.regexlib.com/</a><br />
<a href="http://www.regular-expressions.info/" target="_blank" rel="noopener">http://www.regular-expressions.info/</a></p>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2018/03/ssis_powerpack_regular_expression_task_using_regex_hero.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2972" src="https://zappysys.com/blog/wp-content/uploads/2018/03/ssis_powerpack_regular_expression_task_using_regex_hero.png" alt="" width="802" height="483" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/ssis_powerpack_regular_expression_task_using_regex_hero.png 802w, https://zappysys.com/blog/wp-content/uploads/2018/03/ssis_powerpack_regular_expression_task_using_regex_hero-300x181.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/03/ssis_powerpack_regular_expression_task_using_regex_hero-768x463.png 768w" sizes="(max-width: 802px) 100vw, 802px" /></a></p>
<h2>Resources</h2>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2018/03/Regular-expressions-quick-reference.pdf">Regular Expressions cheat-sheet to hang on the wall</a></p>
<p><a href="http://www.rexegg.com/regex-quickstart.html" target="_blank" rel="noopener">Regular Expressions quick reference</a></p>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/using-regular-expressions-in-ssis/">Using Regular Expressions in SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Import / Export data from Amazon Athena using SSIS</title>
		<link>https://zappysys.com/blog/import-export-data-amazon-athena-using-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Thu, 14 Dec 2017 04:25:21 +0000</pubDate>
				<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[S3 (Simple Storage Service)]]></category>
		<category><![CDATA[SSIS Amazon S3 CSV Source]]></category>
		<category><![CDATA[SSIS Amazon S3 JSON Source]]></category>
		<category><![CDATA[SSIS Amazon Storage Task]]></category>
		<category><![CDATA[SSIS Components]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS OAuth Connection]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[SSIS REST API Task]]></category>
		<category><![CDATA[Amazon Athena]]></category>
		<category><![CDATA[CSV]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[s3]]></category>
		<category><![CDATA[ssis]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=2367</guid>

					<description><![CDATA[<p>Introduction In our previous post we explored unlimited possibilities to call Amazon AWS API using SSIS. Now in this post we will learn how to import / export data from Amazon Athena using SSIS. Amazon Athena is very similar service like Google BigQuery which we documented already.  To read data from Amazon Athena we will use [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/import-export-data-amazon-athena-using-ssis/">Import / Export data from Amazon Athena using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/amazon-athena-integration-logo.png"><img loading="lazy" decoding="async" class="wp-image-2378 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2017/12/amazon-athena-integration-logo.png" alt="" width="147" height="115" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/amazon-athena-integration-logo.png 510w, https://zappysys.com/blog/wp-content/uploads/2017/12/amazon-athena-integration-logo-300x235.png 300w" sizes="(max-width: 147px) 100vw, 147px" /></a>In our previous post we explored unlimited possibilities to <a href="https://zappysys.com/blog/how-to-call-amazon-aws-api-using-ssis-ec2-lambda-api-gateway-sqs/" target="_blank" rel="noopener">call Amazon AWS API using SSIS</a>. Now in this post we will learn how to import / export data from Amazon Athena using SSIS. Amazon Athena is very similar service like <a href="https://zappysys.com/blog/get-data-google-bigquery-using-ssis/" target="_blank" rel="noopener">Google BigQuery which we documented already</a>.  To read data from Amazon Athena we will use <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZappySys JSON / REST API Source</a> which supports excellent JSON parsing capability <a href="https://zappysys.com/blog/parse-multi-dimensional-json-array-ssis/" target="_blank" rel="noopener">like this</a>.</p>
<h2></h2>
<h2></h2>
<h2><span id="Prerequisites">Prerequisites</span></h2>
<p>Before we do hello world demo for calling Amazon AWS API, you will need to make sure following prerequisites are met.</p>
<ol>
<li>SSIS designer installed. Sometimes it is referred as BIDS or SSDT (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from Microsoft site</a>).</li>
<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
<li>Access to valid AWS credentials (Access Key, Secret Key for your IAM User). <a href="http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html" target="_blank" rel="noopener">Click here to learn more</a> about IAM users and Access Key/Secret Key</li>
<li>Make sure <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener"><em>SSIS PowerPack</em></a> is installed. <a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">Click here to download</a>.</li>
</ol>
<h2>Steps needed to read data from Amazon Athena</h2>
<p>To read data from Amazon Athena you need to do atleast 3 steps at very high level. Later on this article we will see each step in depth.</p>
<ol>
<li>Call <a href="https://docs.aws.amazon.com/athena/latest/APIReference/API_StartQueryExecution.html" target="_blank" rel="noopener">StartQueryExecution API</a> to send SQL Query (Its Job Style API so this call starts Job)</li>
<li>Keep checking Job Status by calling  <a href="https://docs.aws.amazon.com/athena/latest/APIReference/API_GetQueryExecution.html" target="_blank" rel="noopener">GetQueryExecution API</a> (In the response check State field for Status &#8211; We need to look for word SUCCESS)</li>
<li>Once Job is finished it produces CSV file in S3 Bucket (Output Location is supplied in Step-1)</li>
</ol>
<div id="attachment_8355" style="width: 923px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/query-read-data-from-amazon-athena-ssis-s3-csv-output.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8355" class="size-full wp-image-8355" src="https://zappysys.com/blog/wp-content/uploads/2017/12/query-read-data-from-amazon-athena-ssis-s3-csv-output.png" alt="Read Amazon Athena Query output in SSIS (S3 CSV files)" width="913" height="658" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/query-read-data-from-amazon-athena-ssis-s3-csv-output.png 913w, https://zappysys.com/blog/wp-content/uploads/2017/12/query-read-data-from-amazon-athena-ssis-s3-csv-output-300x216.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/12/query-read-data-from-amazon-athena-ssis-s3-csv-output-768x553.png 768w" sizes="(max-width: 913px) 100vw, 913px" /></a><p id="caption-attachment-8355" class="wp-caption-text">Read Amazon Athena Query output in SSIS (S3 CSV files)</p></div>
<h2>AWS Console &#8211; Athena Query Editor / Configure Output Settings</h2>
<p>Few things you might have to setup before you can call Athena API in SSIS</p>
<ol>
<li>Make sure your IAM user has correct permission (We used existing policies for ease of use but you can use custom policy for precise permission set)</li>
<li>Configure default output location for your Athena queries</li>
</ol>
<div id="attachment_8360" style="width: 996px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/configure-amazon-athena-permission-policy.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8360" class="size-full wp-image-8360" src="https://zappysys.com/blog/wp-content/uploads/2017/12/configure-amazon-athena-permission-policy.png" alt="Configure IAM user permission to call Amazon Athena API" width="986" height="581" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/configure-amazon-athena-permission-policy.png 986w, https://zappysys.com/blog/wp-content/uploads/2017/12/configure-amazon-athena-permission-policy-300x177.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/12/configure-amazon-athena-permission-policy-768x453.png 768w" sizes="(max-width: 986px) 100vw, 986px" /></a><p id="caption-attachment-8360" class="wp-caption-text">Configure IAM user permission to call Amazon Athena API</p></div>
<div id="attachment_8361" style="width: 837px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/set-athena-query-output-location.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8361" class="size-full wp-image-8361" src="https://zappysys.com/blog/wp-content/uploads/2017/12/set-athena-query-output-location.png" alt="Set Athena Query Output Location" width="827" height="454" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/set-athena-query-output-location.png 827w, https://zappysys.com/blog/wp-content/uploads/2017/12/set-athena-query-output-location-300x165.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/12/set-athena-query-output-location-768x422.png 768w" sizes="(max-width: 827px) 100vw, 827px" /></a><p id="caption-attachment-8361" class="wp-caption-text">Set Athena Query Output Location</p></div>
<div id="attachment_8362" style="width: 1080px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/amazon-athena-test-query-editor-aws-console.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8362" class="size-full wp-image-8362" src="https://zappysys.com/blog/wp-content/uploads/2017/12/amazon-athena-test-query-editor-aws-console.png" alt="Testing Athena Query inside Amazon AWS Console (Query Editor)" width="1070" height="628" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/amazon-athena-test-query-editor-aws-console.png 1070w, https://zappysys.com/blog/wp-content/uploads/2017/12/amazon-athena-test-query-editor-aws-console-300x176.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/12/amazon-athena-test-query-editor-aws-console-768x451.png 768w, https://zappysys.com/blog/wp-content/uploads/2017/12/amazon-athena-test-query-editor-aws-console-1024x601.png 1024w" sizes="(max-width: 1070px) 100vw, 1070px" /></a><p id="caption-attachment-8362" class="wp-caption-text">Testing Athena Query inside Amazon AWS Console (Query Editor)</p></div>
<h2>Creating Connection to call Athena API in SSIS</h2>
<p>Any API calls made to Amazon Athena service using <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZappySys JSON / REST API Source</a>  or  <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">ZS REST API Task</a> needs OAuth connection.</p>
<p>For REST API Task configure as below (More details about using REST API Task is in the next section).</p>
<ol>
<li>Drag ZS REST API Task from Control Flow Toolbox<img decoding="async" class="figureimage" title="SSIS REST Api Web Service Task - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/rest-api-task/ssis-rest-api-web-service-task-drag.png" alt="SSIS REST Api Task - Drag and Drop" /></li>
<li>Double click to edit.</li>
<li>Change Request URL Access Mode to [<strong>Url from Connection</strong>]</li>
<li>Now select <strong>&lt;&lt;New OAuth Connection&gt;&gt;</strong> from connection drop down</li>
<li>On OAuth connection select <strong>Amazon AWS API v4</strong> as Provider</li>
<li>Enter your <strong>Access Key</strong> and <strong>Secret Key</strong></li>
</ol>
<div class="su-note"  style="border-color:#e5de9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#fff8b7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;">Amazon AWS account must have access to Athena API calls and S3 Bucket </div></div>
<div id="attachment_2370" style="width: 702px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-aws-api-connection-call-rest.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2370" class="size-full wp-image-2370" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-aws-api-connection-call-rest.png" alt="Create SSIS Connection for Amazon AWS API Call (Athena REST API Example)" width="692" height="651" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-aws-api-connection-call-rest.png 692w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-aws-api-connection-call-rest-300x282.png 300w" sizes="(max-width: 692px) 100vw, 692px" /></a><p id="caption-attachment-2370" class="wp-caption-text">Create SSIS Connection for Amazon AWS API Call (Athena REST API Example)</p></div>
<h2>Creating Table in Amazon Athena using API call</h2>
<p>For this demo we assume you have already created sample table in Amazon Athena. If you wish to automate creating amazon athena table using SSIS then you need to call <a href="https://docs.aws.amazon.com/athena/latest/ug/create-table.html" target="_blank" rel="noopener">CREATE TABLE</a> DDL command using <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">ZS REST API Task</a>.</p>
<ol>
<li>In the previous <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">ZS REST API Task</a> select OAuth connection (See previous section)</li>
<li>Enter <strong>Request Url</strong> as below<strong><br />
</strong><br />
<pre class="crayon-plain-tag">https://athena.us-east-1.amazonaws.com/</pre>
</li>
<li>In the <strong>HTTP Headers</strong> enter below 2 headers<br />
<pre class="crayon-plain-tag">X-Amz-Target: AmazonAthena.StartQueryExecution
Content-Type: application/x-amz-json-1.1</pre>
</li>
<li>Change Request method to <strong>POST</strong></li>
<li>In the Body enter below<br />
<pre class="crayon-plain-tag">{
 "ResultConfiguration": {
 "OutputLocation": "s3://my-bucket/output-files/"
 },
 "QueryString": "create external table tbl01 (CustomerID STRING, CompanyName STRING) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LOCATION 's3://my-bucket/input-files/';",
 "ClientRequestToken": "{{System::ExecutionInstanceGUID}}"
}</pre>
<strong>Notice:</strong> Rather than using hard coded  DDL SQL Statement we can use variable placeholder (e.g. <pre class="crayon-plain-tag">"QueryString": "{{User::Query,FUN_JSONENCODE}}"</pre>   ). Use <pre class="crayon-plain-tag">FUN_JSONENCODE</pre> to replace new line with \r\n else JSON becomes invalid.</li>
<li>Now click <strong>Test Request / Response</strong>. This will create a new Athena table which we will query in later section.</li>
</ol>
<p>&nbsp;</p>
<p>Notice that in above Body ClientRequestToken is a unique number each time you have to call <a href="http://docs.aws.amazon.com/athena/latest/APIReference/API_StartQueryExecution.html#athena-StartQueryExecution-request-ClientRequestToken" target="_blank" rel="noopener">StartQueryExecution API</a> to make it simple we used SSIS system variable <strong>System::ExecutionInstanceGUID</strong>. Its unique for each execution. You can also use newid() function from SQL Server and save result to variable if you like.</p>
<p>Here is the screenshot of above Request</p>
<div id="attachment_2368" style="width: 821px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-create-table.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2368" class="size-full wp-image-2368" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-create-table.png" alt="RESt API Task - Create table in Amazon Athena using SSIS (StartQueryExecution API Call)" width="811" height="760" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-create-table.png 811w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-create-table-300x281.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-create-table-768x720.png 768w" sizes="(max-width: 811px) 100vw, 811px" /></a><p id="caption-attachment-2368" class="wp-caption-text">RESt API Task &#8211; Create table in Amazon Athena using SSIS (StartQueryExecution API Call)</p></div>
<p>&nbsp;</p>
<h2>Uploading data for Amazon Athena (Source files)</h2>
<p>Once you have athena table created, we will need some data to query. Loading data to amazon athena table is nothing but upload files to S3. If you noticed we added below line in CREATE TABLE statement in the previous section. This means all source files are located at this S3 location.</p><pre class="crayon-plain-tag">LOCATION 's3://my-bucket/input-files/'</pre><p>
We have written blog post to explain this process (<a href="https://zappysys.com/blog/load-data-sql-server-to-amazon-s3/" target="_blank" rel="noopener">Click Here &#8211; How to load data from SQL server to S3 files</a>).</p>
<h2>Extract data from Amazon Athena using SSIS (Query Athena)</h2>
<p>Now its time to read some data by writing SQL query for Athena data (i.e. S3 files). As we mentioned earlier, reading data from Athena can be done using following steps.</p>
<ol>
<li>Call  <a href="http://docs.aws.amazon.com/athena/latest/APIReference/API_StartQueryExecution.html#athena-StartQueryExecution-request-ClientRequestToken" target="_blank" rel="noopener">StartQueryExecution API</a>  using REST API Task to execute your Query (It returns you QueryExecutionID). Use same technique as Create Table example. Replace CREATE Table command in body with your SQL Query (New line must be replaced by \r\n in JSON).</li>
<li>Use REST API Task to call <a href="https://docs.aws.amazon.com/athena/latest/APIReference/API_GetQueryExecution.html" target="_blank" rel="noopener">GetQueryExecution API</a> and configure periodic status check loop (Task keeps waiting until Success or Failure Value not found in Response)</li>
<li>Once data is available read data using <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-csv-file-source/" target="_blank" rel="noopener">S3 CSV File Source</a></li>
<li>At last you can clean up query output files or keep it if some other process wants to read it (You can also <a href="https://stackoverflow.com/questions/41413528/amazon-aws-athena-removing-temp-files" target="_blank" rel="noopener">clean up S3 files using bucket retention policy</a> automatically at scheduled interval).</li>
</ol>
<p>Now lets see each step in depth</p>
<h3>Step1-Start Amazon Athena Query Execution</h3>
<p>Now first thing is to execute Athena Query by calling <a href="http://docs.aws.amazon.com/athena/latest/APIReference/API_StartQueryExecution.html#athena-StartQueryExecution-request-ClientRequestToken" target="_blank" rel="noopener">StartQueryExecution API</a> . Below steps are almost same steps as we saw in section <strong>Creating Table in Amazon Athena using API call</strong></p>
<p>Only part is different here is SQL query is SELECT query rather than CREATE TABLE.</p>
<ol>
<li>Drag and drop <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">ZS REST API Task</a> from SSIS toolbox<br />
<img decoding="async" class="figureimage" title="SSIS REST Api Web Service Task - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/rest-api-task/ssis-rest-api-web-service-task-drag.png" alt="SSIS REST Api Task - Drag and Drop" /></li>
<li>Enter <strong>Request Url</strong> as below<strong><br />
</strong><br />
<pre class="crayon-plain-tag">https://athena.us-east-1.amazonaws.com/</pre>
</li>
<li>In the <strong>HTTP Headers</strong> enter below 2 headers<br />
<pre class="crayon-plain-tag">X-Amz-Target: AmazonAthena.StartQueryExecution
Content-Type: application/x-amz-json-1.1</pre>
</li>
<li>Change Request method to <strong>POST</strong></li>
<li>In the Body enter below<br />
<pre class="crayon-plain-tag">{
  "ResultConfiguration": {
    "OutputLocation": "s3://my-bucket/output-files/"
  },
  "QueryString": "select * from sampledb.elb_logs\r\nlimit 100000",
  "ClientRequestToken": "{{System::ExecutionInstanceGUID}}"
}</pre>
<strong>Notice:</strong> Rather than using hard coded  SQL Query we can use variable placeholder (e.g. <pre class="crayon-plain-tag">"QueryString": "{{User::Query,FUN_JSONENCODE}}"</pre>   ). Use <pre class="crayon-plain-tag">FUN_JSONENCODE</pre> to replace new line with \r\n else JSON becomes invalid.</p>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-create-table.png"><img loading="lazy" decoding="async" class="size-full wp-image-2368" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-create-table.png" alt="RESt API Task - Create table in Amazon Athena using SSIS (StartQueryExecution API Call)" width="811" height="760" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-create-table.png 811w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-create-table-300x281.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-create-table-768x720.png 768w" sizes="(max-width: 811px) 100vw, 811px" /></a></li>
<li>Now go to <strong>Response Settings</strong> Tab and configure below way to extract QueryExecutionId (we will need it later).
<p>Set Extract Type as Json.<br />
Enter Expression as <pre class="crayon-plain-tag">$.QueryExecutionId</pre>
Check Save output to Variable and create new Variable (we can name as QueryExecutionId )</p>
<div id="attachment_8356" style="width: 860px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-save-query-execution-id.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8356" class="size-full wp-image-8356" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-save-query-execution-id.png" alt="Call Athena SQL, Save Amazon Athena QueryExecutionId in SSIS Variable" width="850" height="336" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-save-query-execution-id.png 850w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-save-query-execution-id-300x119.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-save-query-execution-id-768x304.png 768w" sizes="(max-width: 850px) 100vw, 850px" /></a><p id="caption-attachment-8356" class="wp-caption-text">Call Athena SQL, Save Amazon Athena QueryExecutionId in SSIS Variable</p></div></li>
<li>That&#8217;s it now we can move to next step</li>
</ol>
<p>&nbsp;</p>
<h3>Step2 &#8211; Wait until Athena Query Execution is done</h3>
<p>New version of ZS REST API Task includes <strong>Status check</strong> feature. This feature avoids complex looping logic. Here is how to configure to check Job Status (Wait until Query execution is finished). Steps are almost same as previous section except three things ( Headers, Body and Status Check Tab)</p>
<p>For Status check we will call <a href="https://docs.aws.amazon.com/athena/latest/APIReference/API_GetQueryExecution.html" target="_blank" rel="noopener">GetQueryExecution API</a> .</p>
<ol>
<li>Drag and drop <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">ZS REST API Task</a> from SSIS toolbox<br />
<img decoding="async" class="figureimage" title="SSIS REST Api Web Service Task - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/rest-api-task/ssis-rest-api-web-service-task-drag.png" alt="SSIS REST Api Task - Drag and Drop" /></li>
<li>Enter <strong>Request Url</strong> as below<strong><br />
</strong><br />
<pre class="crayon-plain-tag">https://athena.us-east-1.amazonaws.com/</pre>
</li>
<li>In the <strong>HTTP Headers</strong> enter below 2 headers<br />
<pre class="crayon-plain-tag">X-Amz-Target: AmazonAthena.GetQueryExecution
Content-Type: application/x-amz-json-1.1</pre>
</li>
<li>Change Request method to <strong>POST</strong></li>
<li>In the <strong>Body</strong> enter below<br />
<pre class="crayon-plain-tag">{"QueryExecutionId": "{{User::QueryExecutionId}}"}</pre>
<strong>Notice:</strong> Here we have used Variable in the body. This variable we extracted in the previous step. It contains QueryExecution ID for the Job we submitted.</p>
<div id="attachment_8358" style="width: 860px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-getqueryexecution-status-check-loop.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8358" class="size-full wp-image-8358" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-getqueryexecution-status-check-loop.png" alt="SSIS Amazon Athena - Call GetQueryExecution API (Status Check)" width="850" height="556" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-getqueryexecution-status-check-loop.png 850w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-getqueryexecution-status-check-loop-300x196.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-amazon-athena-getqueryexecution-status-check-loop-768x502.png 768w" sizes="(max-width: 850px) 100vw, 850px" /></a><p id="caption-attachment-8358" class="wp-caption-text">SSIS Amazon Athena &#8211; Call GetQueryExecution API (Status Check)</p></div></li>
<li>Now go to <strong>Status Check</strong> Tab and configure below way to implement Status check loop. We want to stop check once status is SUCCESS or FAILED or CANCELLED. If we find FAILED or CANCELLED in State field then we must fail the step with error.
<ol>
<li>Check Enable Status Check</li>
<li>Enter Success Value as <pre class="crayon-plain-tag">SUCCEEDED</pre></li>
<li>Check Fail Task option and enter this regex in the text box <pre class="crayon-plain-tag">FAILED|CANCELLED</pre></li>
<li>In the Interval enter 5 seconds delay after each iteration.</li>
</ol>
</li>
<li>That&#8217;s it. Status check Tab will look like below. Now we can move to next step
<div id="attachment_8357" style="width: 536px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/rest-api-job-status-check-loop.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8357" class="size-full wp-image-8357" src="https://zappysys.com/blog/wp-content/uploads/2017/12/rest-api-job-status-check-loop.png" alt="REST API Status check Loop - Keep checking until JOB is done" width="526" height="391" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/rest-api-job-status-check-loop.png 526w, https://zappysys.com/blog/wp-content/uploads/2017/12/rest-api-job-status-check-loop-300x223.png 300w" sizes="(max-width: 526px) 100vw, 526px" /></a><p id="caption-attachment-8357" class="wp-caption-text">REST API Status check Loop &#8211; Keep checking until JOB is done</p></div></li>
</ol>
<p>&nbsp;</p>
<h3>Step3-Read data from Athena Query output files (CSV / JSON stored in S3 bucket)</h3>
<p>When you create Athena table you have to specify query output folder and data input location and file format (e.g. CSV, JSON, Avro, ORC, Parquet &#8230;) they can be GZip, Snappy Compressed. Once you execute query it generates CSV file. Zappysys can read CSV, TSV or JSON files using <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-csv-file-source/" target="_blank" rel="noopener">S3 CSV File Source</a> or <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-json-file-source/" target="_blank" rel="noopener">S3 JSON File Source</a> connectors. In this section we will use CSV connector to read Athena output files.</p>
<p>Here is how to Athena output data</p>
<ol>
<li>Drag and drop Data flow task from SSIS Toolbox<br />
<img decoding="async" class="figureimage" title="SSIS Data Flow Task - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/drag-and-drop-data-flow-task.png" alt="SSIS Data Flow Task - Drag and Drop" /></li>
<li>Double click data flow and drag and drop  <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-csv-file-source/" target="_blank" rel="noopener">ZS Amazon S3 CSV File Source</a><br />
<img decoding="async" class="figureimage" title="SSIS Amazon S3 CSV Source - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-s3-csv-source/ssis-amazon-s3-csv-file-source-drag.png" alt="SSIS Amazon S3 CSV Source - Drag and Drop" /></li>
<li>Double click to configure it.</li>
<li> Click New Connection and configure S3 Connection</li>
<li>Once connection is created, browse to S3 bucket / folder location where Athena outputs files.</li>
<li>Replace file name with variable like below<br />
<pre class="crayon-plain-tag">my-bucket/output-files/{{User::QueryExecutionId}}.csv</pre>
&nbsp;</li>
</ol>
<p>&nbsp;</p>
<div id="attachment_2371" style="width: 1214px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-read-athena-csv-output-from-aws-s3-storage-csv-files.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2371" class="size-full wp-image-2371" src="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-read-athena-csv-output-from-aws-s3-storage-csv-files.png" alt="Reading data from Amazon Athena CSV files (Stored in S3)" width="1204" height="675" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-read-athena-csv-output-from-aws-s3-storage-csv-files.png 1204w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-read-athena-csv-output-from-aws-s3-storage-csv-files-300x168.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-read-athena-csv-output-from-aws-s3-storage-csv-files-768x431.png 768w, https://zappysys.com/blog/wp-content/uploads/2017/12/ssis-read-athena-csv-output-from-aws-s3-storage-csv-files-1024x574.png 1024w" sizes="(max-width: 1204px) 100vw, 1204px" /></a><p id="caption-attachment-2371" class="wp-caption-text">Reading data from Amazon Athena CSV files (Stored in S3)</p></div>
<h2>Putting all together &#8211; Athena Data Extract Example</h2>
<p>Here is final package with all pieces we talked.</p>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2017/12/query-read-data-from-amazon-athena-ssis-s3-csv-output.png"><img loading="lazy" decoding="async" class="size-full wp-image-8355" src="https://zappysys.com/blog/wp-content/uploads/2017/12/query-read-data-from-amazon-athena-ssis-s3-csv-output.png" alt="Read Amazon Athena Query output in SSIS (S3 CSV files)" width="913" height="658" srcset="https://zappysys.com/blog/wp-content/uploads/2017/12/query-read-data-from-amazon-athena-ssis-s3-csv-output.png 913w, https://zappysys.com/blog/wp-content/uploads/2017/12/query-read-data-from-amazon-athena-ssis-s3-csv-output-300x216.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/12/query-read-data-from-amazon-athena-ssis-s3-csv-output-768x553.png 768w" sizes="(max-width: 913px) 100vw, 913px" /></a></p>
<p>&nbsp;</p>
<h2>Conclusion</h2>
<p>You have seen that using ZappySys SSIS PowerPack how quickly you can integrate with Amazon Athena and other AWS Cloud Services.  <a href="https://zappysys.com/products/ssis-powerpack/">Download SSIS PowerPack</a> and try it out by yourself.</p>
<p><strong>Keywords:</strong> Extract data from Amazon Athena | Read from Amazon Athena Query file | Import / Export data from Amazon Athena | Fetch data from Amazon Athena</p>
<p>The post <a href="https://zappysys.com/blog/import-export-data-amazon-athena-using-ssis/">Import / Export data from Amazon Athena using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Filter by file size, name, date for Amazon / Azure Storage SSIS Task</title>
		<link>https://zappysys.com/blog/advanced-path-filtering-for-amazon-azure-storage-ssis-task/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Fri, 21 Jul 2017 14:50:47 +0000</pubDate>
				<category><![CDATA[SSIS Amazon Storage Task]]></category>
		<category><![CDATA[SSIS Azure Blob Storage Task]]></category>
		<category><![CDATA[SSIS Tips & How-Tos]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[path]]></category>
		<category><![CDATA[ssis amazon storage task]]></category>
		<category><![CDATA[ssis azure storage task]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=1590</guid>

					<description><![CDATA[<p>Introduction Sometimes you may need to make an advanced filtering on file path, file date, size etc in SSIS Amazon S3 Task or SSIS Azure Blob Storage Task . For example, you have a directory &#8220;Customers&#8220;, which contains client directories. Each of them contains a directory named &#8220;Invoices&#8220;, which is partitioned by year. E.g. &#8220;Customers/Microsoft/Invoices/2015&#8221;. So [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/advanced-path-filtering-for-amazon-azure-storage-ssis-task/">Filter by file size, name, date for Amazon / Azure Storage SSIS Task</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><a href="//zappysys.com/blog/wp-content/uploads/2016/06/ssis-tip.png"><img loading="lazy" decoding="async" class="alignleft wp-image-1897" src="//zappysys.com/blog/wp-content/uploads/2016/06/ssis-tip.png" alt="" width="90" height="90" srcset="https://zappysys.com/blog/wp-content/uploads/2016/06/ssis-tip.png 180w, https://zappysys.com/blog/wp-content/uploads/2016/06/ssis-tip-150x150.png 150w" sizes="(max-width: 90px) 100vw, 90px" /></a></p>
<h2>Introduction</h2>
<p>Sometimes you may need to make an advanced filtering on file path, file date, size etc in <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-task/" target="_blank" rel="noopener">SSIS Amazon S3 Task</a> or <a href="https://zappysys.com/products/ssis-powerpack/ssis-azure-blob-storage-task/" target="_blank" rel="noopener">SSIS Azure Blob Storage Task</a> . For example, you have a directory &#8220;<em>Customers</em>&#8220;, which contains client directories. Each of them contains a directory named &#8220;<em>Invoices</em>&#8220;, which is partitioned by year. E.g. &#8220;Customers/Microsoft/Invoices/2015&#8221;. So if you want to get <em>all</em> invoices of <em>all</em> customers of <em>all</em> years, use <em>Advanced Filter &amp; Sorting </em>option and configure <em>Where</em> clause to use wildcards (*) like this:</p>
<div id="attachment_1591" style="width: 693px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-amazon-storage-task-and-azure-storage-task-to-get-file-list.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1591" class="wp-image-1591 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-amazon-storage-task-and-azure-storage-task-to-get-file-list.jpg" alt="SSIS Amazon/Azure Storage Task – To get all invoices of all customers of all years, use Where clause FullPath LIKE 'Customers/*/Invoices/*'" width="683" height="665" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-amazon-storage-task-and-azure-storage-task-to-get-file-list.jpg 683w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-amazon-storage-task-and-azure-storage-task-to-get-file-list-300x292.jpg 300w" sizes="(max-width: 683px) 100vw, 683px" /></a><p id="caption-attachment-1591" class="wp-caption-text">SSIS Amazon/Azure Storage Task – To get all invoices of all customers of all years, use this Where clause: <em>FullPath LIKE &#8216;Customers/*/Invoices/*&#8217;</em></p></div>
<p>&nbsp;</p>
<div class="content_block" id="custom_post_widget-2523"><h2><span id="Prerequisites">Prerequisites</span></h2>
Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:
<ol style="margin-left: 1.5em;">
 	<li><abbr title="SQL Server Integration Services">SSIS</abbr> designer installed. Sometimes it is referred to as <abbr title="Business Intelligence Development Studio">BIDS</abbr> or <abbr title="SQL Server Data Tools">SSDT</abbr> (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from the Microsoft site</a>).</li>
 	<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
 	<li>Make sure <span style="text-decoration: underline;"><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a></span> is installed (<a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">download it</a>, if you haven't already).</li>
 	<li>(<em>Optional step</em>)<em>.</em> <a href="https://zappysys.zendesk.com/hc/en-us/articles/360035974593" target="_blank" rel="noopener">Read this article</a>, if you are planning to deploy packages to a server and schedule their execution later.</li>
</ol></div>
<p>&nbsp;</p>
<h2><span id="Delete_Multiple_S3_files_8211Using_Advanced_Search_8211_Regex_SQL_Expression">Using Advanced Search – Regex / SQL Expression (Filter by file date, size, name)</span></h2>
<p>Sometimes it’s necessary to filter file based on advanced attributes such as file Age (How old), File Size, Multiple File Patterns (e.g. Delete *.zip, *.gz, *.rar in one action)</p>
<p>You can check <a href="https://zappysys.com/blog/ssis-delete-amazon-s3-file-folder-bucket/">this link</a> or <a href="https://zappysys.com/blog/get-list-of-files-and-folders-in-ssis-for-looping/">this link</a> for more information. For <a href="https://zappysys.com/products/ssis-powerpack/ssis-azure-blob-storage-task/" target="_blank" rel="noopener">Azure Blob Storage Task</a> its almost same UI.</p>
<p>You can use Advanced Tab to filter further. First supply primary filter on Source Tab (e.g. mybucket/*.* ) and then supply your advanced filter (e.g. you can exclude *.exe and *.msi file from your delete list as below screenshot, also only delete files between 1000 and 50000 bytes in file size).</p>
<p>&nbsp;</p>
<div id="attachment_4904" style="width: 612px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-delete-amazons3-file-multiple.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4904" class="wp-image-4904 size-full" style="border: 0px; max-width: 100%; height: auto; box-shadow: rgba(0, 0, 0, 0.176) 0px 1px 2px;" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-delete-amazons3-file-multiple.png" alt="Delete Amazon S3 File (Multiple) using Wildcard pattern" width="602" height="360" data-attachment-id="4904" data-permalink="https://zappysys.com/blog/ssis-delete-amazon-s3-file-folder-bucket/ssis-delete-amazons3-file-multiple/#main" data-orig-file="https://i2.wp.com/zappysys.com/blog/wp-content/uploads/2018/09/ssis-delete-amazons3-file-multiple.png?fit=602%2C360&amp;ssl=1" data-orig-size="602,360" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="ssis-delete-amazons3-file-multiple" data-image-description="&lt;p&gt;Delete Amazon S3 File (Multiple) using Wildcard pattern&lt;/p&gt;" data-medium-file="https://i2.wp.com/zappysys.com/blog/wp-content/uploads/2018/09/ssis-delete-amazons3-file-multiple.png?fit=300%2C179&amp;ssl=1" data-large-file="https://i2.wp.com/zappysys.com/blog/wp-content/uploads/2018/09/ssis-delete-amazons3-file-multiple.png?fit=602%2C360&amp;ssl=1" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-delete-amazons3-file-multiple.png 602w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-delete-amazons3-file-multiple-300x179.png 300w" sizes="(max-width: 602px) 100vw, 602px" /></a><p id="caption-attachment-4904" class="wp-caption-text">Select / Delete Amazon S3 File (Multiple) using Wildcard pattern</p></div>
<p>&nbsp;</p>
<div class="wp-caption alignnone">
<div style="width: 678px" class="wp-caption alignnone"><img loading="lazy" decoding="async" src="https://i2.wp.com/zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-s3-task/amazon-s3-file-file-advanced-search-regx-pattern.png?zoom=1.100000023841858&amp;resize=668%2C534&amp;ssl=1" srcset="https://i2.wp.com/zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-s3-task/amazon-s3-file-file-advanced-search-regx-pattern.png?zoom=1.100000023841858&amp;resize=668%2C534&amp;ssl=1" alt="Advanced Search in SSIS Amazon S3 Task - Use Regular Expression Patterns, SQL like expression for Sort / Filter" width="668" height="534" /><p class="wp-caption-text">Advanced Search in SSIS Amazon S3 Task – Use Regular Expression Patterns, SQL like expression for Sort / Filter</p></div>
<p class="wp-caption-text">
</div>
</p><pre class="crayon-plain-tag">//////////////////////////////
Examples:
//////////////////////////////
AgeInDays &lt; 5  //Get files created in last 5 days
LastEditInDays &gt; 3 //Get files modified before 3 days
AgeInDays &gt; 10 AND LastEditInDays &lt; 3  //Get files created before 10 days and modified in last 3 days
Size &lt; 1024  //Get files where File size is less than 1024 bytes
CreationDate BETWEEN #2015-01-01# AND #2015-01-01#  
Name IN ('File1.txt', 'Download.msi')
FullPath LIKE 'mybucket\somefolder\month_*')
Extension IN ('.txt','.csv')
LastModifiedDate &gt; #2013-01-01T16:00:00#
IsReadOnly = True
/////////////////////////////////////////
//Supported Columns for expression:
/////////////////////////////////////////
Name, FullPath, Extension, FolderPath, AgeInDays, LastEditInDays, Size, CreationDate, CreationDateUtc, LastModifiedDate, LastModifiedDateUtc, IsReadOnly</pre><p>
&nbsp;</p>
<h3><span id="Delete_Amazon_S3_files_older_than_X_days">Select Amazon S3 files older than X days</span></h3>
<p>If you like to select / delete files older than certain days then use below technique.<br />
<pre class="crayon-plain-tag">AgeInDays &gt; 10</pre>
<ol>
<li>First Specify primary search criteria on Source tab</li>
<li>Go to Advanced Filter Tab and specify Following Pattern in <strong>Where</strong> Textbox (For example delete Files older than 10 days )
<div id="crayon-5c66c6b62f52c668162370" class="crayon-syntax crayon-theme-vs2012 crayon-font-courier-new crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover">
<div class="crayon-plain-wrap"></div>
</div>
</li>
</ol>
<h2></h2>
<p>The post <a href="https://zappysys.com/blog/advanced-path-filtering-for-amazon-azure-storage-ssis-task/">Filter by file size, name, date for Amazon / Azure Storage SSIS Task</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SSIS &#8211; Copy Amazon S3 files from AWS to Azure</title>
		<link>https://zappysys.com/blog/ssis-copy-move-amazon-s3-files-from-aws-to-azure/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Wed, 19 Apr 2017 21:40:45 +0000</pubDate>
				<category><![CDATA[SSIS Amazon Storage Task]]></category>
		<category><![CDATA[SSIS Azure Blob Storage Task]]></category>
		<category><![CDATA[Amazon S3]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[azure]]></category>
		<category><![CDATA[azure blob storage]]></category>
		<category><![CDATA[GCP]]></category>
		<category><![CDATA[Google Cloud]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[ssis amazon storage task]]></category>
		<category><![CDATA[ssis azure storage task]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=1097</guid>

					<description><![CDATA[<p>Introduction Azure and AWS both are most popular Cloud Platforms. In this blog post we will learn how to copy or move Amazon S3 files to Azure Blob Storage without any coding or scripting  (AWS to Azure File Copy / Migration Scenario). To achieve this objective we will use following Drag and Drop SSIS  Tasks (i.e. [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/ssis-copy-move-amazon-s3-files-from-aws-to-azure/">SSIS &#8211; Copy Amazon S3 files from AWS to Azure</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p>Azure and AWS both are most popular Cloud Platforms. In this blog post we will learn <em>how to copy or move Amazon S3 files to Azure Blob Storage</em> without any coding or scripting  (<strong>AWS to Azure File Copy / Migration Scenario</strong>). To achieve this objective we will use following Drag and Drop SSIS  Tasks (i.e. Microsoft SQL Server Integration Services &#8211; <a href="https://docs.microsoft.com/en-us/sql/integration-services/sql-server-integration-services" target="_blank">ETL Platform for SQL Server</a>). Following components are highly optimized for parallel copy/multi threading with secure connection (client side/serverside encryption).</p>
<table>
<tbody>
<tr>
<td width="36"><img decoding="async" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/azure-storage-task/ssis-azure-cloud-storage-task.png" alt="Custom SSIS Tasks - Azure Blob Storage Task" width="32" /></td>
<td><a title="SSIS Azure Blob Storage Task (Manage Azure Blob Storage)" href="//zappysys.com/products/ssis-powerpack/ssis-azure-blob-storage-task/" target="_blank">SSIS Azure Blob Storage Task</a></td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td width="36"><img decoding="async" src="//zappysys.com/images/ssis-powerpack/SSIS-Amazon-S3-Cloud-Task.png" alt="Custom SSIS Components - Amazon S3 Task (AWS S3)" width="32" /></td>
<td><a title="SSIS Amazon Storage Task (Manage AWS S3)" href="//zappysys.com/products/ssis-powerpack/ssis-amazon-s3-task/" target="_blank">SSIS Amazon Storage Task (AWS S3)</a></td>
</tr>
</tbody>
</table>
<h2>Concept : Fast Server Side Copy in Azure (Copy files into Azure Blob Storage)</h2>
<p>Azure provides unique feature called server side file copy. Using this feature you can load or copy files into Azure Blob Storage without landing data to your local machine. As of now (March 2017) this type of feature is still missing in other Cloud Platform such as <strong>Amazon AWS</strong> and <strong>Google Cloud Platform &#8211; GCP</strong>.</p>
<p>Using server side copy feature in Azure&#8230; you can achieve following scenarios in SSIS without coding</p>
<ul>
<li>Move / Copy files from Amazon S3 to Azure Blob Storage</li>
<li>Move / Copy files from Google Cloud Platform (GCP) to Azure Blob Storage</li>
<li>Copy files from any public URL to Azure Blob Storage (Assuming URL doesn&#8217;t require credentials or its intranet URL)</li>
</ul>
<p>In first two scenarios you need to have Source File URL using Authentication information inside URL (This is called Pre-Signed URL e.g. http://mycloud.com/myfile.zip?SIGNATURE-GOES-HERE ). All major Cloud Providers Support Pre-Signed URL so you can securely share files  with other without sharing your actual Credentials. You can configure Pre-Signed URL to expires in certain time frame (Check your Cloud API documentation). If your file doesn&#8217;t need credentials to access then you don&#8217;t have to worry about Pre-Signed URL. Your source can be file URL  (E.g. https://mysite.com/downloads/fil1.zip)</p>
<p><strong>Pre-Signed URL for Google Cloud (GCP)</strong><br />
Here is more information <a title="Create Presigned URL for Google Cloud Platform file (GCP file)" href="https://cloud.google.com/storage/docs/access-control/create-signed-urls-gsutil" target="_blank">how to get Pre-Signed URL for Google Cloud Platform (GCP) </a>&#8211; Use gsutil command line<br />
<strong>Pre-Signed URL for Amazon AWS (S3 file)</strong><br />
To create pre-signed URL for AWS S3 files you can use <a href="//zappysys.com/products/ssis-powerpack/ssis-amazon-s3-task/" target="_blank">SSIS Amazon Storage Task</a> and use Get Pre-Signed URL Action (Described in the below section). This action supports creating pre-signed URLs for multiple files using wildcard (e.g /mybkt/*.zip)  or you can get single pre-signed URL. If you use pattern search then you will get DataTable back &#8230; which can be loop through using ForEach Loop task (Loop ADO Recordset option) . If you do not use wild card then only one URL returned in string format.</p>
<h2>Prerequisites</h2>
<p>Before we look at next section make sure following prerequisites are met</p>
<ol>
<li>You have obtained Amazon S3 Access Key and Secret Key to access desired files</li>
<li>You have obtained Azure Storage Account Name and Account Key to access desired Blob Container. If you don&#8217;t have access to Azure then you can download Azure Storage Emulator for testing Purpose. <a href="https://zappysys.com/forums/topic/azure-blob-storage-how-to-download-and-test-azure-storage-emulator/" target="_blank">Check this</a>.</li>
<li>You have basic knowledge of SSIS. If you dont then search for SSIS tutorial and there are many blogs / tutorials to get started 🙂</li>
</ol>
<h2>Step-By-Step &#8211; Create SSIS Package &#8211; Copy Amazon S3 Files to Azure Blob Storage</h2>
<p>Now lets look at how to copy Amazon S3 files to Azure in few clicks. This approach doesn&#8217;t bring any data to your local system so its purely server to server copy and that is why its very fast and secure.</p>
<ol>
<li>First Download and <a href="//zappysys.com/products/ssis-powerpack/" target="_blank">Install SSIS PowerPack</a></li>
<li>Once you install SSIS PowerPack. Create a new Sample SSIS Project and open Package</li>
<li>From SSIS Toolbox Drag <a href="//zappysys.com/products/ssis-powerpack/ssis-amazon-s3-task/" target="_blank">ZS Amazon Storage Task</a> and drop on Control Flow surface. Rename it to <strong>Get S3 File Urls</strong></li>
<li>Double click S3 task to edit. From Action dropdown select (Get Amazon S3 Files Pre-Signed Url Option)</li>
<li>Click New next to the Connection Dropdown to create Amazon Storage Connection. Enter your credentials and bucket region and Click Test. If you are <a href="https://zappysys.com/blog/check-amazon-s3-bucket-location-region/" target="_blank">not sure about your bucket region then check this article</a>.
<div id="attachment_2196" style="width: 647px" class="wp-caption alignnone"><a href="//zappysys.com/wp-content/uploads/2017/04/ssis-aws-to-azure-copy-create-pre-signed-url-multiple-files.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2196" class="size-full wp-image-2196" src="//zappysys.com/wp-content/uploads/2017/04/ssis-aws-to-azure-copy-create-pre-signed-url-multiple-files.png" alt="SSIS Amazon Storage Task - Create Pre-Signed URLs for multiple files stored in S3" width="637" height="824" /></a><p id="caption-attachment-2196" class="wp-caption-text">SSIS Amazon Storage Task &#8211; Create Pre-Signed URLs for multiple files stored in S3</p></div></li>
<li>Now click on Advanced Tab and check Use region specific endpoint option
<div id="attachment_2197" style="width: 414px" class="wp-caption alignnone"><a href="//zappysys.com/wp-content/uploads/2017/04/ssis-amazon-s3-connection-region-specific-endpoint.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2197" class="size-full wp-image-2197" src="//zappysys.com/wp-content/uploads/2017/04/ssis-amazon-s3-connection-region-specific-endpoint.png" alt="SSIS Amazon S3 Connection - Region specific endpoint option" width="404" height="200" /></a><p id="caption-attachment-2197" class="wp-caption-text">SSIS Amazon S3 Connection &#8211; Region specific endpoint option</p></div></li>
<li>Once Test connection is green you can click OK to save connection.</li>
<li>Once you back to Amazon Storage Task UI&#8230; Click on browse next to S3 file path. Her you can select one file or enter pattern to create URLs for multiple files.</li>
<li>To save pre-signed URL(s) select Variable. If variable is not there then create new one&#8230; If you enter pattern in Source path then Variable must be Object datatype. For multiple URL it will return ADO Recordset (You can use with ForEach Loop Task). If you didn&#8217;t enter pattern in source path then variable can be string datatype.
<div id="attachment_2198" style="width: 845px" class="wp-caption alignnone"><a href="//zappysys.com/wp-content/uploads/2017/04/ssis-get-presigned-url-for-multiple-amazon-s3-files-for-loop.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2198" class="size-full wp-image-2198" src="//zappysys.com/wp-content/uploads/2017/04/ssis-get-presigned-url-for-multiple-amazon-s3-files-for-loop.png" alt="SSIS Amazon Storage Task - Save Pre-Signed URL to Variable (Save Multiple URL as Recordset )" width="835" height="681" /></a><p id="caption-attachment-2198" class="wp-caption-text">SSIS Amazon Storage Task &#8211; Save Pre-Signed URL to Variable (Save Multiple URL as Recordset )</p></div></li>
<li>Now drag and drop ForEach Loop Container on the surface and configure like below
<div id="attachment_2199" style="width: 660px" class="wp-caption alignnone"><a href="//zappysys.com/wp-content/uploads/2017/04/ssis-foreach-loop-amazon-s3-files-presigned-url.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2199" class="size-full wp-image-2199" src="//zappysys.com/wp-content/uploads/2017/04/ssis-foreach-loop-amazon-s3-files-presigned-url.png" alt="SSIS ForEach Loop Container Task - Loop through Amazon S3 file URL" width="650" height="550" /></a><p id="caption-attachment-2199" class="wp-caption-text">SSIS ForEach Loop Container Task &#8211; Loop through Amazon S3 file URL</p></div>
<div id="attachment_2200" style="width: 450px" class="wp-caption alignnone"><a href="//zappysys.com/wp-content/uploads/2017/04/ssis-foreach-loop-variable-mapping-each-iteration.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2200" class="size-full wp-image-2200" src="//zappysys.com/wp-content/uploads/2017/04/ssis-foreach-loop-variable-mapping-each-iteration.png" alt="SSIS ForEach Loop Task - Variable Mappings" width="440" height="365" /></a><p id="caption-attachment-2200" class="wp-caption-text">SSIS ForEach Loop Task &#8211; Variable Mappings</p></div></li>
<li>Once Foreach Loop is configured you can drag <a href="//zappysys.com/products/ssis-powerpack/ssis-azure-blob-storage-task/" target="_blank">ZS Azure Storage Task</a> inside ForEach Loop Container</li>
<li>Double click Azure storage task and select [<strong>Copy from external file</strong>] option from Action dropdown.</li>
<li>In the source Path/URL we will enter variable name which holds current URL for ForEach Loop iteration. Easy way is click blue variable icon and select &lt;&lt;Insert Variable&gt;&gt;. Your placeholder may look like below.<br />
<pre class="crayon-plain-tag">{{User::varCurrentS3Url}}</pre>
</li>
<li>For target path &#8230; Click New Connection to create and configure new <strong>Azure Storage Connection</strong> like below. Enter Azure storage credentials and click test. If you don&#8217;t have real Azure credentials then you can use <a href="https://zappysys.com/forums/topic/azure-blob-storage-how-to-download-and-test-azure-storage-emulator/" target="_blank">Azure Storage Emulator (Check this)</a>. Once connection is Configured click Test connection and click OK to save connection.
<div id="attachment_2201" style="width: 898px" class="wp-caption alignnone"><a href="//zappysys.com/wp-content/uploads/2017/04/ssis-configure-azure-storage-task-copy-aws-s3-file.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2201" class="size-full wp-image-2201" src="//zappysys.com/wp-content/uploads/2017/04/ssis-configure-azure-storage-task-copy-aws-s3-file.png" alt="Azure Storage Task - Configure Blob Storage connection- Serverside Copy S3 files - AWS to Azure" width="888" height="829" /></a><p id="caption-attachment-2201" class="wp-caption-text">Azure Storage Task &#8211; Configure Blob Storage connection- Serverside Copy S3 files &#8211; AWS to Azure</p></div></li>
<li>Once everything is configure you can save package and execute. This will copy S3 files to Azure Blob storage.</li>
<li>Here is execution log<br />
<pre class="crayon-plain-tag">SSIS package &quot;C:\SSIS\Amazon-To-Azure-Copy.dtsx&quot; starting.
Information: 0x0 at Get Signed URL for S3 Files, Get Signed URL for S3 Files: You are running TRIAL version. It will expire in 29 day(s)
Information: 0x0 at Get Signed URL for S3 Files, Get Signed URL for S3 Files: Reading [PRESIGNED-URL] property for zs-eu-west-2-london-bkt2/*.*
Information: 0x0 at Copy S3 File to Azure, Copy S3 File to Azure: Copy started: Source=https://zs-eu-west-2-london-bkt2.s3.eu-west-2.amazonaws.com/cloudfile1.csv, Target=test1/
Information: 0x0 at Copy S3 File to Azure, Copy S3 File to Azure: Copying https://zs-eu-west-2-london-bkt2.s3.eu-west-2.amazonaws.com/cloudfile1.csv ...
Information: 0x0 at Copy S3 File to Azure, Copy S3 File to Azure: Copy started: Source=https://zs-eu-west-2-london-bkt2.s3.eu-west-2.amazonaws.com/cloudfile3.txt, Target=test1/
Information: 0x0 at Copy S3 File to Azure, Copy S3 File to Azure: Copying https://zs-eu-west-2-london-bkt2.s3.eu-west-2.amazonaws.com/cloudfile3.txt ...
SSIS package &quot;C:\SSIS\Amazon-To-Azure-Copy.dtsx&quot; finished: Success.</pre>
<div id="attachment_1100" style="width: 712px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/04/ssis-package-copy-multiple-s3-files-amazon-aws-to-azure.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1100" class="size-full wp-image-1100" src="//zappysys.com/blog/wp-content/uploads/2017/04/ssis-package-copy-multiple-s3-files-amazon-aws-to-azure.png" alt="SSIS Package Execution - Copy Multiple S3 Files from Amazon to Azure" width="702" height="380" srcset="https://zappysys.com/blog/wp-content/uploads/2017/04/ssis-package-copy-multiple-s3-files-amazon-aws-to-azure.png 702w, https://zappysys.com/blog/wp-content/uploads/2017/04/ssis-package-copy-multiple-s3-files-amazon-aws-to-azure-300x162.png 300w" sizes="(max-width: 702px) 100vw, 702px" /></a><p id="caption-attachment-1100" class="wp-caption-text">SSIS Package Execution &#8211; Copy Multiple S3 Files from<br />Amazon to Azure</p></div></li>
</ol>
<p>&nbsp;</p>
<h2>How to move Amazon S3 files to Azure</h2>
<p>In above example you saw how to copy files from Amazon S3 to Azure Blob Storage. But what if you want to Move&#8230; so once file is copied you want to delete from source. In that case its simple. Add one more Amazon S3 Task at the end so if all previous steps successful you can Issue delete files command using ZS Amazon Storage Task.</p>
<div id="attachment_2204" style="width: 602px" class="wp-caption alignnone"><a href="//zappysys.com/wp-content/uploads/2017/04/ssis-delete-amazon-s3-files.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2204" class="size-full wp-image-2204" src="//zappysys.com/wp-content/uploads/2017/04/ssis-delete-amazon-s3-files.png" alt="SSIS Delete Amazon S3 Files after Successful S3 to Azure Copy operation (This will mimic Move)" width="592" height="550" /></a><p id="caption-attachment-2204" class="wp-caption-text">SSIS Delete Amazon S3 Files after Successful S3 to Azure Copy operation (This will mimic Move)</p></div>
<h2>Download Sample SSIS Package</h2>
<p><a href="//zappysys.com/blog/wp-content/uploads/2017/04/SSIS-Amazon-S3-To-Azure-Copy-Move.zip">Click here to download sample SSIS file for SQL Server 2012, 2014, 2016</a></p>
<h2>Conclusion</h2>
<p>If you want to bring data from Amazon S3 to Azure in fastest way then technique described in this article can help you to cut down your data transfer time by several times. <a href="//zappysys.com/products/ssis-powerpack/">SSIS PowerPack</a> comes with 45+ components and tasks which can give you drag and drop interface for your Cloud connectivity projects. It also comes with many connectors to help with JSON, XML, REST API related integration. Try <a href="//zappysys.com/products/ssis-powerpack/">SSIS PowerPack</a> for FREE without any limitation and find out what else you can do with it.</p>
<p>The post <a href="https://zappysys.com/blog/ssis-copy-move-amazon-s3-files-from-aws-to-azure/">SSIS &#8211; Copy Amazon S3 files from AWS to Azure</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Loading data from SQL Server to Amazon S3 in SSIS (Split Files, GZip)</title>
		<link>https://zappysys.com/blog/load-data-sql-server-to-amazon-s3/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Wed, 27 Jul 2016 22:07:34 +0000</pubDate>
				<category><![CDATA[SSIS Amazon S3 CSV Dest]]></category>
		<category><![CDATA[SSIS Amazon Storage Task]]></category>
		<category><![CDATA[SSIS CSV Export Task]]></category>
		<category><![CDATA[Amazon S3]]></category>
		<category><![CDATA[Amazon S3 Task]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[CSV]]></category>
		<category><![CDATA[export]]></category>
		<category><![CDATA[Export CSV Task]]></category>
		<category><![CDATA[sql server]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=704</guid>

					<description><![CDATA[<p>Introduction In this blog post you will see how easy it is to load large amount of data from SQL Server to Amazon S3 Storage. For demo purpose we will use SQL Server as relational source but you can use same steps for any database engine such as Oracle, MySQL, DB2. In this post we [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/load-data-sql-server-to-amazon-s3/">Loading data from SQL Server to Amazon S3 in SSIS (Split Files, GZip)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p>In this blog post you will see how easy it is to load large amount of data from <em>SQL Server to Amazon S3</em> Storage. For demo purpose we will use SQL Server as relational source but you can use same steps for any database engine such as Oracle, MySQL, DB2. In this post we will use <a href="//zappysys.com/products/ssis-powerpack/ssis-export-csv-file-task/" target="_blank" rel="noopener">Export CSV Task</a> and <a href="//zappysys.com/products/ssis-powerpack/ssis-amazon-s3-task/" target="_blank" rel="noopener">Amazon S3 Storage Task </a> to achieve desired integration with Amazon S3 with drag and drop approach. You can also export JSON or XML data to Amazon S3 using same techniques (Use <a href="//zappysys.com/products/ssis-powerpack/ssis-export-json-file-task/" target="_blank" rel="noopener">Export JSON Task</a>  or <a href="//zappysys.com/products/ssis-powerpack/ssis-export-xml-file-task/" target="_blank" rel="noopener">Export XML Task</a> ).</p>
<p>Our goal is to achieve following things</p>
<ul>
<li>Extract large amount of data from SQL Server Table or Query and export to CSV files</li>
<li>Generate CSV files in compressed format (*.gz) to speedup upload and save data transfer cost to S3</li>
<li>Split CSV files by row count</li>
<li>Upload data to Amazon S3 using highly parallel manner for maximum speed</li>
</ul>
<p>There are three different ways you can achieve data export to Amazon S3 using SSIS.</p>
<ol>
<li><strong>Method-1 (Fastest)</strong>: Use two step process (First export SQL Server data to local files using <a href="//zappysys.com/products/ssis-powerpack/ssis-export-csv-file-task/" target="_blank" rel="noopener">Export Task</a> and then upload files to S3 using  <a href="//zappysys.com/products/ssis-powerpack/ssis-amazon-s3-task/" target="_blank" rel="noopener">Amazon S3 Storage Task </a> )</li>
<li><strong>Method-2 (Slower)</strong>: Use <a href="//zappysys.com/products/ssis-powerpack/ssis-export-csv-file-task/" target="_blank" rel="noopener">Export Task</a> with Amazon S3 Connection as Target rather than save to Local files.</li>
<li><strong>Method-3 (Slower)</strong>: Use Data flow components like <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-csv-file-destination/" target="_blank" rel="noopener">Amazon S3 Destination for CSV</a>  (for JSON / XML  use Method1 or Method2)</li>
</ol>
<p>Each method has its own advantage / disadvantage. If you prefer to upload / compress / split large amount of data then we recommend Method#1 (Two steps). If you have not very huge dataset then you can use Method#2 or Method#3. For Last method you can only use CSV export option (we don&#8217;t have JSON/ XML Destination for Amazon S3 yet &#8211; we may add in future)</p>
<p><strong>Screenshot of SSIS Package</strong></p>
<div id="attachment_707" style="width: 710px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/07/ssis-export-sql-server-data-upload-to-amazon-s3.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-707" class="wp-image-707" src="//zappysys.com/blog/wp-content/uploads/2016/07/ssis-export-sql-server-data-upload-to-amazon-s3.png" alt="Extract SQL Server Data to CSV files in SSIS (Bulk export) and Split / GZip Compress / upload files to Amazon S3 (AWS Cloud)" width="700" height="365" srcset="https://zappysys.com/blog/wp-content/uploads/2016/07/ssis-export-sql-server-data-upload-to-amazon-s3.png 825w, https://zappysys.com/blog/wp-content/uploads/2016/07/ssis-export-sql-server-data-upload-to-amazon-s3-300x156.png 300w" sizes="(max-width: 700px) 100vw, 700px" /></a><p id="caption-attachment-707" class="wp-caption-text">Extract SQL Server Data to CSV files in SSIS (Bulk export) and Split / GZip Compress / upload files to Amazon S3 (AWS Cloud)</p></div>
<h2>Method-1 : Upload SQL data to Amazon S3 in Two steps</h2>
<p>In this section we will see first method (recommended) to upload SQL data to Amazon S3. This is the fastest approach if you have lots of data to upload.  In this approach we first create CSV files from SQL Server data on local disk using <a href="https://zappysys.com/products/ssis-powerpack/ssis-export-csv-file-task/" target="_blank" rel="noopener">SSIS Export CSV Task</a>. After that in second step we upload all files to Amazon S3 using <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-task/" target="_blank" rel="noopener">SSIS Amazon Storage Task</a>.</p>
<h3>Step-1: Configure Source Connection in Export CSV Task</h3>
<p>To extract data from SQL Server you can use Export CSV Task. It has many options which makes it possible to split large amount of data into multiple files. You can specify single table or multiple tables as your data source.</p>
<p>For multiple table use vertical bar. e.g.  dbo.Customers|dbo.Products|dbo.Orders. When you export this it will create 3 files ( dbo.Customers.csv , dbo.Products.csv, dbo.Orders.csv )</p>
<p><strong>Steps:</strong></p>
<ol>
<li>Drag ZS Export CSV Task from Toolbox</li>
<li>Double click task to configure</li>
<li>From connection drop down select New connection option (OLEDB or ADO.net)</li>
<li>Once connection is configured for Source database specify SQL Query to extract data as below
<div id="attachment_705" style="width: 528px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/07/export-sql-server-table-query-data-to-csv-fast.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-705" class="size-full wp-image-705" src="//zappysys.com/blog/wp-content/uploads/2016/07/export-sql-server-table-query-data-to-csv-fast.png" alt="Export SQL Server Table or Query as CSV file (Bulk export in SSIS)" width="518" height="494" srcset="https://zappysys.com/blog/wp-content/uploads/2016/07/export-sql-server-table-query-data-to-csv-fast.png 518w, https://zappysys.com/blog/wp-content/uploads/2016/07/export-sql-server-table-query-data-to-csv-fast-300x286.png 300w" sizes="(max-width: 518px) 100vw, 518px" /></a><p id="caption-attachment-705" class="wp-caption-text">Export SQL Server Table or Query as CSV file (Bulk export in SSIS)</p></div></li>
<li>Now go to target tab. Here you can specify full path for file. e.g. c:\ssis\temp\s3dump\cust.csv</li>
</ol>
<h3>Step-2: Compress CSV Files in SSIS ( GZIP format &#8211; *.gz )</h3>
<p>Above steps will export file as CSV format without splitting or compression. But to compress file once exported you can go to Target tab of Export CSV Task and check [<strong>Compress file to *.gz format</strong>] option.</p>
<div id="attachment_706" style="width: 579px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/07/compress-csv-files-in-ssis.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-706" class="size-full wp-image-706" src="//zappysys.com/blog/wp-content/uploads/2016/07/compress-csv-files-in-ssis.png" alt="Compress exported SQL Server data files to GZip ( *.gz) in SSIS Export CSV Task" width="569" height="462" srcset="https://zappysys.com/blog/wp-content/uploads/2016/07/compress-csv-files-in-ssis.png 569w, https://zappysys.com/blog/wp-content/uploads/2016/07/compress-csv-files-in-ssis-300x244.png 300w" sizes="(max-width: 569px) 100vw, 569px" /></a><p id="caption-attachment-706" class="wp-caption-text">Compress exported SQL Server data files to GZip ( *.gz) in SSIS Export CSV Task</p></div>
<h3>Step-3: Split CSV files by row count or data size in SSIS</h3>
<p>Now lets look at how to split exported CSV files into multiple files so we can upload many files in parallel. Goto Split Options and check [<strong>Enable Split by Size/Rows</strong>]
<div id="attachment_708" style="width: 435px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/07/ssis-export-split-csv-files-sql-data.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-708" class="size-full wp-image-708" src="//zappysys.com/blog/wp-content/uploads/2016/07/ssis-export-split-csv-files-sql-data.png" alt="Using SSIS Split Exported CSV files (Split by row count or size)" width="425" height="489" srcset="https://zappysys.com/blog/wp-content/uploads/2016/07/ssis-export-split-csv-files-sql-data.png 425w, https://zappysys.com/blog/wp-content/uploads/2016/07/ssis-export-split-csv-files-sql-data-261x300.png 261w" sizes="(max-width: 425px) 100vw, 425px" /></a><p id="caption-attachment-708" class="wp-caption-text">Using SSIS Split Exported CSV files (Split by row count or size)</p></div>
<h3>Step-4: Upload CSV files to Amazon S3 &#8211; Using multi threaded option</h3>
<p>Now final thing is use <a href="//zappysys.com/products/ssis-powerpack/ssis-amazon-s3-task/" target="_blank" rel="noopener">Amzon S3 Task</a> to upload files to S3.</p>
<h3>Things to remember</h3>
<p>Sometimes times due to high network activity you may get timeout errors during upload. In that case you can adjust few settings <a href="https://zappysys.com/forums/topic/change-timeout-value-amazon-s3-operations/" target="_blank" rel="noopener">described here</a>. Also try to reduce total parallel threads on S3 Connection see that helps.</p>
<p><strong>Steps:</strong></p>
<ol>
<li>Drag ZS Amazon Storage Task from SSIS toolbox</li>
<li>Double click Amazon Storage Task to configure it</li>
<li>Specify Action = UploadFilesToAmazon</li>
<li>Specify Source file path (or pattern) e.g. c:\SSIS\temp\s3dump\*.*</li>
<li>Now in the Target connection dropdown click [New]</li>
<li>When Connection UI opens select Service Type = S3</li>
<li>Enter your Access Key, Secret Key and Region (Leave all other parameters default if you not sure)</li>
<li>Click Test and close connection UI</li>
<li>On the Target path on S3 Storage Task enter your bucket and folder path where you want to upload local files. For example your bucket name is bw-east-1 and folder is sqldata then enter as below<br />
<strong>bw-east-1/sqldata/</strong></li>
<li>Click ok and Run package to test full package</li>
</ol>
<div id="attachment_709" style="width: 709px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/07/ssis-uploading-files-to-amazon-s3.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-709" class="wp-image-709" src="//zappysys.com/blog/wp-content/uploads/2016/07/ssis-uploading-files-to-amazon-s3.png" alt="Upload local files to Amazon S3 using SSIS AWS Storage Task" width="699" height="466" srcset="https://zappysys.com/blog/wp-content/uploads/2016/07/ssis-uploading-files-to-amazon-s3.png 953w, https://zappysys.com/blog/wp-content/uploads/2016/07/ssis-uploading-files-to-amazon-s3-300x200.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/07/ssis-uploading-files-to-amazon-s3-272x182.png 272w" sizes="(max-width: 699px) 100vw, 699px" /></a><p id="caption-attachment-709" class="wp-caption-text">Upload local files to Amazon S3 using SSIS AWS Storage Task</p></div>
<h2></h2>
<h2>Method-2 : Upload SQL data to Amazon S3 without local stage (One step)</h2>
<p>Now let&#8217;s change previous approach little bit to send SQL server data directly to Amazon S3 without any Landing area on local disk.  <a href="//zappysys.com/products/ssis-powerpack/ssis-export-csv-file-task/" target="_blank" rel="noopener">Export CSV Task</a> , <a href="//zappysys.com/products/ssis-powerpack/ssis-export-json-file-task/" target="_blank" rel="noopener">Export JSON Task</a>  and <a href="//zappysys.com/products/ssis-powerpack/ssis-export-xml-file-task/" target="_blank" rel="noopener">Export XML Task</a> all of them supports Amazon S3 / Azure Blob and Secure FTP (SFTP) connection as target (Only available in <strong>Pro Edition</strong>). We will use this feature in following section.</p>
<p>This approach helps to avoid any local disk need and it may be useful for security reason for some users. However drawback of this approach is, it wont use parallel threads to upload large amount of data like previous method.</p>
<p>Following change will be needed on Export task to upload SQL data directly to S3 / FTP or Azure storage.</p>
<div id="attachment_5252" style="width: 859px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/07/ssis-export-sql-data-to-s3-csv-compress-gzip.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5252" class="size-full wp-image-5252" src="https://zappysys.com/blog/wp-content/uploads/2016/07/ssis-export-sql-data-to-s3-csv-compress-gzip.png" alt="Export SQL data to multiple files to Amazon S3, Azure, Secure FTP (SFTP) in Stream Mode. Compress GZip, Overwrite, Split Options" width="849" height="627" srcset="https://zappysys.com/blog/wp-content/uploads/2016/07/ssis-export-sql-data-to-s3-csv-compress-gzip.png 849w, https://zappysys.com/blog/wp-content/uploads/2016/07/ssis-export-sql-data-to-s3-csv-compress-gzip-300x222.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/07/ssis-export-sql-data-to-s3-csv-compress-gzip-768x567.png 768w" sizes="(max-width: 849px) 100vw, 849px" /></a><p id="caption-attachment-5252" class="wp-caption-text">Export SQL data to multiple files to Amazon S3, Azure, Secure FTP (SFTP) in Stream Mode using SSIS. Configure Compress GZip, Overwrite, Split Options</p></div>
<h2>Method-3 : Using Amazon S3 destination &#8211; Generate Amazon S3 file from any source</h2>
<p>Now let&#8217;s look at third approach to save data from any SSIS Source to Amazon S3 file. Advantage of this approach is you are not limited to few source options provided by Export CSV Task. If you have complex data transformation needed in Data Flow before sending data to S3 then use this approach.  We will use <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-csv-file-destination/" target="_blank" rel="noopener">Amazon S3 Destination for CSV</a> as below</p>
<ol>
<li>Drag SSIS Data flow task from toolbox</li>
<li>Create necessary source connection (e.g. OLEDB connection)</li>
<li>Create Amazon S3 Connection (Right click in Connection Managers panel in bottom and click New connection and select <strong>ZS-AMAZON-STORAGE</strong> type )</li>
<li>Once connection managers are created Go to data flow designer and Drag OLEDB Source</li>
<li>Configure OLEDB Source to read desired data from source system (e.g. SQL Server / Oracle)</li>
<li>Once source is configured drag <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-csv-file-destination/" target="_blank" rel="noopener">ZS Amazon S3 CSV File Destination</a> from SSIS toolbox</li>
<li>Double click S3 Destination and configure as below
<ol>
<li>On Connection Managers tab select S3 Connection (We created in earlier section).</li>
<li>Properties tab configure like below screenshot</li>
<li>On Input Columns tab select desired column you like to write in the target file. Your name from upstream will be taken as is for target file. So make sure to name upstream columns correctly.</li>
<li>Click OK to save UI</li>
</ol>
</li>
<li>Execute package and check your S3 Bucket to see files got created.</li>
</ol>
<div id="attachment_5253" style="width: 729px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/07/ssis-amazon-s3-csv-destination-split-compress-gzip-options.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5253" class="size-full wp-image-5253" src="https://zappysys.com/blog/wp-content/uploads/2016/07/ssis-amazon-s3-csv-destination-split-compress-gzip-options.png" alt="Loading SQL Server data into S3 Bucket Files (Split, Compress Gzip Options) - SSIS Amazon S3 CSV File Destination" width="719" height="782" srcset="https://zappysys.com/blog/wp-content/uploads/2016/07/ssis-amazon-s3-csv-destination-split-compress-gzip-options.png 719w, https://zappysys.com/blog/wp-content/uploads/2016/07/ssis-amazon-s3-csv-destination-split-compress-gzip-options-276x300.png 276w" sizes="(max-width: 719px) 100vw, 719px" /></a><p id="caption-attachment-5253" class="wp-caption-text">Loading SQL Server data into S3 Bucket Files (Split, Compress Gzip Options) &#8211; SSIS Amazon S3 CSV File Destination</p></div>
<h2>Conclusion</h2>
<p>In this post you have seen how easy it is to upload / archive your SQL Server data (or any other RDBMS data) to Amazon S3 Storage in few clicks. <a href="//zappysys.com/products/ssis-powerpack/">Try SSIS PowerPack</a> for free and find out yourself how easy it is to integrate SQL Server and Amazon S3 using SSIS.</p>
<p>The post <a href="https://zappysys.com/blog/load-data-sql-server-to-amazon-s3/">Loading data from SQL Server to Amazon S3 in SSIS (Split Files, GZip)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
