<?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>s3 Archives | ZappySys Blog</title>
	<atom:link href="https://zappysys.com/blog/tag/s3/feed/" rel="self" type="application/rss+xml" />
	<link>https://zappysys.com/blog/tag/s3/</link>
	<description>SSIS / ODBC Drivers / API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more</description>
	<lastBuildDate>Mon, 07 Apr 2025 13:01:41 +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>s3 Archives | ZappySys Blog</title>
	<link>https://zappysys.com/blog/tag/s3/</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>Read Amazon S3 data in Power BI or Call AWS REST API (JSON / XML)</title>
		<link>https://zappysys.com/blog/read-amazon-s3-data-power-bi-aws-json-xml-api/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Fri, 15 Jun 2018 23:03:05 +0000</pubDate>
				<category><![CDATA[Amazon S3 CSV Driver]]></category>
		<category><![CDATA[Amazon S3 JSON Driver]]></category>
		<category><![CDATA[Amazon S3 XML Driver]]></category>
		<category><![CDATA[JSON File / REST API Driver]]></category>
		<category><![CDATA[ODBC PowerPack]]></category>
		<category><![CDATA[Reporting - Microsoft Power BI]]></category>
		<category><![CDATA[XML File / SOAP API Driver]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[lambda]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[s3]]></category>
		<category><![CDATA[xml]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=3974</guid>

					<description><![CDATA[<p>Introduction If you are looking around to find connectivity options to get Amazon AWS data in Power BI (e.g. Read from Amazon S3 files (CSV, JSON, XML) or get AWS API data such as Billing Data by calling REST API) then unfortunately as of now Power BI doesn&#8217;t support it natively. In this article, you will [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/read-amazon-s3-data-power-bi-aws-json-xml-api/">Read Amazon S3 data in Power BI or Call AWS REST API (JSON / XML)</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/06/power-bi-logo-310x310.png"><img loading="lazy" decoding="async" class=" wp-image-3951 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2018/06/power-bi-logo-310x310.png" alt="Power BI Integration" width="131" height="131" srcset="https://zappysys.com/blog/wp-content/uploads/2018/06/power-bi-logo-310x310.png 310w, https://zappysys.com/blog/wp-content/uploads/2018/06/power-bi-logo-310x310-150x150.png 150w, https://zappysys.com/blog/wp-content/uploads/2018/06/power-bi-logo-310x310-300x300.png 300w" sizes="(max-width: 131px) 100vw, 131px" /></a>If you are looking around to find connectivity options to get Amazon AWS data in Power BI (e.g. Read from Amazon S3 files (CSV, JSON, XML) or get AWS API data such as Billing Data by calling REST API) then unfortunately as of now Power BI doesn&#8217;t support it natively.</p>
<p>In this article, you will learn  <strong>How to read Amazon S3 data in Power BI</strong> (Using <a href="https://zappysys.com/products/odbc-powerpack/amazon-s3-odbc-driver-csv-files/" target="_blank" rel="noopener">S3 CSV Driver</a>) and in later section we will also learn <strong>How to import data from AWS API Calls (e.g. Billing, EC2, S3, DynamoDB)</strong>. We will use <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ZappySys REST / JSON Driver</a> to access AWS data without any ETL or Programming.</p>
<p>In our previous article, we discussed how to <a href="https://zappysys.com/blog/howto-import-json-rest-api-power-bi/">access REST API data in Power BI (Read JSON / XML Web API)</a>. Now let&#8217;s learn <strong>how to connect to AWS in Power BI</strong>.</p>
<p>In this article, We will explore interesting scenarios such as below. It will help you to connect Amazon AWS in Power BI and import data from AWS <strong>without doing any ETL or programming</strong>.</p>
<ul>
<li>Import JSON file from S3 bucket in Power BI (Using <a href="https://zappysys.com/products/odbc-powerpack/amazon-s3-odbc-driver-json-files/" target="_blank" rel="noopener">Amazon S3 Driver for JSON Files</a>).</li>
<li>Read CSV file from S3 bucket in Power BI (Using <a href="https://zappysys.com/products/odbc-powerpack/amazon-s3-odbc-driver-csv-files/" target="_blank" rel="noopener">Amazon S3 Driver for CSV Files</a>).</li>
<li>Read XML file from S3 bucket in Power BI (Using <a href="https://zappysys.com/products/odbc-powerpack/amazon-s3-odbc-driver-xml-files/" target="_blank" rel="noopener">Amazon S3 Driver for XML Files</a>).</li>
<li>Call Amazon AWS REST API (JSON or XML) and get data in Power BI. Some examples of API calls.
<ul>
<li>Get <strong>EC2 VM</strong> count and their Status in Power BI Dashboard</li>
<li>Read data from <strong>AWS Athena</strong> Service</li>
<li>Use <strong>AWS Cost / Billing API</strong> to display monthly Cost by Service</li>
<li>Display summary of <strong>Redshift</strong> Clusters</li>
<li>Extract response from <strong>Lambda</strong> function and display in Power BI</li>
</ul>
</li>
</ul>
<p>So let&#8217;s get started&#8230;</p>
<h2><span id="Requirements">Requirements</span></h2>
<ol>
<li>First, you will need to have <a href="https://powerbi.microsoft.com/en-us/desktop/" target="_blank" rel="noopener">Power BI Desktop (FREE)</a> installed</li>
<li>Make sure you have <strong>AWS Access Key</strong> and <strong>Secret Key</strong> to access AWS data or call API for the desired service</li>
<li>On third place, our <a href="https://zappysys.com/products/odbc-powerpack/">ZappySys ODBC Power Pack</a></li>
</ol>
<h2>Import Amazon S3 data in Power BI (CSV, JSON or XML Files)</h2>
<p>In this section we will look at step by step approach to load Amazon S3 data in Power BI. Your file can be compressed  (GZip, Zip) or un-compressed. We will use ZappySys <a href="https://zappysys.com/products/odbc-powerpack/amazon-s3-odbc-driver-csv-files/" target="_blank" rel="noopener">Amazon S3 driver for CSV Files</a> for demo but you can also use <a href="https://zappysys.com/products/odbc-powerpack/amazon-s3-odbc-driver-json-files/" target="_blank" rel="noopener">Amazon S3 JSON Driver</a> or <a href="https://zappysys.com/products/odbc-powerpack/amazon-s3-odbc-driver-xml-files/" target="_blank" rel="noopener">Amazon S3 Driver for XML Files</a> same way for reading different file formats.</p>
<h3><span id="Step-by-Step_Import_REST_API_into_Power_BI">Configure ODBC DSN for Amazon S3 Files ( JSON / XML / CSV )</span></h3>
<p>&nbsp;</p>
<ol>
<li>Type odbcad32.exe in your search box and launch the DSN Config utility.<img decoding="async" class="figureimage" src="https://zappysys.com/blog/wp-content/uploads/2018/03/odbc-data-source-64-bits.png" /></li>
<li>you want access for yourself then stay of User DSN Tab. If you want grant access other users then go to System DSN tab. For <a href="https://zappysys.com/onlinehelp/odbc-powerpack/scr/odbc-integration-programming-tsql.htm">SQL Server Integration</a> go to System Tab and add new System DSN rather than User DSN. Click New button.<br />
<img decoding="async" class="figureimage" title="ZappySys ODBC Driver - Open UI" src="https://zappysys.com/onlinehelp/odbc-powerpack/scr/images/zappysys-odbc-driver-open-ui.png" alt="ZappySys ODBC Driver - Open UI" /></li>
<li>From the Driver list Select ZappySys ODBC Driver. For this example select [<strong>ZappySys Amazon S3 CSV Driver</strong>].<br />
<img decoding="async" class="figureimage" title="ZappySys ODBC Driver - Create Amazon S3 CSV Driver" src="https://zappysys.com/onlinehelp/odbc-powerpack/scr/images/amazon-s3-csv-driver/amazon-s3-csv-driver-create.png" alt="ZappySys ODBC Driver - Create Amazon S3 CSV Driver" /></li>
<li>Now, we need Amazon S3 Storage Connection. Lets create it.<br />
<img decoding="async" class="figureimage" title="ODBC Amazon S3 Driver - Create Connection" src="https://zappysys.com/onlinehelp/odbc-powerpack/scr/images/amazon-s3-json-driver/amazon-s3-json-driver-create-connection.png" alt="ODBC Amazon S3 Driver - Create Connection" /></li>
<li>Now, When you see DSN Config Editor with zappysys logo first thing you need to do is change default DSN Name at the top and Select your bucket and file from it.<br />
<img decoding="async" class="figureimage" title="ODBC Amazon S3 Driver - Select File" src="https://zappysys.com/onlinehelp/odbc-powerpack/scr/images/amazon-s3-csv-driver/amazon-s3-csv-driver-select-file.png" alt="ODBC Amazon S3 Driver - Select File" /></li>
<li>Here, in the Compression (Zip/GZip) tab set suitable file format.<br />
<img decoding="async" class="figureimage" title="ZappySys ODBC Driver - Configure Amazon S3 CSV Driver" src="https://zappysys.com/onlinehelp/odbc-powerpack/scr/images/amazon-s3-csv-driver/amazon-s3-csv-driver-set-compression-file-format.png" alt="ZappySys ODBC Driver - Configure Amazon CSV Driver" /></li>
<li>Click on Preview Tab, Select Table from Tables Dropdown and select [value] and click Preview.<br />
<img decoding="async" class="figureimage" title="ZappySys ODBC Driver - Preview Data" src="https://zappysys.com/onlinehelp/odbc-powerpack/scr/images/json-driver/odbc-json-driver-preview-data.png" alt="ZappySys ODBC Driver - Preview Data" /></li>
<li>If you are using DSN method then Click OK to save our DSN Configuration.</li>
</ol>
<p>&nbsp;</p>
<h3>Load Amazon S3 Data in Power BI &#8211; using ODBC Driver Connection</h3>
<p>In the previous section, we configured ODBC DSN for AWS API call and added the ZappySys drivers in the ODBC Driver Administrator with information to connect to AWS S3 Files. We queried S3 File using ZappySys Amazon S3 Driver for CSV Files. Now we will open Power BI and import the information from ODBC  DSN we defined earlier.</p>
<ol>
<li>Open Power BI Desktop and select the option <strong>Get data</strong>
<div id="attachment_2830" style="width: 802px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/03/Get-data-Power-bi-desktop.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2830" class="wp-image-2830 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/03/Get-data-Power-bi-desktop.png" alt="Get data using power bi" width="792" height="335" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/Get-data-Power-bi-desktop.png 792w, https://zappysys.com/blog/wp-content/uploads/2018/03/Get-data-Power-bi-desktop-300x127.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/03/Get-data-Power-bi-desktop-768x325.png 768w" sizes="(max-width: 792px) 100vw, 792px" /></a><p id="caption-attachment-2830" class="wp-caption-text">Get data in power bi</p></div></li>
<li>Get Data will allow adding the ZappySys ODBC driver. Go to <strong>Other</strong> and select <strong>ODBC.</strong>
<div id="attachment_2835" style="width: 617px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-odbc-other-data-source.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2835" class="size-full wp-image-2835" src="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-odbc-other-data-source.png" alt="select odbc using power bi" width="607" height="635" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-odbc-other-data-source.png 607w, https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-odbc-other-data-source-287x300.png 287w" sizes="(max-width: 607px) 100vw, 607px" /></a><p id="caption-attachment-2835" class="wp-caption-text">Select odbc in Power BI</p></div></li>
<li>Select ODBC DSN name from the DSN dropdown</li>
<li>Now its time to import data. Basically, there are two modes to import data. <strong>Table Mode</strong> and <strong>Query Mode</strong>. We will <strong>Import using Power BI Query Mode</strong></li>
<li>Select your DSN and click <strong>Advanced Option</strong> to enter custom SQL Query to Import your REST API data. You can use ODBC DSN Data sources Preview tool to generate SQL Query. For example, you can enter a query like below. WITH clause is optional but you can supply many options to override DSN UI settings (e.g. Path, Credentials ).<br />
<pre class="crayon-plain-tag">/*--------- Amazon S3 Driver - Read CSV File Example - Override UI credentials in WITH clause ----------*/  
SELECT * FROM $  
WITH (  
  Src='Northwind-Bucket/Orders*.csv' --use wildcard * for pattern search
  -- ,AccessKey='AKIAxxxx' --not needed if you set in DSN connection
  -- ,SecretKey='a1wxxxxxxxxxxxxxx' --not needed if you set in DSN connection
  -- ,RegionName='us-west-1'
  -- ,ColumnDelimiter='|'
  -- ,HasColumnHeaderRow='False'
)</pre>
<a href="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-import-from-rest-api-url-odbc-json-driver.png"><img loading="lazy" decoding="async" class="size-full wp-image-3861" src="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-import-from-rest-api-url-odbc-json-driver.png" alt="Import JSON / REST API data in Power BI using SQL Query Mode" width="518" height="581" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-import-from-rest-api-url-odbc-json-driver.png 518w, https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-import-from-rest-api-url-odbc-json-driver-267x300.png 267w" sizes="(max-width: 518px) 100vw, 518px" /></a></li>
<li>On the next screen select <strong>Windows Authentication</strong> to continue (No userid and password).
<div id="attachment_2853" style="width: 710px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/03/select-credentials-zappysys.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2853" class="size-full wp-image-2853" src="https://zappysys.com/blog/wp-content/uploads/2018/03/select-credentials-zappysys.png" alt="Select credentials" width="700" height="346" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/select-credentials-zappysys.png 700w, https://zappysys.com/blog/wp-content/uploads/2018/03/select-credentials-zappysys-300x148.png 300w" sizes="(max-width: 700px) 100vw, 700px" /></a><p id="caption-attachment-2853" class="wp-caption-text">Select Windows Credentials to connect to zappysys driver</p></div></li>
<li>Click OK to import data in Power BI</li>
<li>Now you can create custom Dashboard from imported Dataset.</li>
</ol>
<h2>AWS API Example &#8211;  <span id="Step-by-Step_Import_REST_API_into_Power_BI">Call Amazon S3 API in Power BI</span></h2>
<p>In our previous section we saw how to read Amazon S3 data using native ZappySys S3 Drivers (For CSV , JSON and XML Files), this approach is preferred way to read S3 Files for sure because it gives you UI to browse files, it gives you ability to read from multiple files and many more S3 specific features.</p>
<p>However in some cases you have to call REST API in a manual way using REST API driver rather than S3 Driver. In next section we will see more interesting use case of calling AWS API (e.g. Billing / Cost API).</p>
<p>Now lets look at steps &#8211; How to import Amazon S3 data Power BI by calling REST API manually. Steps listed below are almost identical for XML or JSON data format except for selecting Driver Type (i.e. JSON, XML, CSV).</p>
<h3><span id="Step-by-Step_Import_REST_API_into_Power_BI">Configure ODBC DSN for REST API ( JSON / XML / CSV )</span></h3>
<p>To consume S3 data in Power BI, first we have to create ODBC DSN using ZappySys Driver (XML or JSON). Perform the following steps.</p>
<ol>
<li>To do this, we will first open the ODBC Data Source (32 bit):
<div id="attachment_2827" style="width: 403px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/03/open-ODBC-Data-souce-administrator.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2827" class="wp-image-2827 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/03/open-ODBC-Data-souce-administrator.png" alt="Open odbc" width="393" height="531" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/open-ODBC-Data-souce-administrator.png 393w, https://zappysys.com/blog/wp-content/uploads/2018/03/open-ODBC-Data-souce-administrator-222x300.png 222w" sizes="(max-width: 393px) 100vw, 393px" /></a><p id="caption-attachment-2827" class="wp-caption-text">Open odbc data source</p></div></li>
<li>Use the User DSN page and press<strong> Add</strong>
<div id="attachment_2765" style="width: 600px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/03/add-new-data-source-odbc-administrator.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2765" class="wp-image-2765 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/03/add-new-data-source-odbc-administrator.png" alt="New Data source" width="590" height="423" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/add-new-data-source-odbc-administrator.png 590w, https://zappysys.com/blog/wp-content/uploads/2018/03/add-new-data-source-odbc-administrator-300x215.png 300w" sizes="(max-width: 590px) 100vw, 590px" /></a><p id="caption-attachment-2765" class="wp-caption-text">Add new data source</p></div></li>
<li>Add the ZappySys XML Driver if you are accessing XML files from S3 Bucket or calling any AWS API which returns data in XML format. Select JSON driver for JSON data (or API Access in JSON Format)
<div id="attachment_3875" style="width: 603px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/06/zappysys-odbc-xml-soap-api-driver.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3875" class="size-full wp-image-3875" src="https://zappysys.com/blog/wp-content/uploads/2018/06/zappysys-odbc-xml-soap-api-driver.png" alt="ZappySys ODBC Driver for XML / SOAP API" width="593" height="459" srcset="https://zappysys.com/blog/wp-content/uploads/2018/06/zappysys-odbc-xml-soap-api-driver.png 593w, https://zappysys.com/blog/wp-content/uploads/2018/06/zappysys-odbc-xml-soap-api-driver-300x232.png 300w" sizes="(max-width: 593px) 100vw, 593px" /></a><p id="caption-attachment-3875" class="wp-caption-text">Create DSN using ZappySys ODBC Driver for XML / SOAP API</p></div></li>
<li>It is time to connect with <strong>Amazon S3 File</strong> and read data. In <strong>Data Source (URL or File Path),</strong> we will use XML file URL as below. Notice that S3 URL has 3 parts (<strong>zs-dump1</strong> is bucket name, <strong>s3.us-east-1.amazonaws.com</strong> is service endpoint for S3 (some service doesn&#8217;t require region) and <strong>store_001.xml</strong> is our file name. After you specify URL select Connection as per the screenshot.<strong>Syntax for URL :  BucketName</strong> + <strong>ServiceURL</strong> + <strong>FilePath.</strong>If you are not sure what can be your service endpoint then check <a href="https://docs.aws.amazon.com/general/latest/gr/rande.html" target="_blank" rel="noopener">this table</a>.<br />
<pre class="crayon-plain-tag">https://zs-dump1.s3.amazonaws.com/store_001.xml
--OR--
https://zs-dump1.s3.amazonaws.com/mysubfolder/store_001.xml
--OR--
https://zs-dump1.s3.us-east-1.amazonaws.com/mysubfolder/store_001.xml</pre>
<div id="attachment_3982" style="width: 773px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/06/xml-file-amazon-aws-api-connection-for-power-bi-tableau-informatica.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3982" class="size-full wp-image-3982" src="https://zappysys.com/blog/wp-content/uploads/2018/06/xml-file-amazon-aws-api-connection-for-power-bi-tableau-informatica.png" alt="Configure Amazon S3 Connection - Read from XML / JSON File" width="763" height="572" srcset="https://zappysys.com/blog/wp-content/uploads/2018/06/xml-file-amazon-aws-api-connection-for-power-bi-tableau-informatica.png 763w, https://zappysys.com/blog/wp-content/uploads/2018/06/xml-file-amazon-aws-api-connection-for-power-bi-tableau-informatica-300x225.png 300w" sizes="(max-width: 763px) 100vw, 763px" /></a><p id="caption-attachment-3982" class="wp-caption-text">Configure Amazon S3 Connection &#8211; Read from XML File or JSON File</p></div>
<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;"><strong>NOTE:</strong> If a filename contains a space, e.g. &#8220;<em>store abc.xml</em>&#8220;, make sure to replace space with <em>&#8220;%20&#8221;</em> (&#8220;+&#8221; will <strong>not</strong> work). So &#8220;store abc.xml&#8221; should become &#8220;<em>store%20abc.xml</em>&#8220;. </div></div></li>
<li>Once you specify the URL and Credentials, Next select Filter (This helps to flatten the nested hierarchy of your Data). If you don&#8217;t have nested Hierarchy then skip this step.
<div id="attachment_3983" style="width: 817px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-driver-read-amazon-s3-xml-file-1.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3983" class="size-full wp-image-3983" src="https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-driver-read-amazon-s3-xml-file-1.png" alt="Select Filter (Flatten the hierarchy to extract data from nested structure)" width="807" height="701" srcset="https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-driver-read-amazon-s3-xml-file-1.png 807w, https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-driver-read-amazon-s3-xml-file-1-300x261.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-driver-read-amazon-s3-xml-file-1-768x667.png 768w" sizes="(max-width: 807px) 100vw, 807px" /></a><p id="caption-attachment-3983" class="wp-caption-text">Select Filter (Flatten the hierarchy to extract data from nested structure)</p></div>
<p>&nbsp;</li>
<li>Now go to Preview Tab and click Preview button in the toolbar. You can remove attributes in the query to use default attributes from Previous Tab. You can always override DSN level setting inside WITH clause of SQL.
<div id="attachment_3984" style="width: 618px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/06/read-xml-json-from-amazon-s3-bucket-power-bi-tableau-reports-etl-informatica.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3984" class="size-full wp-image-3984" src="https://zappysys.com/blog/wp-content/uploads/2018/06/read-xml-json-from-amazon-s3-bucket-power-bi-tableau-reports-etl-informatica.png" alt="Preview data from AWS S3 File (XML Data) - Use ZappySys XML Driver to Connect to AWS API" width="608" height="701" srcset="https://zappysys.com/blog/wp-content/uploads/2018/06/read-xml-json-from-amazon-s3-bucket-power-bi-tableau-reports-etl-informatica.png 608w, https://zappysys.com/blog/wp-content/uploads/2018/06/read-xml-json-from-amazon-s3-bucket-power-bi-tableau-reports-etl-informatica-260x300.png 260w" sizes="(max-width: 608px) 100vw, 608px" /></a><p id="caption-attachment-3984" class="wp-caption-text">Preview data from AWS S3 File (XML Data) &#8211; Use ZappySys XML Driver to Connect to AWS API</p></div></li>
<li>To learn more about query language click on View Examples</li>
<li>Click OK to save your ODBC DSN settings.</li>
</ol>
<p>&nbsp;</p>
<h3>Import AWS S3 File or AWS API data in Power BI dataset</h3>
<p>Now let&#8217;s look at how to import Amazon S3 data in Power BI using ZappySys XML driver.</p>
<p>In the previous section, we configured ODBC DSN for AWS API call and added the ZappySys drivers in the ODBC Driver Administrator with information to connect to AWS REST API. We queried S3 File using ZappySys XML Driver. Now we will open Power BI and import the information from ZappySys JSON Driver via ODBC connectivity option in Power BI.</p>
<ol>
<li>Open Power BI Desktop and select the option <strong>Get data</strong>
<div id="attachment_2830" style="width: 802px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/03/Get-data-Power-bi-desktop.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2830" class="wp-image-2830 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/03/Get-data-Power-bi-desktop.png" alt="Get data using power bi" width="792" height="335" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/Get-data-Power-bi-desktop.png 792w, https://zappysys.com/blog/wp-content/uploads/2018/03/Get-data-Power-bi-desktop-300x127.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/03/Get-data-Power-bi-desktop-768x325.png 768w" sizes="(max-width: 792px) 100vw, 792px" /></a><p id="caption-attachment-2830" class="wp-caption-text">Get data in power bi</p></div></li>
<li>Get Data will allow adding the ZappySys ODBC driver. Go to <strong>Other</strong> and select <strong>ODBC.</strong>
<div id="attachment_2835" style="width: 617px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-odbc-other-data-source.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2835" class="size-full wp-image-2835" src="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-odbc-other-data-source.png" alt="select odbc using power bi" width="607" height="635" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-odbc-other-data-source.png 607w, https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-odbc-other-data-source-287x300.png 287w" sizes="(max-width: 607px) 100vw, 607px" /></a><p id="caption-attachment-2835" class="wp-caption-text">Select odbc in Power BI</p></div></li>
<li>Select ODBC DSN name from the DSN dropdown</li>
<li>Now its time to import data. Basically, there are two modes to import data. <strong>Table Mode</strong> and <strong>Query Mode</strong>. We will <strong>Import using Power BI Query Mode</strong></li>
<li>Select your DSN and click Advanced Option to enter custom SQL Query to Import your REST API data. You can use ODBC DSN Data sources Preview tool to generate SQL Query. For example, you can enter a query like below.<br />
<pre class="crayon-plain-tag">SELECT "author", "title",  "genre", "price",  "publish_date", "description", "tag"
FROM $
WITH(
	 Src='https://zs-dump1.s3.amazonaws.com/store_001.xml'
	,Filter='$.store.book[*]'
	,ElementsToTreatAsArray='book'
)</pre>
<div id="attachment_3861" style="width: 528px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-import-from-rest-api-url-odbc-json-driver.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3861" class="size-full wp-image-3861" src="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-import-from-rest-api-url-odbc-json-driver.png" alt="Import JSON / REST API data in Power BI using SQL Query Mode" width="518" height="581" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-import-from-rest-api-url-odbc-json-driver.png 518w, https://zappysys.com/blog/wp-content/uploads/2018/03/power-bi-import-from-rest-api-url-odbc-json-driver-267x300.png 267w" sizes="(max-width: 518px) 100vw, 518px" /></a><p id="caption-attachment-3861" class="wp-caption-text">Import JSON / REST API data in Power BI using SQL Query Mode</p></div>
<p>&nbsp;</li>
<li>On the next screen select <strong>Windows Authentication</strong> to continue (No userid and password).
<div id="attachment_2853" style="width: 710px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/03/select-credentials-zappysys.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2853" class="size-full wp-image-2853" src="https://zappysys.com/blog/wp-content/uploads/2018/03/select-credentials-zappysys.png" alt="Select credentials" width="700" height="346" srcset="https://zappysys.com/blog/wp-content/uploads/2018/03/select-credentials-zappysys.png 700w, https://zappysys.com/blog/wp-content/uploads/2018/03/select-credentials-zappysys-300x148.png 300w" sizes="(max-width: 700px) 100vw, 700px" /></a><p id="caption-attachment-2853" class="wp-caption-text">Select Windows Credentials to connect to zappysys driver</p></div></li>
<li>Click OK to import data in Power BI</li>
<li>Now you can create custom Dashboard from imported Dataset.</li>
</ol>
<p>&nbsp;</p>
<h2>AWS API Example &#8211; Import Amazon AWS Cost / Billing data in Power BI</h2>
<p>So far you have seen how to connect to S3 File. Now let&#8217;s look at another interesting example to call AWS API and display information in Power BI dashboard. For example purpose, we are going to call this <a href="https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_GetCostAndUsage.html" target="_blank" rel="noopener">AWS Billing and Cost Analysis API</a>. Perform following steps.</p>
<ol>
<li>Create new DSN using Zappysys JSON Driver</li>
<li>Configure ODBC DSN as below</li>
<li>Enter URL as we discussed in previous section. For example to call Billing API Service for East-1 Region we need to enter following way.<br />
<pre class="crayon-plain-tag">https://ce.us-east-1.amazonaws.com</pre>
</li>
<li>Select Connection Type as <strong>OAuth</strong> and click Configure Link.</li>
<li>Select Provider as <strong>AWS API v4</strong> and enter AWS Key and Secret. Click OK to save the connection.</li>
<li>Select Method as <strong>POST</strong></li>
<li>Enter HTTP Request Headers as below (Note each Billing Cost API action will have different Header value for X-Amz-Target so refer <a href="https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/Welcome.html" target="_blank" rel="noopener">API documentation</a>
<div id="attachment_4005" style="width: 818px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/06/call-aws-rest-api-example-json-driver-amazon-billing-cost-api-setup.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4005" class="size-full wp-image-4005" src="https://zappysys.com/blog/wp-content/uploads/2018/06/call-aws-rest-api-example-json-driver-amazon-billing-cost-api-setup.png" alt="Configure AWS API Connection for Cost / Billing API Data - Use ZappySys JSON Driver" width="808" height="702" srcset="https://zappysys.com/blog/wp-content/uploads/2018/06/call-aws-rest-api-example-json-driver-amazon-billing-cost-api-setup.png 808w, https://zappysys.com/blog/wp-content/uploads/2018/06/call-aws-rest-api-example-json-driver-amazon-billing-cost-api-setup-300x261.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/06/call-aws-rest-api-example-json-driver-amazon-billing-cost-api-setup-768x667.png 768w" sizes="(max-width: 808px) 100vw, 808px" /></a><p id="caption-attachment-4005" class="wp-caption-text">Configure AWS API Connection for Cost / Billing API Data &#8211; Use ZappySys JSON Driver</p></div></li>
<li>Enter Request Body (Modify your report parameters). As you see in below request we are requesting billing data for 3 services for Jan-1-2018 till Jun-15-2018. If you dont know service name then simply refer to your Bill and copy Service Name in Values array.<br />
<pre class="crayon-plain-tag">{
  "TimePeriod": {
    "Start":"2018-01-01",
    "End": "2018-06-15"
  },
  "Granularity": "MONTHLY",
  "Filter": {      
    "Dimensions": {
      "Key": "SERVICE",
      "Values": [
        "Amazon Simple Storage Service",
        "Amazon DynamoDB",
        "Amazon Redshift",
        "AWS Key Management Service"
      ]
    }
  },
  "GroupBy":[
    {
      "Type":"DIMENSION",
      "Key":"SERVICE"
    },
    {
      "Type":"TAG",
      "Key":"Environment"
    }
  ],
   "Metrics":["BlendedCost", "UnblendedCost", "UsageQuantity"]
}</pre>
&nbsp;</li>
<li>Select Filter as <strong>$.ResultsByTime[*].Groups[*]</strong></li>
<li>Click Test Connection button see it shows OK.</li>
<li>If the connection is OK then switch to Preview Tab to test query.</li>
<li>You can select Table name from the drop-down or type query as below<br />
<strong>Simple-Query to Extract AWS Billing / Cost Information</strong><br />
<pre class="crayon-plain-tag">SELECT  
 "p_ResultsByTime_TimePeriod_Start" as BillStartDate,
 "p_ResultsByTime_TimePeriod_End" as BillEndDate,
 json_array_first("Keys") as ServiceName,
 "Metrics_BlendedCost_Amount" as BillAmount,
 "Metrics_UsageQuantity_Amount" as Quantity
FROM [ResultsByTime_x_Groups] 
ORDER BY p_ResultsByTime_TimePeriod_Start</pre>
</li>
<li>You can also override attributes in your query using below syntax<br />
<strong>Custom-Query to Extract AWS Billing / Cost Information (WITH clause)</strong><br />
<pre class="crayon-plain-tag">SELECT 
 "p_ResultsByTime_TimePeriod_Start" as BillStartDate,
 "p_ResultsByTime_TimePeriod_End" as BillEndDate,
 json_array_first("Keys") as ServiceName,
 "Metrics_BlendedCost_Amount" as BillAmount,
 "Metrics_UsageQuantity_Amount" as Quantity
FROM $
ORDER BY p_ResultsByTime_TimePeriod_Start
WITH(
	 Src='https://ce.us-east-1.amazonaws.com'
	,DataConnectionType='OAuth'
	,ScopeSeparator='{space}'
	,ServiceProvider='AmazonAWS'
	--,ClientId='AKIAxxxxxxxxxxxxxxx'
	--,ClientSecret='lPi+XQxxxxxxxxxxxxxxxx'
	,UseCustomApp='True'
	,Filter='$.ResultsByTime[*].Groups[*]'
	,RequestData='{
  "TimePeriod": {
    "Start":"2018-01-01",
    "End": "2018-06-15"
  },
  "Granularity": "MONTHLY",
  "Filter": {      
    "Dimensions": {
      "Key": "SERVICE",
      "Values": [
        "Amazon Simple Storage Service",
        "Amazon DynamoDB",
        "Amazon Redshift",
        "AWS Key Management Service"
      ]
    }
  },
  "GroupBy":[
    {
      "Type":"DIMENSION",
      "Key":"SERVICE"
    },
    {
      "Type":"TAG",
      "Key":"Environment"
    }
  ],
   "Metrics":["BlendedCost", "UnblendedCost", "UsageQuantity"]
}'
	,Header='X-Amz-Target: AWSInsightsIndexService.GetCostAndUsage || Content-Type: application/x-amz-json-1.1'
	,RequestMethod='POST'
)</pre>
</li>
<li>Click Preview button to see the result.
<div id="attachment_4004" style="width: 773px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/06/get-amazon-billing-cost-using-rest-api-query-zappysys-json-driver.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4004" class="size-full wp-image-4004" src="https://zappysys.com/blog/wp-content/uploads/2018/06/get-amazon-billing-cost-using-rest-api-query-zappysys-json-driver.png" alt="Query AWS Cost / Billing Data using API in Power BI (Use ZappySys JSON Driver)" width="763" height="884" srcset="https://zappysys.com/blog/wp-content/uploads/2018/06/get-amazon-billing-cost-using-rest-api-query-zappysys-json-driver.png 763w, https://zappysys.com/blog/wp-content/uploads/2018/06/get-amazon-billing-cost-using-rest-api-query-zappysys-json-driver-259x300.png 259w" sizes="(max-width: 763px) 100vw, 763px" /></a><p id="caption-attachment-4004" class="wp-caption-text">Query AWS Cost / Billing Data using API in Power BI (Use ZappySys JSON Driver)</p></div></li>
<li>Click OK to save Your DSN</li>
<li>Now you can Import Billing / Cost data in Power BI using same steps as previous section (Except use custom Query and DSN we just created for AWS API call)
<div id="attachment_4110" style="width: 940px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/06/import-aws-rest-api-billing-cost-data-power-bi.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4110" class="size-full wp-image-4110" src="https://zappysys.com/blog/wp-content/uploads/2018/06/import-aws-rest-api-billing-cost-data-power-bi.png" alt="Import AWS Billing / Cost Data in Power BI (Call AWS REST API)" width="930" height="499" srcset="https://zappysys.com/blog/wp-content/uploads/2018/06/import-aws-rest-api-billing-cost-data-power-bi.png 930w, https://zappysys.com/blog/wp-content/uploads/2018/06/import-aws-rest-api-billing-cost-data-power-bi-300x161.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/06/import-aws-rest-api-billing-cost-data-power-bi-768x412.png 768w" sizes="(max-width: 930px) 100vw, 930px" /></a><p id="caption-attachment-4110" class="wp-caption-text">Import AWS Billing / Cost Data in Power BI (Call AWS REST API)</p></div></li>
<li>Repeat steps to import more datasets using different queries</li>
</ol>
<p>&nbsp;</p>
<h2>AWS API Example &#8211; Import Data From AWS Lambda in Power BI</h2>
<p>Now let&#8217;s look at another scenario. Assume that someone from other team has written a Lambda Function which exposes certain data in JSON format which you want to display that in your Dashboard. Refer to this <a href="https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html" target="_blank" rel="noopener">Lambda API documentation</a> to learn more about API syntax.</p>
<p>Here is an example query to Call Lambda Function (submit input data in JSON and receive data in JSON format)</p><pre class="crayon-plain-tag">SELECT * FROM $
WITH(
	 Src='https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/HelloWorld/invocations'
	,RequestMethod='POST'
	,RequestData='{"id":1}'
	,RequestContentTypeCode='ApplicationJson'
	
	/*** Uncomment to override DSN settings	  
	,DataConnectionType='OAuth'
	,ScopeSeparator='{space}'
	,ServiceProvider='AmazonAWS'
	--,ClientId='AKxxxxxxxxxxx'
	--,ClientSecret='lPi+Xxxxxxxxxxxxxxxxxxxxxxx'
	,UseCustomApp='True'
	***/
)</pre><p>
&nbsp;</p>
<h2>AWS API Example &#8211; Get EC2 VM information in Power BI</h2>
<p>Now let&#8217;s look at AWS EC2 Service API (Virtual Machine Service). This API is in XML format so you have to use ZappySys XML Driver.  Below query calls <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html" target="_blank" rel="noopener">this EC2 API</a> to get list of all instances.</p>
<p>&nbsp;</p><pre class="crayon-plain-tag">SELECT * FROM $
WITH(
	 ElementsToTreatAsArray='item'
	,Src='https://ec2.us-east-1.amazonaws.com/'
	,Filter='$.DescribeInstancesResponse.reservationSet.item[*].instancesSet.item[*]'
	,RequestData='Action=DescribeInstances&amp;Version=2016-11-15'
	,RequestMethod='POST'
	/*
	,DataConnectionType='OAuth'
	,ScopeSeparator='{space}'
	,ServiceProvider='AmazonAWS'
	,ClientId='AKIAxxxxxxxxxxxxxxxxxxx'
	,ClientSecret='lPi+XQvxxxxxxxxxxxxxxxxxxxxxxxxx'
	,UseCustomApp='True'
	*/
)</pre><p>
&nbsp;</p>
<div id="attachment_4111" style="width: 1010px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/06/query-aws-ec2-instances-power-bi-use-zappysys-rest-xml-driver.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4111" class="size-full wp-image-4111" src="https://zappysys.com/blog/wp-content/uploads/2018/06/query-aws-ec2-instances-power-bi-use-zappysys-rest-xml-driver.png" alt="Get EC2 Instance List in Power BI (Use ZappySys XML Driver)" width="1000" height="658" srcset="https://zappysys.com/blog/wp-content/uploads/2018/06/query-aws-ec2-instances-power-bi-use-zappysys-rest-xml-driver.png 1000w, https://zappysys.com/blog/wp-content/uploads/2018/06/query-aws-ec2-instances-power-bi-use-zappysys-rest-xml-driver-300x197.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/06/query-aws-ec2-instances-power-bi-use-zappysys-rest-xml-driver-768x505.png 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></a><p id="caption-attachment-4111" class="wp-caption-text">Get EC2 Instance List in Power BI (Use ZappySys XML Driver)</p></div>
<p>&nbsp;</p>
<h2>AWS API Example &#8211; Get AWS S3 Buckets and Files Count / Size in Power BI</h2>
<p>Now let&#8217;s look at how to Query S3 File System in Power BI. For example if you have to prepare dashboard to show Total Data Size and File count in a given Bucket then you can write following Query. For more information check <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/v2-RESTBucketGET.html" target="_blank" rel="noopener">Bucket List API Help</a></p>
<p><strong>Get File Size and Count for a given S3 Bucket</strong></p><pre class="crayon-plain-tag">SELECT count(*) as TotalFiles,sum(Size)/1024/1024 as TotalMB  FROM $
WITH(
	 ElementsToTreatAsArray='Contents'
	,Src='https://zs-dump1.s3.amazonaws.com/?list-type=2&amp;prefix=&amp;max-keys=1000'
	,Filter='$.ListBucketResult.Contents[*]'
	,NextUrlAttributeOrExpr='$.ListBucketResult.NextContinuationToken'
	,NextUrlSuffix='&amp;continuation-token=&lt;%nextlink_encoded%&gt;'
	
	/**** Uncomment below to use override DSN values
	,DataConnectionType='OAuth'
	,ScopeSeparator='{space}'
	,ServiceProvider='AmazonAWS'
	,ClientId='AKIAxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
	,ClientSecret='lPi+Xcxxxxxxxxxxxxxxxxxxxxxxxx'
	,UseCustomApp='True'	
	,RequestMethod='GET'
	***/
)</pre><p>
To list buckets you can use following query</p>
<p><strong>List S3 Buckets</strong></p><pre class="crayon-plain-tag">SELECT *  FROM $
WITH(	 
	 Src='https://s3.amazonaws.com'
	,Filter='$.ListAllMyBucketsResult.Buckets.Bucket[*]'
	,ElementsToTreatAsArray='Buckets'

	/**** Uncomment below to use override DSN values
	,DataConnectionType='OAuth'
	,ScopeSeparator='{space}'
	,ServiceProvider='AmazonAWS'
	,ClientId='AKIAxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
	,ClientSecret='lPi+Xcxxxxxxxxxxxxxxxxxxxxxxxx'
	,UseCustomApp='True'	
	,RequestMethod='GET'
	***/
)</pre><p>
&nbsp;</p>
<h2>Debugging / Crafting AWS API Call Request</h2>
<p>Check below article to learn various techniques to debug and craft AWS API Request Body / Headers and URL.</p>
<blockquote class="wp-embedded-content" data-secret="5AMMHunS6j"><p><a href="https://zappysys.com/blog/how-to-call-amazon-aws-api-using-ssis-ec2-lambda-api-gateway-sqs/">How to call Amazon AWS API using SSIS (EC2, Lambda, API Gateway, SQS)</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted" src="https://zappysys.com/blog/how-to-call-amazon-aws-api-using-ssis-ec2-lambda-api-gateway-sqs/embed/#?secret=5AMMHunS6j" data-secret="5AMMHunS6j" width="600" height="338" title="&#8220;How to call Amazon AWS API using SSIS (EC2, Lambda, API Gateway, SQS)&#8221; &#8212; ZappySys Blog" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p>&nbsp;</p>
<h2></h2>
<h2>Understanding AWS REST API Pagination in Power BI</h2>
<div class="content_block" id="custom_post_widget-3892"><div style="margin-bottom: 1em;">Even we set up ODBC Data Source to get the data, it may not be enough. Usually, if you are getting a huge data set from API provider, it won't give it to you in one HTTP response. Instead, it gives back only a subset of data and provides a mechanism for data pagination. The good news is that <em>ZappySys ODBC Driver</em> includes many options to cover virtually any pagination method.</div>
<div><span style="font-size: 16px;">Below you will find a few examples of API pagination. If you need something more sophisticated check the below link (the article was written for SSIS PowerPack but UI options and concepts apply to ODBC Driver too):</span></div>
<div style="margin-bottom: 1em;"><a href="https://zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/" target="_blank" rel="noopener">https://zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/</a></div>
<h3>Paginate by Response Attribute</h3>
This example shows how to paginate API calls where you need to paginate until the last page detected. In this example, next page is indicated by some attribute called nextlink (found in response). If this attribute is missing or null then it stops fetching the next page.
<pre class="lang:tsql decode:true codeblock">SELECT * FROM $
WITH(
SRC=@'https://zappysys.com/downloads/files/test/pagination_nextlink_inarray_1.json'
,NextUrlAttributeOrExpr = '$.nextlink'  --keep reading until this attribute is missing. If attribute name contains dot then use brackets like this $.['my.attr.name']
)</pre>
<h3>Paginate by URL Parameter (Loop until certain StatusCode)</h3>
This example shows how to paginate API calls where you need to pass page number via URL. The driver keeps incrementing page number and calls next URL until the last page detected (401 error). There are few ways to indicate the last page (e.g. By status code, By row count, By response size). If you don't specify end detection then it will use the default (i.e. No records found).
<pre class="lang:tsql decode:true codeblock">SELECT * FROM $
WITH (
SRC=@'https://zappysys.com/downloads/files/test/page-xml.aspx?page=1&amp;mode=DetectBasedOnResponseStatusCode'
,PagingMode='ByUrlParameter'
,PagingByUrlAttributeName='page'
,PagingByUrlEndStrategy='DetectBasedOnResponseStatusCode'
,PagingByUrlCheckResponseStatusCode=401
,IncrementBy=1
)</pre>
<h3>Paginate by URL Path (Loop until no record)</h3>
This example shows how to paginate API calls where you need to pass page number via URL Path. The driver keeps incrementing page number and calls next URL until the last page is detected. There are few ways to indicate the last page (e.g. By status code, By row count, By response size). If you don't specify end detection then it will use the default (i.e. No records found).
<pre class="lang:tsql decode:true codeblock">SELECT * FROM $
WITH (
SRC=@'https://zappysys.com/downloads/files/test/cust-&lt;%page%&gt;.xml'
,PagingMode='ByUrlPath'
,PagingByUrlAttributeName='&lt;%page%&gt;'
,PagingByUrlEndStrategy='DetectBasedOnRecordCount'
,IncrementBy=1
)</pre>
<h3>Paginate by Header Link (RFC 5988)</h3>
API like GitHub / Wordpress use Next link in Headers (<a href="https://tools.ietf.org/html/rfc5988" target="_blank" rel="noopener">RFC 5988</a>)
<pre class="lang:default decode:true ">SELECT * FROM $
LIMIT 25
WITH(
	 Src='https://wordpress.org/news/wp-json/wp/v2/categories?per_page=10'
	,PagingMode='ByResponseHeaderRfc5988'
	,WaitTimeMs='200' --//wait 200 ms after each request
)</pre>
&nbsp;</div>
<h2>Handling AWS Web API Error in Power BI</h2>
<div class="content_block" id="custom_post_widget-3894">Sometimes errors occur... they just do and there is nothing you can do! Or can you? Actually, in ODBC PowerPack you can handle them in two ways.
<h3>METHOD 1 - Using Error Handling Options</h3>
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-3949" src="https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-api-error-handling-1.png" alt="" width="668" height="702" />
<h4>When to use?</h4>
You may want to use them when your source is a resource located on the Internet; e.g. a file on a website, a file on an FTP server or just a plain API HTTP response. By default, when a remote server returns an error, data retrieval is stopped, an error is raised and no data is given back to you. This might not be always desirable.
<h4>Scenario 1</h4>
Imagine a scenario, that there is a web server which each day at 12 AM releases a new JSON file with that day's date as filename, e.g. <span style="text-decoration: underline;"><em>http://www.some-server.com/data/2018-06-20.json</em></span>. And, of course, you want to download it and use it daily in your Power BI report. But you have a problem: Power BI report data sources are refreshed each hour and you may get <a href="https://en.wikipedia.org/wiki/HTTP_404" target="_blank" rel="noopener">HTTP 404 status code</a> (no file was found) when a file is not released yet. Which consequentially means other data sources won't be updated as well and you will see old and cached data on the report. That's where you could use <strong><span class="lang:default highlight:0 decode:true crayon-inline">Continue on any error</span></strong> or <strong><span class="lang:default highlight:0 decode:true crayon-inline">Continue when Url is invalid or missing (404 Errors)</span></strong> to avoid an error being raised and let other data sources to be updated.
<h4>Scenario 2</h4>
Another scenario is when you expect a web server to raise some kind of HTTP error when accessing a URL. You don't want ODBC Data Source to raise an error but instead, you want to get response data. That's where you can use <strong><span class="lang:default highlight:0 decode:true crayon-inline">Continue on any error</span></strong> or alike together with  <strong><span class="lang:default highlight:0 decode:true crayon-inline">Get response data on error</span></strong> to continue on an error and get the data:

<img loading="lazy" decoding="async" class="alignnone wp-image-3961 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-powerpack-get-response-data-on-error.png" alt="" width="547" height="235" srcset="https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-powerpack-get-response-data-on-error.png 547w, https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-powerpack-get-response-data-on-error-300x129.png 300w" sizes="(max-width: 547px) 100vw, 547px" />
<h3>METHOD 2 - Using Connection [Retry Settings]</h3>
Another scenario you may run into is a buggy web server. You ask it to give you some file or data and it, like a snotty kid, just doesn't give it to you! You have to ask twice or thrice before it does its job. If that's the case, you have to retry HTTP requests using <em>Connection</em>:

<img loading="lazy" decoding="async" class="alignnone wp-image-3963 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/06/odbc-api-error-handling-3.png" alt="" width="671" height="572" /></div>
<h2>Other Considerations for Calling AWS API in Power BI</h2>
<div class="content_block" id="custom_post_widget-3901">There are few settings you can coder while calling Web API
<h3><strong>API Limit / Throttling</strong></h3>
While calling public API or other external web services one important aspect you have to check,  how many requests are allowed by your API. Especially when you use API pagination options to pull many records you have to slow down based on API limits. For example, your API may allow you only 5 requests per second. Use Throttling Tab on Driver UI to set delay after each request.
<h3><strong>2D Array Transformation</strong></h3>
If you are using JSON or XML API Driver then possible you may have to transform your data using 2D array transformation feature. <a href="https://zappysys.com/blog/parse-multi-dimensional-json-array-ssis/" target="_blank" rel="noopener">Check this link</a> for more information.

&nbsp;</div>
<h2>Conclusion</h2>
<p>In this article, we show how to connect to AWS API and S3 File data in Power BI. We configured ODBC DSN for AWS S3 / REST API connection and finally imported data in Power BI.  We used ZappySys driver for JSON that can be used to extract data from any REST API or a JSON file.  <a href="https://zappysys.com/products/odbc-powerpack/download/">Download ODBC PowerPack</a> to try yourself see how easy it is to consume XML / JSON / REST API and AWS data in Power BI and Say goodbye to ETL or Coding.  If you need any help with your API integration feel free to <a href="https://zappysys.com/support/">contact zappysys support</a> you will be amazed for sure how quickly your issue is resolved.</p>
<p>The post <a href="https://zappysys.com/blog/read-amazon-s3-data-power-bi-aws-json-xml-api/">Read Amazon S3 data in Power BI or Call AWS REST API (JSON / XML)</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>How to call Amazon AWS API using SSIS (EC2, Lambda, API Gateway, SQS)</title>
		<link>https://zappysys.com/blog/how-to-call-amazon-aws-api-using-ssis-ec2-lambda-api-gateway-sqs/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Fri, 03 Nov 2017 15:25:28 +0000</pubDate>
				<category><![CDATA[AWS (Amazon Web Services)]]></category>
		<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[S3 (Simple Storage Service)]]></category>
		<category><![CDATA[SSIS Connection Manager]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS OAuth Connection]]></category>
		<category><![CDATA[SSIS REST API Task]]></category>
		<category><![CDATA[SSIS XML Source (File / SOAP)]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[elasticsearch]]></category>
		<category><![CDATA[fiddler]]></category>
		<category><![CDATA[lambda]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[s3]]></category>
		<category><![CDATA[sqs]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=2241</guid>

					<description><![CDATA[<p>Introduction In this blog post you will learn how to call Amazon AWS API using SSIS (virtually any API) without a single line of code (No more JAVA, C#, Ruby, Python). Yes you heard it right 🙂 . If you are a SSIS / ETL Developer or even coder everyone loves drag &#38; drop interface. SSIS [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/how-to-call-amazon-aws-api-using-ssis-ec2-lambda-api-gateway-sqs/">How to call Amazon AWS API using SSIS (EC2, Lambda, API Gateway, SQS)</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/11/amazon-web-services-logo.jpg"><img loading="lazy" decoding="async" class="wp-image-2317 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2017/11/amazon-web-services-logo.jpg" alt="" width="322" height="181" srcset="https://zappysys.com/blog/wp-content/uploads/2017/11/amazon-web-services-logo.jpg 800w, https://zappysys.com/blog/wp-content/uploads/2017/11/amazon-web-services-logo-300x169.jpg 300w, https://zappysys.com/blog/wp-content/uploads/2017/11/amazon-web-services-logo-768x432.jpg 768w" sizes="(max-width: 322px) 100vw, 322px" /></a>In this blog post you will learn how to <strong>call Amazon AWS API using SSIS</strong> (virtually any API) without a single line of code (No more JAVA, C#, Ruby, Python). Yes you heard it right 🙂 . If you are a SSIS / ETL Developer or even coder everyone loves drag &amp; drop interface. SSIS has many advantages over other approaches such as Programming SDKs, Command Lines. Main advantage is ease of use, security and long term maintenance without learning expensive coding approach.</p>
<p>In this post we will use following components to show various possibilities to implement Amazon AWS API integration scenarios inside your ETL workflows.</p>
<div class="su-table su-table-alternate">
<div>
<table>
<colgroup>
<col width="100" />
<col /></colgroup>
<tbody>
<tr>
<td><img loading="lazy" decoding="async" src="//zappysys.com/images/ssis-powerpack/SSIS-Json-Source-Adapter.png" alt="Custom SSIS Components - Json Source" width="72" height="72" /></td>
<td><a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/">JSON / REST API Source</a> (REST API, JSON File or OData Service): Use this dataflow component when you have to <strong>fetch data from REST API webservice like a table</strong>. This component allows you to extract JSON data from webservice and de-normalize nested structure so you can save to Relational database such as SQL Server or any other target (Oracle, FlatFile, Excel, MySQL). This component also supports reading local JSON files or direct JSON string (Wildcard pattern supported too e.g. c:\data\file*.json).</td>
</tr>
<tr>
<td><img loading="lazy" decoding="async" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/web-api-destination/ssis-web-api-destination.png" alt="SSIS Custom Target Adapter - Web API Destination" width="72" height="72" /></td>
<td><a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/">Web API Destination</a> (POST data to API URL) : Use this dataflow component when you have to call API inside Dataflow (see <a href="https://zappysys.com/blog/http-post-in-ssis-send-data-to-web-api-url-json-xml/" target="_blank" rel="noopener">POST to URL</a>). Possible Use case: Call Lambda function with various parameters for each input record found in database.</td>
</tr>
<tr>
<td><img loading="lazy" decoding="async" src="//zappysys.com/images/ssis-powerpack/ssis-rest-api-web-service-task.png" alt="Custom SSIS Tasks - SSIS Rest Api Web Service Task" width="72" height="72" /></td>
<td><a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/">REST API Task</a> : Use this task when you don’t want to pull REST API data in tabular format but want to call rest API for POST data to server, DELETE data from server or things like download HTML page, extract Authentication tokens etc where you not necessarily dealing data in tabular format. This task also allows you many other options such as saving RAW response into variable or file.</td>
</tr>
<tr>
<td><img loading="lazy" decoding="async" src="//zappysys.com/images/ssis-powerpack/ssis-xml-source.png" alt="Custom SSIS Components - XML Source (Read File/SOAP/REST Web Service)" width="72" height="72" /></td>
<td><a href="https://zappysys.com/products/ssis-powerpack/ssis-xml-source/">XML Source</a> (SOAP, File, REST) : Use this dataflow component when you have to fetch data from XML or SOAP webservice and consume data like a table. This component allows you to extract data from webservice and save to SQL Server or any other target (Oracle, FlatFile, Excel, MySQL). This component also supports reading local XML files or direct XML string.</td>
</tr>
</tbody>
</table>
</div>
</div>
<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>Step-By-Step Example-1 (Call AWS API)</h2>
<p>Now lets call some simple GET API call using SSIS <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">REST API Task</a>.</p>
<ol>
<li>Install  <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener"><em>SSIS PowerPack</em></a> (Skip this step if you already installed SSIS PowerPack.</li>
<li>Open Visual Studio and create new Integration Services Project</li>
<li>Open SSIS Package and check your SSIS Toolbox you will see many tasks/components starting with ZS</li>
<li>From Control flow SSIS Toolbox Drag &amp; drop <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">ZS REST API Task</a>.</li>
<li>Double click the REST API task to configure it.</li>
<li>On REST API Task change URL Access mode drop down to <strong>URL from Connection</strong></li>
<li>Now in the connection dropdown click New <strong>ZS-OAUTH</strong> connection and configure connection as below
<ol>
<li>Once you see OAuth connection dialog box change Provider Type from Custom to <strong>Amazon AWS API</strong> (v4)</li>
<li>In the ClientId enter your AWS <strong>Access Key</strong></li>
<li>In the ClientSecret enter your AWS <strong>Secret Key</strong></li>
<li>Click OK to save connection
<div id="attachment_2258" style="width: 720px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-oauth-connection-amazon-aws-api-provider-use-signature-v4.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2258" class="size-full wp-image-2258" src="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-oauth-connection-amazon-aws-api-provider-use-signature-v4.png" alt="Configure SSIS OAuth Connection - Use Amazon AWS API Provider, Enter Access Key, Secret Key" width="710" height="535" srcset="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-oauth-connection-amazon-aws-api-provider-use-signature-v4.png 710w, https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-oauth-connection-amazon-aws-api-provider-use-signature-v4-300x226.png 300w" sizes="(max-width: 710px) 100vw, 710px" /></a><p id="caption-attachment-2258" class="wp-caption-text">Configure SSIS OAuth Connection &#8211; Use Amazon AWS API Provider, Enter Access Key, Secret Key</p></div></li>
</ol>
</li>
<li>On REST API Task change few more settings as below
<ol>
<li>Enter API URL you like to call (In our case we will use <a href="http://docs.aws.amazon.com/AmazonS3/latest/API/RESTServiceGET.html" target="_blank" rel="noopener">S3 API (Simple Storage Service)</a>. We assume you have ListBucket permission to make this call. If you dont have such permission try to get Full path of File (choose small file) . You have to tweak API url to adjust Service Type, Region,Bucket, Path<br />
<pre class="crayon-plain-tag">https://s3.us-east-1.amazonaws.com
-- OR -- Use below (list files) if you have single bucket permission---
https://s3.us-east-1.amazonaws.com/YOUR-BUCKET</pre>
</li>
<li>Click Test Request. If you have valid Permission and setup looks ok then you will see Response window like below. Using this technique you can call any API to execute AWS operations (E.g. start EC2 VM, Create SQS Queue, Call Lambda Function, Drop or Update resource)
<div id="attachment_2260" style="width: 722px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-call-amazon-aws-api-without-sdk-s3-ec2-sqs-lambda-api-gateway.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2260" class="size-full wp-image-2260" src="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-call-amazon-aws-api-without-sdk-s3-ec2-sqs-lambda-api-gateway.png" alt="Calling Amazon AWS API Using SSIS REST API Task Example. (Call any AWS API without SDK. such as EC2 API, SQS API, Lambda API, Redshift API, DynamoDB API)" width="712" height="615" srcset="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-call-amazon-aws-api-without-sdk-s3-ec2-sqs-lambda-api-gateway.png 712w, https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-call-amazon-aws-api-without-sdk-s3-ec2-sqs-lambda-api-gateway-300x259.png 300w" sizes="(max-width: 712px) 100vw, 712px" /></a><p id="caption-attachment-2260" class="wp-caption-text">Calling Amazon AWS API Using SSIS REST API Task Example. (Call any AWS API without SDK. such as EC2 API, SQS API, Lambda API, Redshift API, DynamoDB API)</p></div></li>
</ol>
</li>
</ol>
<h2>Step-By-Step Example-2 (Loading data from AWS API to SQL Server)</h2>
<p>Now lets do more interesting scenario. We will call AWS S3 API to get S3 File list from Bucket. After extract we will save that list to SQL Server Table. Since Amazon S3 API is XML based API we will use ZappySys <a href="https://zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">SSIS XML Source</a>. For JSON based API use JSON Source instead. XML Source / JSON Source both can parse API response into Rows and Columns so you can easily store it into SQL Server. Now lets see how to do this.</p>
<ol>
<li>From Control flow SSIS Toolbox Drag &amp; drop Data Flow Task</li>
<li>Double click Data Flow Task. From SSIS Toolbox Drag &amp; drop <a href="https://zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">ZS SSIS XML Source</a>.</li>
<li>Double click the XML Source to configure it.</li>
<li>In the URL text box enter API URL like below to list S3 Files for specified bucket (Change YOUR-BUCKET to your own name)<br />
<pre class="crayon-plain-tag">https://s3.us-east-1.amazonaws.com/YOUR-BUCKET</pre>
</li>
<li>Now check Use Credentials and Select same Amazon API connection we created in previous example.</li>
<li>Click on Select Filter (This step allows us to flatten the XML hierarchy. Select the node which is Array icon like below. If prompted to treat selected node as array click Yes.
<div id="attachment_2319" style="width: 958px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-read-data-amazon-aws-api-get-s3-bucket-file-list-xml-source.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2319" class="size-full wp-image-2319" src="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-read-data-amazon-aws-api-get-s3-bucket-file-list-xml-source.png" alt="Configure SSIS XML Source - Get Amazon S3 File List from specific bucket (AWS API)" width="948" height="728" srcset="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-read-data-amazon-aws-api-get-s3-bucket-file-list-xml-source.png 948w, https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-read-data-amazon-aws-api-get-s3-bucket-file-list-xml-source-300x230.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-read-data-amazon-aws-api-get-s3-bucket-file-list-xml-source-768x590.png 768w" sizes="(max-width: 948px) 100vw, 948px" /></a><p id="caption-attachment-2319" class="wp-caption-text">Configure SSIS XML Source &#8211; Get Amazon S3 File List from specific bucket (AWS API)</p></div></li>
<li>Click Preview to see your data. Click OK to save.
<div id="attachment_2320" style="width: 705px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-preview-data-amazon-aws-api-get-s3-bucket-file-list-xml-source.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2320" class="size-full wp-image-2320" src="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-preview-data-amazon-aws-api-get-s3-bucket-file-list-xml-source.png" alt="Preview Data in XML Source - Amazon S3 File List (Calling AWS API)" width="695" height="372" srcset="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-preview-data-amazon-aws-api-get-s3-bucket-file-list-xml-source.png 695w, https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-preview-data-amazon-aws-api-get-s3-bucket-file-list-xml-source-300x161.png 300w" sizes="(max-width: 695px) 100vw, 695px" /></a><p id="caption-attachment-2320" class="wp-caption-text">Preview Data in XML Source &#8211; Amazon S3 File List (Calling AWS API)</p></div></li>
<li>Now attach your XML source to target like OLEDB Destination to load data to SQL Server or other Target (e.g. Oracle, MySQL)</li>
<li>Execute SSIS Package to load data from Amazon AWS API to SQL Server.
<div id="attachment_2321" style="width: 917px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-example-read-amazon-to-sql-server-call-aws-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2321" class="size-full wp-image-2321" src="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-example-read-amazon-to-sql-server-call-aws-api.png" alt="SSIS Package - Read Amazon S3 File List and load into SQL Server Table (Call AWS API Example)" width="907" height="597" srcset="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-example-read-amazon-to-sql-server-call-aws-api.png 907w, https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-example-read-amazon-to-sql-server-call-aws-api-300x197.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-example-read-amazon-to-sql-server-call-aws-api-768x506.png 768w" sizes="(max-width: 907px) 100vw, 907px" /></a><p id="caption-attachment-2321" class="wp-caption-text">SSIS Package &#8211; Read Amazon S3 File List and load into SQL Server Table (Call AWS API Example)</p></div></li>
</ol>
<h2></h2>
<h2><span id="Using_SSIS_JSON_Source_to_read_from_REST_API_and_load_into_SQL_Server">File Upload Example &#8211; Low level API &#8211; Call PUT request</span></h2>
<p>There will be a time when you want to take total control of your AWS API calls. One example is if you wish to Upload / Write data to S3 then components like ZappySys Amazon S3 CSV Destination or Amazon Storage Task might need additional permission such as <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_HeadObject.html" target="_blank" rel="noopener">HeadObject</a> . If you have only write permission on bucket then this will fail to execute Task. In such case you can use REST API Task like below way.</p>
<p>Basically we exported data from Relation Database to CSV File using <a href="https://zappysys.com/products/ssis-powerpack/ssis-export-csv-file-task/" target="_blank" rel="noopener">Export CSV File Task</a> and then we uploaded file content using REST API Task.</p>
<h3>Upload Text File to S3 (i.e. JSON, CSV, XML &#8230;)</h3>
<p>Your URL Format can be like this. Region codes can be <a href="https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints" target="_blank" rel="noopener">found here</a></p><pre class="crayon-plain-tag">https://YOUR-BUCKET.s3.YOUR-REGION.amazonaws.com/YOUR-FILE
https://YOUR-BUCKET.s3.YOUR-REGION.amazonaws.com/SOME-FOLDER/SOME-SUB-FOLDER/YOUR-FILE</pre><p>
&nbsp;</p>
<div id="attachment_8925" style="width: 902px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-upload-file-to-s3-bucket-low-level-rest-api-put-request.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8925" class="size-full wp-image-8925" src="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-upload-file-to-s3-bucket-low-level-rest-api-put-request.png" alt="Upload file to Amazon S3 - Call low level API (PUT request)" width="892" height="752" srcset="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-upload-file-to-s3-bucket-low-level-rest-api-put-request.png 892w, https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-upload-file-to-s3-bucket-low-level-rest-api-put-request-300x253.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-upload-file-to-s3-bucket-low-level-rest-api-put-request-768x647.png 768w" sizes="(max-width: 892px) 100vw, 892px" /></a><p id="caption-attachment-8925" class="wp-caption-text">Upload file to Amazon S3 &#8211; Call low level API (PUT request)</p></div>
<p>&nbsp;</p>
<h3>Upload Binary File to S3 (i.e. Zip, mp3, gzip, png, jpeg&#8230;)</h3>
<p>Above method only works for Text Files. If you have Binary files (e.g. Zip file, mp3, png, jpeg) then you can use below workaround.</p>
<ol>
<li>Check Is Multi Part / File Upload Option next to the Body editor (<a href="https://zappysys.com/blog/rest-api-file-upload-using-ssis-multi-part-post/" target="_blank" rel="noopener">Read this Post for more info</a>)</li>
<li>In the Body enter file path like below<br />
<pre class="crayon-plain-tag">@c:\folder\some-file.xyz</pre>
</li>
<li>That&#8217;s it, now your binary file can be uploaded to S3 same way as Text file we uploaded in earlier section.</li>
</ol>
<p>&nbsp;</p>
<p><strong>NOTE:</strong> <span style="text-decoration: underline;">Binary file option only works in the latest Build Uploaded after 5/21/2020</span></p>
<p>&nbsp;</p>
<h2><span id="Using_SSIS_JSON_Source_to_read_from_REST_API_and_load_into_SQL_Server">Debugging AWS API Command Line Requests using Fiddler (Web Proxy)</span></h2>
<p>Before we see more examples of calling AWS API lets first learn how to capture Request data using <a href="https://aws.amazon.com/cli/" target="_blank" rel="noopener">aws command line</a> (CLI). We will use <a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/" target="_blank" rel="noopener">Fiddler</a> to capture AWS API Requests.</p>
<ol>
<li>Download and <a href="https://www.telerik.com/download/fiddler" target="_blank" rel="noopener">Install Fiddler</a> (Free Tool)</li>
<li>Install  <a href="https://aws.amazon.com/cli/" target="_blank" rel="noopener">aws command line</a></li>
<li>Open command prompt and type aws configure command to set credentials.  For more info see <a href="http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html" target="_blank" rel="noopener">configure aws credentials</a> .. see below example.<br />
<pre class="crayon-plain-tag">c:&gt; aws configure
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: us-west-2
Default output format [None]: json</pre>
</li>
<li>Once you set credentials launch Fiddler</li>
<li>On the Fiddler Tools menu &gt; Click Fiddler Option &gt; HTTPS &gt; Check <strong>Decrypt HTTPS Traffic</strong></li>
<li>Once you do that you may be asked to Trust Fiddler Certificate click OK</li>
<li>Close and Open Fiddler to apply setting</li>
<li>Now any command you type in aws command line will show up in fiddler. This command we can use in SSIS REST API Task or XML Source to call virtually Any API AWS supports.</li>
<li>For example to call some lambda function (supply input json data from file) use below command and watch Fiddler Trace. Notice we added <strong>&#8211;no-verify-ssl</strong> option so we can see requests in custom web proxy like fiddler (This option will trust Fiddler certificate).<br />
<pre class="crayon-plain-tag">c:\&gt;aws lambda invoke --function-name HelloWorld c:\temp\outputfile.txt --no-verify-ssl --payload file://c://test/customer.json</pre>
&nbsp;</p>
<div id="attachment_2314" style="width: 1175px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-get-raw-rest-request-aws-commandline-cli-capture-fiddler.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2314" class="size-full wp-image-2314" src="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-get-raw-rest-request-aws-commandline-cli-capture-fiddler.png" alt="Capture AWS Commandline (CLI) request using Fiddler" width="1165" height="640" srcset="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-get-raw-rest-request-aws-commandline-cli-capture-fiddler.png 1165w, https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-get-raw-rest-request-aws-commandline-cli-capture-fiddler-300x165.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-get-raw-rest-request-aws-commandline-cli-capture-fiddler-768x422.png 768w, https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-get-raw-rest-request-aws-commandline-cli-capture-fiddler-1024x563.png 1024w" sizes="(max-width: 1165px) 100vw, 1165px" /></a><p id="caption-attachment-2314" class="wp-caption-text">Capture AWS Commandline (CLI) request using Fiddler</p></div></li>
<li>Once you have this information you can use it inside ZappySys Components which supports API calls (e.g. REST API Task, JSON Source, XML Source). For this example we will use REST API Task to call same Lambda Function. Things to change to call any API is URL, Method, ContentType, Body. If its GET call then you wont have Body.
<div id="attachment_2315" style="width: 826px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-call-amazon-aws-lambda-function-using-rest-api-task.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2315" class="size-full wp-image-2315" src="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-call-amazon-aws-lambda-function-using-rest-api-task.png" alt="Calling Amazon AWS Lambda Function using SSIS REST API Task" width="816" height="659" srcset="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-call-amazon-aws-lambda-function-using-rest-api-task.png 816w, https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-call-amazon-aws-lambda-function-using-rest-api-task-300x242.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-call-amazon-aws-lambda-function-using-rest-api-task-768x620.png 768w" sizes="(max-width: 816px) 100vw, 816px" /></a><p id="caption-attachment-2315" class="wp-caption-text">Calling Amazon AWS Lambda Function using SSIS REST API Task</p></div>
<p>&nbsp;</li>
<li>That&#8217;s it.. You can now take this same concept and call virtually API AWS API right insight SSIS without any SDK or command line tools.</li>
</ol>
<h2>Call API Gateway Endpoint (Default URL)</h2>
<p>If you wish to call API hosted on Amazon API Gateway Service then enter direct URL. You have to use OAuth Connection (AWS v4 Provider) as previous section.</p>
<p>Typical URL may look like as below if you calling API gateway Endpoint.</p><pre class="crayon-plain-tag">https://c5hhigf5mh.execute-api.us-east-1.amazonaws.com/prod/pets</pre><p>
<h2>Call AWS API with Region and Custom Service Name</h2>
<p>There will be a time when you will have to call AWS API URL and it doesnt indicate Region / Service but you have to supply part of signature for Authentication.  In this case just enter AWS Service and Region along with ClientID, Secret Fields (Custom Service and  Region attributes were introduced in v3.0 or higher so if you are not seeing on OAuth Connection UI then you probably running older version).</p>
<p>&nbsp;</p>
<h2>Call Amazon Athena API</h2>
<p>Check <a href="https://zappysys.com/blog/import-export-data-amazon-athena-using-ssis/" target="_blank" rel="noopener">this article</a> for detailed instructions</p>
<h2><span id="Using_SSIS_JSON_Source_to_read_from_REST_API_and_load_into_SQL_Server">Call AWS EC2 API</span></h2>
<p>Here is an example of calling EC2 API. This is example of listing EC2 instances.</p>
<p>Request:</p><pre class="crayon-plain-tag">POST https://ec2.us-east-1.amazonaws.com/
Content-Type: application/x-www-form-urlencoded; charset=utf-8

Action=DescribeInstances&amp;Version=2016-11-15</pre><p>
<h2>Call <span id="Using_SSIS_JSON_Source_to_read_from_REST_API_and_load_into_SQL_Server">AWS </span>Lambda API</h2>
<p>Here is some example of calling Lambda function</p>
<p>Request:</p><pre class="crayon-plain-tag">POST https://lambda.YOUR-REGION.amazonaws.com/2015-03-31/functions/YOUR-FUNCTION/invocations

{you-json-input-goes-in-body}</pre><p>
<h2></h2>
<h2>Call AWS ElasticSearch</h2>
<p>If you are using <a href="https://aws.amazon.com/elasticsearch-service/" target="_blank" rel="noopener">AWS Hosted Managed ElasticSearch</a> then also you can use OAuth AWS v4 Provider as below. Assuming you have <a href="https://stackoverflow.com/questions/33751580/how-to-access-kibana-from-amazon-elasticsearch-service" target="_blank" rel="noopener">configured correct Policy</a> to allow your IAM User Account / IP address.</p>
<div id="attachment_6277" style="width: 836px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-call-aws-elasticsearch-rest-api-sign-v4.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6277" class="size-full wp-image-6277" src="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-call-aws-elasticsearch-rest-api-sign-v4.png" alt="Call AWS Hosted ElasticSearch REST API in SSIS (V4 Request Signing)" width="826" height="730" srcset="https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-call-aws-elasticsearch-rest-api-sign-v4.png 826w, https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-call-aws-elasticsearch-rest-api-sign-v4-300x265.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/11/ssis-call-aws-elasticsearch-rest-api-sign-v4-768x679.png 768w" sizes="(max-width: 826px) 100vw, 826px" /></a><p id="caption-attachment-6277" class="wp-caption-text">Call AWS Hosted ElasticSearch REST API in SSIS (V4 Request Signing)</p></div>
<h2>Call <span id="Using_SSIS_JSON_Source_to_read_from_REST_API_and_load_into_SQL_Server">AWS </span>API using Native Task/Components</h2>
<p>ZappySys provides many High quality Tasks / Components for AWS integration. See below list.</p>
<table id="cat_amazon_aws_cloud" style="margin: 0px 0px 1.5em !important; padding: 0px; outline: 0px; border: 1px solid #cccccc !important; border-image: none !important !important; width: 973px; color: #333333; text-transform: none; line-height: 2; text-indent: 0px; letter-spacing: normal; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; font-style: normal; font-weight: normal; word-spacing: 0px; vertical-align: baseline; white-space: normal; border-collapse: collapse !important; border-spacing: 0px; orphans: 2; widows: 2; background-color: #ffffff; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">
<tbody>
<tr class="su-even">
<th colspan="3"><strong>Amazon AWS Cloud Integration</strong></th>
</tr>
<tr>
<td><img loading="lazy" decoding="async" src="https://i1.wp.com/zappysys.com/images/ssis-powerpack/SSIS-Amazon-S3-Cloud-Task.png?w=720&amp;ssl=1" alt="Custom SSIS Tasks - Amazon S3 Task" width="24" height="24" /> <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-s3-task/" target="_blank" rel="noopener">Amazon S3 Task</a></td>
<td><img loading="lazy" decoding="async" src="https://i0.wp.com/zappysys.com/images/ssis-powerpack/SSIS-Amazon-Redshift-Data-Transfer-Task.png?w=720&amp;ssl=1" alt="Custom SSIS Tasks - Amazon Redshift Data Transfer Task" width="24" height="24" /> <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-redshift-data-transfer-task/" target="_blank" rel="noopener">Amazon Redshift Data Transfer Task</a></td>
<td><img loading="lazy" decoding="async" src="https://i1.wp.com/zappysys.com/images/ssis-powerpack/SSIS-Amazon-Redshift-ExecuteSQL-Task.png?w=720&amp;ssl=1" alt="Custom SSIS Tasks - Amazon Redshift ExecuteSql Task" width="24" height="24" /> <a href="https://zappysys.com/products/ssis-powerpack/ssis-redshift-execute-sql-task/" target="_blank" rel="noopener">Amazon Redshift ExecuteSql Task</a></td>
</tr>
<tr class="su-even">
<td><img loading="lazy" decoding="async" src="https://i0.wp.com/zappysys.com/images/ssis-powerpack/ssis-amazon-redshift-cluster-management-task.png?w=720&amp;ssl=1" alt="Custom SSIS Tasks - Amazon Redshift Cluster Management Task" width="24" height="24" /> <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-redshift-cluster-management-task/" target="_blank" rel="noopener">Amazon Redshift Cluster Management Task</a></td>
<td><img loading="lazy" decoding="async" src="https://i1.wp.com/zappysys.com/images/ssis-powerpack/SSIS-Amazon-DynamoDB-Source-Adapter.png?w=720&amp;ssl=1" alt="Custom SSIS Components - Amazon DynamoDB Source" width="24" height="24" /> <a href="https://zappysys.com/products/ssis-powerpack/ssis-dynamodb-source/" target="_blank" rel="noopener">Amazon DynamoDB Source</a></td>
<td><img loading="lazy" decoding="async" src="https://i1.wp.com/zappysys.com/images/ssis-powerpack/SSIS-Amazon-DynamoDB-Destination-Adapter.png?w=720&amp;ssl=1" alt="Custom SSIS Components - Amazon DynamoDB Destination" width="24" height="24" /> <a href="https://zappysys.com/products/ssis-powerpack/ssis-dynamodb-destination/" target="_blank" rel="noopener">Amazon DynamoDB Destination</a></td>
</tr>
<tr>
<td><img loading="lazy" decoding="async" src="https://i0.wp.com/zappysys.com/onlinehelp/ssis-powerpack/scr/images/amazon-redshift-source/ssis-amazon-redshift-source.png?w=720&amp;ssl=1" alt="Custom SSIS Components - Amazon Redshift Source" width="24" height="24" /> <a href="https://zappysys.com/products/ssis-powerpack/ssis-amazon-redshift-source-connector/" target="_blank" rel="noopener">Amazon Redshift Source</a></td>
<td><img loading="lazy" decoding="async" src="https://i1.wp.com/zappysys.com/images/ssis-powerpack/SSIS-Amazon-DynamoDB-Source-Adapter.png?w=720&amp;ssl=1" alt="Custom SSIS Components - Amazon DynamoDB Source" width="24" height="24" /> Amazon SQS Queue Source</td>
<td> <img loading="lazy" decoding="async" src="https://i1.wp.com/zappysys.com/images/ssis-powerpack/SSIS-Amazon-DynamoDB-Source-Adapter.png?w=720&amp;ssl=1" alt="Custom SSIS Components - Amazon DynamoDB Source" width="24" height="24" /> Amazon SQS Queue Destination</td>
</tr>
</tbody>
</table>
<h2>Conclusion</h2>
<p>Amazon AWS Cloud integration from SSIS packages becoming more and more common scenario. ZappySys provides easy to use no coding connectors to achieve many time consuming scenarios. Having clean drag and drop approach is not only faster but more secure using inbuilt SSIS framework. <a href="https://zappysys.com/products/ssis-powerpack/">Try SSIS PowerPack</a> to explore many other scenarios not discussed in this article.</p>
<p>The post <a href="https://zappysys.com/blog/how-to-call-amazon-aws-api-using-ssis-ec2-lambda-api-gateway-sqs/">How to call Amazon AWS API using SSIS (EC2, Lambda, API Gateway, SQS)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to check Amazon S3 Bucket location (Region)</title>
		<link>https://zappysys.com/blog/check-amazon-s3-bucket-location-region/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Tue, 15 Mar 2016 14:17:39 +0000</pubDate>
				<category><![CDATA[S3 (Simple Storage Service)]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[bucket]]></category>
		<category><![CDATA[command line tools]]></category>
		<category><![CDATA[redshift]]></category>
		<category><![CDATA[redshift copy]]></category>
		<category><![CDATA[Redshift Data Transfer Task]]></category>
		<category><![CDATA[s3]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[ZappyShell]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=409</guid>

					<description><![CDATA[<p>Problem Sometimes if you loading data to Redshift via COPY command or using SSIS Redshift Data Transfer Task to move data to redshift then you will have to make sure your S3 Bucket is in the same region as Redshift Cluster. Many people don&#8217;t know how to verify that because its hidden in the console. This [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/check-amazon-s3-bucket-location-region/">How to check Amazon S3 Bucket location (Region)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Problem</h2>
<p>Sometimes if you loading data to Redshift via <a href="http://docs.aws.amazon.com/redshift/latest/dg/r_COPY.html" target="_blank">COPY</a> command or using <a href="//zappysys.com/products/ssis-powerpack/ssis-amazon-redshift-data-transfer-task/" target="_blank">SSIS Redshift Data Transfer Task</a> to move data to redshift then you will have to make sure your S3 Bucket is in the same region as Redshift Cluster. Many people don&#8217;t know how to verify that because its hidden in the console. This post will help you to find it easily.</p>
<h2>Find Amazon S3 bucket location (AWS Region endpoint)</h2>
<p>Below is step-by-step instructions how to find S3 Bucket region (i.e. location)</p>
<ol>
<li>Open your AWS Console by visiting <a href="https://console.aws.amazon.com/" target="_blank">https://console.aws.amazon.com/</a></li>
<li>From dashboard click on <strong>S3</strong> option (or visit <a href="https://console.aws.amazon.com/s3/home" target="_blank">https://console.aws.amazon.com/s3/home</a> )</li>
<li>You will see all buckets in the left side list</li>
<li>Click on desired S3 bucket name</li>
<li>Click on Properties Tab at the top</li>
<li>Now you will see <strong>Region</strong> for the selected bucket along with many other properties.</li>
</ol>
<p>Sometimes You may see US Standard as region name that means your bucket is located in US East (N. Virginia)</p>
<p>If you want to know Region Code rather than name check this link : <a href="http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region" target="_blank">Region Endpoints for Amazon S3 </a></p>
<div id="attachment_410" style="width: 592px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/03/how-to-find-amazon-s3-bucket-location-region-endpoint-aws.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-410" class="size-full wp-image-410" src="//zappysys.com/blog/wp-content/uploads/2016/03/how-to-find-amazon-s3-bucket-location-region-endpoint-aws.png" alt="How to find amazon s3 bucket location (AWS region endpoint)" width="582" height="272" srcset="https://zappysys.com/blog/wp-content/uploads/2016/03/how-to-find-amazon-s3-bucket-location-region-endpoint-aws.png 582w, https://zappysys.com/blog/wp-content/uploads/2016/03/how-to-find-amazon-s3-bucket-location-region-endpoint-aws-300x140.png 300w" sizes="(max-width: 582px) 100vw, 582px" /></a><p id="caption-attachment-410" class="wp-caption-text">How to find amazon s3 bucket location (AWS region endpoint)</p></div>
<h2>Download/Upload data to S3 bucket via Command line</h2>
<p>If you want to automate S3 file download/upload then check <a href="//zappysys.com/products/zappyshell/" target="_blank">this command line tool</a></p>
<h3>ZappyShell Command line tools for Amazon S3</h3>
<p><img decoding="async" title="ZappyShell Command line tools for Amazon S3" src="//zappysys.com/onlinehelp/zappyshell/scr/images/zappyshell-for-aws-command-line-tools.png" alt="Command line tools for Amazon S3" /></p>
<p>&nbsp;</p>
<h3>Upload local files to Amazon S3 from command line</h3>
<p><img decoding="async" title="Upload local files to Amazon S3 from command line" src="//zappysys.com/onlinehelp/zappyshell/scr/images/amazon-s3-command-line-tools-upload-files.png" alt="Upload local files to Amazon S3 from command line" /></p>
<p>&nbsp;</p>
<h3>List S3 buckets using command line</h3>
<p><img decoding="async" title="List S3 buckets using command line" src="//zappysys.com/onlinehelp/zappyshell/scr/images/amazon-s3-command-line-tools-list-bucket.png" alt="List S3 buckets using command line" /></p>
<p>&nbsp;</p>
<h3>List S3 file information using command line</h3>
<p><img decoding="async" title="List S3 file information using command line" src="//zappysys.com/onlinehelp/zappyshell/scr/images/amazon-s3-command-line-tools-list-information.png" alt="List S3 file information using command line" /></p>
<p>&nbsp;</p>
<h3>List S3 files using command line</h3>
<p><img decoding="async" title="List S3 files using command line" src="//zappysys.com/onlinehelp/zappyshell/scr/images/amazon-s3-command-line-tools-list-s3-files.png" alt="List S3 files using command line" /></p>
<h2>Download/Upload data to S3 bucket from SSIS</h2>
<a href="https://zappysys.com/blog/check-amazon-s3-bucket-location-region/"><img decoding="async" src="https://zappysys.com/blog/wp-content/plugins/wp-youtube-lyte/lyteCache.php?origThumbUrl=%2F%2Fi.ytimg.com%2Fvi%2FtlW7lpJoWEg%2Fhqdefault.jpg" alt="YouTube Video"></a><br /><br /></p>
<h2>Load data to Amazon Redshift using S3 Bucket and COPY command</h2>
<p>Below video shows how to use S3 bucket to perform bulk data load into Amazon Redshift using <a href="//zappysys.com/products/ssis-powerpack/ssis-amazon-redshift-data-transfer-task/" target="_blank">SSIS Redshift Data Transfer Task</a><br />
<a href="https://zappysys.com/blog/check-amazon-s3-bucket-location-region/"><img decoding="async" src="https://zappysys.com/blog/wp-content/plugins/wp-youtube-lyte/lyteCache.php?origThumbUrl=%2F%2Fi.ytimg.com%2Fvi%2F5S_p0fNn6a8%2Fhqdefault.jpg" alt="YouTube Video"></a><br /><br /></p>
<h2>Conclusion</h2>
<p>Amazon S3 provides most common way to store/load data for various AWS related services (e.g. EMR, Redshift). Zappysys is one of the top leading providers who make tools for AWS, NoSQL and other Cloud connectivity providers. Check <a href="//zappysys.com/products/ssis-powerpack/" target="_blank">SSIS PowerPack</a> (For SSIS) or <a href="//zappysys.com/products/zappyshell/" target="_blank">ZappyShell Command line for AWS</a> if you want command line solution. ZappyShell is just single exe file does all heavy lifting for you 🙂</p>
<p>Cheers!</p>
<p>The post <a href="https://zappysys.com/blog/check-amazon-s3-bucket-location-region/">How to check Amazon S3 Bucket location (Region)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Extract / Unload Redshift data into SQL Server using SSIS</title>
		<link>https://zappysys.com/blog/extract-unload-redshift-data-sql-server-using-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Tue, 27 Oct 2015 19:55:36 +0000</pubDate>
				<category><![CDATA[AWS (Amazon Web Services)]]></category>
		<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[Redshift]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[big data]]></category>
		<category><![CDATA[cloud computing]]></category>
		<category><![CDATA[etl]]></category>
		<category><![CDATA[extract]]></category>
		<category><![CDATA[redshift]]></category>
		<category><![CDATA[s3]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=128</guid>

					<description><![CDATA[<p>Introduction In our previous article we saw how to load data into Redshift using SSIS or load data into Redshift using ZappyShell Redshift Command Line In this article we will walk through various steps to Extract/UNLOAD Redshift Data into SQL Server using Amazon S3 Storage Task and ExecuteSQL Task for Amazon Redshift. Below is the [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/extract-unload-redshift-data-sql-server-using-ssis/">Extract / Unload Redshift data into SQL Server using SSIS</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 article we saw <a href="//zappysys.com/posts/sql-server-to-redshift-data-load-using-ssis/">how to load data into Redshift using SSIS</a> or load data into Redshift using ZappyShell <a href="//zappysys.com/products/zappyshell/amazon-redshift-command-line-tools/">Redshift Command Line</a></p>
<p>In this article we will walk through various steps to <em>Extract/UNLOAD Redshift Data into SQL Server</em> using <a href="//zappysys.com/products/ssis-powerpack/ssis-amazon-s3-task/">Amazon S3 Storage Task</a> and <a href="//zappysys.com/products/ssis-powerpack/ssis-redshift-execute-sql-task/">ExecuteSQL Task for Amazon Redshift</a>. Below is the screenshot of actual SSIS Package to <em>Extract Redshift Data and Load into SQL Server</em></p>
<div id="attachment_164" style="width: 664px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2015/10/extract-unload-redshift-data-load-to-sql-server-ssis.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-164" class="size-full wp-image-164" src="//zappysys.com/blog/wp-content/uploads/2015/10/extract-unload-redshift-data-load-to-sql-server-ssis.png" alt="Extract/Unload Redshift Data using SSIS and Load into SQL Server" width="654" height="565" srcset="https://zappysys.com/blog/wp-content/uploads/2015/10/extract-unload-redshift-data-load-to-sql-server-ssis.png 654w, https://zappysys.com/blog/wp-content/uploads/2015/10/extract-unload-redshift-data-load-to-sql-server-ssis-300x259.png 300w" sizes="(max-width: 654px) 100vw, 654px" /></a><p id="caption-attachment-164" class="wp-caption-text">Extract/Unload Redshift Data using SSIS and Load into SQL Server</p></div>
<h2>Requirements for Extract Redshift Data using SSIS</h2>
<p>Before you <a href="http://docs.aws.amazon.com/redshift/latest/dg/r_UNLOAD.html">UNLOAD</a> data from Redshift, you have to make sure few things.</p>
<ol>
<li>Setup your Redshift cluster (Follow these instructions <a href="//zappysys.com/blog/how-to-setup-amazon-redshift-cluster-for-outside-data-access/">to setup redshift cluster</a>)</li>
<li>Load some sample data to Redshift (Red more here: <a href="//zappysys.com/posts/sql-server-to-redshift-data-load-using-ssis/">How to load data to Redshift</a>)</li>
<li>Make sure you have correct connection settings to connect to Redshift cluster (Host name, Port, UserId, Password, DB name etc). You can get host name from AWS Console.</li>
<li>Make sure you have Access to S3 Bucket where files will be dumped from Redshift. You will need AccessKey and SecretKey to fetch files from S3</li>
</ol>
<h2>Step-1: Execute Redshift UNLOAD Command</h2>
<p>Very first step would be to unload redshift data as GZip file using <a href="//zappysys.com/products/ssis-powerpack/ssis-redshift-execute-sql-task/">ExecuteSQL Task for Amazon Redshift</a><br />
Below is SQL Command you can use to <em>extract data from Redshift</em>. Notice how we used variable placeholders in SQL Command. These placeholders are replaced at runtime with actual value stored in specified variable.</p><pre class="crayon-plain-tag">unload ('select * from (select * from customerdata limit 1000)')
to 's3://bw-rstest/stage/custdata'
credentials 'aws_access_key_id={{User::S3Accesskey}};aws_secret_access_key={{User::S3SecretKey}}'
ALLOWOVERWRITE</pre><p>
<b>Export as GZip files (Compressed files)</b></p>
<p>If you exporting data as compressed files to save data transfer cost then use GZIP option as below.</p>
<p><strong>NOTE:</strong> Make sure there are no spaces before and after AccessKey and SecretKey otherwise you may get error.</p><pre class="crayon-plain-tag">unload ('select * from (select * from customerdata limit 1000)')
to 's3://bw-rstest/stage/custdata_file_'
credentials 'aws_access_key_id={{User::S3Accesskey}};aws_secret_access_key={{User::S3SecretKey}}'
ALLOWOVERWRITE
GZIP</pre><p>
<h3>Common Errors / Troubleshooting</h3>
<p><strong>UNLOAD command issue with Region mismatch (S3 bucket vs Redshift Cluster)</strong></p>
<p>If your S3 bucket is in different region than Redshift cluster then above command may fail with &#8220;<em>301 permanent redirect error</em>&#8221; in that case you have to change your S3 bucket region. Region can be changed in AWS console (See S3 bucket properties and change location to match region with Redshift cluster region. Both regions must be same.</p>
<blockquote><p>ERROR: XX000: S3ServiceException:The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.,Status 301,Error PermanentRedirect</p></blockquote>
<p><strong>UNLOAD command issue with accesskey and secret key</strong></p>
<p>If you specify invalid accesskey or secretkey &#8211;or&#8211; you have misspelled keywords related to credentials &#8212; or &#8212; you have spaces before or after accesskey or secret key then you may get following error.</p>
<blockquote><p>ERROR: XX000: Invalid credentials. Must be of the format: credentials &#8216;aws_iam_role=&#8230;&#8217; or &#8216;aws_access_key_id=&#8230;;aws_secret_access_key=&#8230;[;token=&#8230;].</p></blockquote>
<h2>Step-2: Download data files from Amazon S3 Bucket to local machine</h2>
<p>Once files are exported to S3 bucket we can download then to local machine using <a href="//zappysys.com/products/ssis-powerpack/ssis-amazon-s3-task/">Amazon S3 Storage Task</a></p>
<h2>Step-3: Un-compress downloaded files</h2>
<p>If you have exported Redshift data as compressed files (using GZIP option) then you can use <a href="https://zappysys.com/products/ssis-powerpack/ssis-zip-file-task/" target="_blank">ZappySys Zip File task</a> to un-compress multiple files.</p>
<p>Or you can write Script to un-compress those files (see below code). You can skip this step if files are not compressed (not used GZIP option in command).</p>
<p>Here is sample <strong>C# code</strong> to un-compress <strong>GZip</strong> files</p><pre class="crayon-plain-tag">public void Main()
{
	System.IO.DirectoryInfo directorySelected = new System.IO.DirectoryInfo(@"C:\amazon\archive");

	foreach (System.IO.FileInfo fileToDecompress in directorySelected.GetFiles("custdata*_part_*"))
	{
		Decompress(fileToDecompress);
	}

	Dts.TaskResult = (int)ScriptResults.Success;
}
private static void Decompress(System.IO.FileInfo fileToDecompress)
{
	using (System.IO.FileStream originalFileStream = fileToDecompress.OpenRead())
	{
		string currentFileName = fileToDecompress.FullName;
		string newFileName = currentFileName.Remove(currentFileName.Length - fileToDecompress.Extension.Length);

		using (System.IO.FileStream decompressedFileStream = System.IO.File.Create(newFileName))
		{
			using (System.IO.Compression.GZipStream decompressionStream = new System.IO.Compression.GZipStream(originalFileStream, System.IO.Compression.CompressionMode.Decompress))
			{
				decompressionStream.CopyTo(decompressedFileStream);
				//Console.WriteLine("Decompressed: {0}", fileToDecompress.Name);
			}
		}
	}
}</pre><p>
&nbsp;</p>
<h2>Step-4: Loop through files using ForEachLoop Container</h2>
<p>Once files downloaded from S3 bucket we can now loop through files using SSIS ForEach Loop Task and load into SQL Server (One file in each iteration)</p>
<div id="attachment_165" style="width: 705px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2015/10/ssis-loop-amazon-s3-files.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-165" class="size-full wp-image-165" src="//zappysys.com/blog/wp-content/uploads/2015/10/ssis-loop-amazon-s3-files.png" alt="Loop through files downloaded from Amazon S3 (Exported using Redshift UNLOAD Command)" width="695" height="384" srcset="https://zappysys.com/blog/wp-content/uploads/2015/10/ssis-loop-amazon-s3-files.png 695w, https://zappysys.com/blog/wp-content/uploads/2015/10/ssis-loop-amazon-s3-files-300x166.png 300w" sizes="(max-width: 695px) 100vw, 695px" /></a><p id="caption-attachment-165" class="wp-caption-text">Loop through files downloaded from Amazon S3 (Exported using Redshift UNLOAD Command)</p></div>
<h2>Step-5: Data Flow &#8211; Load Redshift Data Files to SQL Server</h2>
<p>Inside data flow you can use Flat File source and OLEDB Destination for SQL Server. Just map correct File columns to SQL Server fields and you should be good. If needed convert Unicode/Non-unicode columns using Data Conversion Transform (This is not needed if source is DT_STR and target also DT_STR.. or source is DT_WSTR and target is DT_WSTR i.e. Unicode).</p>
<h2>Downloads</h2>
<p>To download above SSIS Package click on the below links. In order to test below package you first have to <a href="//zappysys.com/products/ssis-powerpack/">download SSIS PowerPack</a><br />
<a href="//zappysys.com/blog/wp-content/uploads/2015/11/RedshiftExtractDemo_2008.zip">Download Demo SSIS Package &#8211; SSIS 2008</a><br />
<a href="//zappysys.com/blog/wp-content/uploads/2015/11/RedshiftExtractDemo_2012.zip">Download Demo SSIS Package &#8211; SSIS 2012/2014</a></p>
<h2>Conclusion</h2>
<p>amazon Redshift is great way to start your data warehouse projects with very minimum investment in a very simple pay as you go model but loading or unloading data from redshift can be challenging task. Using <a href="//zappysys.com/products/ssis-powerpack/">SSIS PowerPack</a> you can perform Redshift data load or unload in few clicks.</p>
<p>The post <a href="https://zappysys.com/blog/extract-unload-redshift-data-sql-server-using-ssis/">Extract / Unload Redshift data into SQL Server using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
