<?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>Amazon S3 JSON Driver Archives | ZappySys Blog</title>
	<atom:link href="https://zappysys.com/blog/category/odbc-powerpack/odbc-drivers/amazon-s3-json-driver/feed/" rel="self" type="application/rss+xml" />
	<link>https://zappysys.com/blog/category/odbc-powerpack/odbc-drivers/amazon-s3-json-driver/</link>
	<description>SSIS / ODBC Drivers / API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more</description>
	<lastBuildDate>Wed, 20 Nov 2019 18:23:57 +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>Amazon S3 JSON Driver Archives | ZappySys Blog</title>
	<link>https://zappysys.com/blog/category/odbc-powerpack/odbc-drivers/amazon-s3-json-driver/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Import Amazon S3 files into SQL Server (CSV/JSON/XML Driver)</title>
		<link>https://zappysys.com/blog/import-amazon-s3-files-sql-server-csv-json-xml-driver/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Mon, 12 Aug 2019 16:32:00 +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[ODBC Drivers]]></category>
		<category><![CDATA[ODBC Gateway]]></category>
		<category><![CDATA[ODBC PowerPack]]></category>
		<category><![CDATA[S3 (Simple Storage Service)]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[CSV]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[sql server]]></category>
		<category><![CDATA[xml]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=7206</guid>

					<description><![CDATA[<p>Introduction There might be a case when you have many CSV, JSON or XML files in Amazon S3 bucket and you want them to be imported straight into a SQL Server table. Here come ZappySys ODBC PowerPack and ZappySys Data Gateway (part of ODBC PowerPack) which will enable you to accomplish that. ZappySys ODBC PowerPack includes powerful [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/import-amazon-s3-files-sql-server-csv-json-xml-driver/">Import Amazon S3 files into SQL Server (CSV/JSON/XML Driver)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p style="text-align: justify;"><img decoding="async" class="alignnone wp-image-7581 size-thumbnail alignleft" src="https://zappysys.com/blog/wp-content/uploads/2019/06/s3-to-sql-150x150.png" alt="" width="150" height="150" srcset="https://zappysys.com/blog/wp-content/uploads/2019/06/s3-to-sql-150x150.png 150w, https://zappysys.com/blog/wp-content/uploads/2019/06/s3-to-sql-300x300.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/06/s3-to-sql.png 400w" sizes="(max-width: 150px) 100vw, 150px" />There might be a case when you have many CSV, JSON or XML files in <a href="https://aws.amazon.com/s3/" target="_blank" rel="noopener">Amazon S3</a> bucket and you want them to be imported straight into a SQL Server table. Here come <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ZappySys ODBC PowerPack</a> and <a href="https://zappysys.com/products/odbc-powerpack/data-gateway/" target="_blank" rel="noopener">ZappySys Data Gateway</a> (part of ODBC PowerPack) which will enable you to accomplish that. ZappySys ODBC PowerPack includes powerful Amazon S3 CSV, Amazon S3 JSON and Amazon S3 XML drivers that let you connect to an S3 bucket and read the contents from the files in the bucket. Bringing in ZappySys Data Gateway allows doing that right from a SQL Server. Let&#8217;s begin and see how to import Amazon S3 files into SQL Server.</p>
<p>&nbsp;</p>
<p>These drivers are related to this article:</p>
<div class="content_block" id="custom_post_widget-7227"><div style="display: table-row; background: #f7f7f7;">
<div style="display: table-cell; padding: 1em; border: 1px solid #ccc;"><img decoding="async" style="vertical-align: middle; width: 50px; height: 50px; max-width: 50px;" src="//i1.wp.com/zappysys.com/images/odbc-powerpack/odbc-amazon-s3-xml-driver.png?w=100&amp;ssl=1" alt="Web API Destination" width="50" height="50" /></div>
<div style="display: table-cell; padding: 1em; border: 1px solid #ccc; border-left: none; width: 100%;"><a href="//zappysys.com/products/odbc-powerpack/amazon-s3-odbc-driver-xml-files/" target="_blank" rel="noopener">Amazon S3 Driver (for XML Files)</a></div>
</div></div>
<div class="content_block" id="custom_post_widget-7229"><div style="display: table-row; background: #f7f7f7;">
<div style="display: table-cell; padding: 1em; border: 1px solid #ccc;"><img loading="lazy" decoding="async" style="vertical-align: middle; width: 50px; height: 50px; max-width: 50px;" src="//i0.wp.com/zappysys.com/images/odbc-powerpack/odbc-amazon-s3-json-driver.png?w=100&amp;ssl=1" alt="Web API Destination" width="50" height="50" /></div>
<div style="display: table-cell; padding: 1em; border: 1px solid #ccc; border-left: none; width: 100%;"><a href="//zappysys.com/products/odbc-powerpack/amazon-s3-odbc-driver-json-files/" target="_blank" rel="noopener">Amazon S3 Driver (for JSON Files)</a></div>
</div></div>
<div class="content_block" id="custom_post_widget-7233"><div style="display: table-row; background: #f7f7f7;">
<div style="display: table-cell; padding: 1em; border: 1px solid #ccc;"><img loading="lazy" decoding="async" style="vertical-align: middle; width: 50px; height: 50px; max-width: 50px;" src="https://i2.wp.com/zappysys.com/images/odbc-powerpack/odbc-amazon-s3-csv-driver.png?w=100&amp;ssl=1" alt="Web API Destination" width="50" height="50" /></div>
<div style="display: table-cell; padding: 1em; border: 1px solid #ccc; border-left: none; width: 100%;"><a href="//zappysys.com/products/odbc-powerpack/amazon-s3-odbc-driver-csv-files/" target="_blank" rel="noopener">Amazon S3 Driver (for CSV Files)</a></div>
</div></div>
<h2>Prerequisites</h2>
<ol>
<li>Have an <a href="https://aws.amazon.com/" target="_blank" rel="noopener">AWS</a> account.</li>
<li>Existing <a href="https://aws.amazon.com/s3/" target="_blank" rel="noopener">Amazon S3</a> bucket.</li>
<li>SQL Server instance installed (can be a <a href="https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/sql-server-2016-express-localdb" target="_blank" rel="noopener">SQL Server Express LocalDB</a> instance).</li>
<li><a href="https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms" target="_blank" rel="noopener">SQL Server Management Studio</a> (SSMS) installed.</li>
<li><a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ZappySys ODBC PowerPack</a> installed (must be installed on a Windows machine; can be a different machine than SQL Server is installed on).</li>
</ol>
<h2>Getting started</h2>
<p style="text-align: justify;">We will start from a simple example of how to load contacts from a JSON that are located in Amazon S3 bucket, then we will proceed by loading contacts from many XML files that are compressed in ZIP, and finally, we will traverse many folders and subfolders to gather CSVs and load contacts from them.</p>
<h2>Step-by-Step &#8211; Import JSON file located at Amazon S3 into SQL Server</h2>
<h3><span style="font-size: 14pt;">Open and configure ZappySys Data Gateway</span></h3>
<div class="content_block" id="custom_post_widget-7369">Now let's look at steps to configure Data Gateway after installation:
<ol>
 	<li>Assuming you have installed <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ZappySys ODBC PowerPack</a> using default options (Which also enables Data Gateway Service)</li>
 	<li>Search "Gateway" in your start menu and click ZappySys Data Gateway
<div class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/start-menu-open-zappysys-data-gateway.png">
<img decoding="async" src="https://zappysys.com/blog/wp-content/uploads/2018/11/start-menu-open-zappysys-data-gateway.png" alt="Open ZappySys Data Gateway" /></a>
<p class="wp-caption-text">Open ZappySys Data Gateway</p>

</div></li>
 	<li>First make sure Gateway Service is running (Verify Start icon is disabled)</li>
 	<li>Also verify Port on General Tab
<div class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/03/ZappySys-data-gateway-port-5000.png">
<img decoding="async" src="https://zappysys.com/blog/wp-content/uploads/2018/03/ZappySys-data-gateway-port-5000.png" alt="Port Number setting on ZappySys Data Gateway" /></a>
<p class="wp-caption-text">Port Number setting on ZappySys Data Gateway</p>

</div></li>
 	<li>Now go to Users tab. <strong>Click Add</strong> icon to add a new user. Check Is admin to give access to all data sources you add in future. If you don't check admin then you have to manually configure user permission for each data source.
<div class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/zappysys-data-gateway-add-user.png">
<img decoding="async" src="https://zappysys.com/blog/wp-content/uploads/2018/11/zappysys-data-gateway-add-user.png" alt="Add Data Gateway User" /></a>
<p class="wp-caption-text">Add Data Gateway User</p>

</div></li>
</ol>
&nbsp;</div>
<h3><a id="create-json-data-source"></a>Create an Amazon S3 JSON data source in ZappySys Data Gateway</h3>
<ol>
<li>The first thing you will have to do is to create a data source in ZappySys Data Gateway. Just click <strong>Add</strong> button, give the data source a name, e.g. &#8220;<strong>MyContactsJSON</strong>&#8220;, and then select <strong>Native &#8211; ZappySys Amazon S3 JSON Driver</strong>:
<div id="attachment_7373" style="width: 637px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7373" class="wp-image-7373 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/06/100-create-new-data-source-in-data-gateway-to-load-json-files-into-sql-server.png" alt="Adding a JSON data source in ZappySys Data Gateway to load it from Amazon S3 bucket into SQL Server" width="627" height="552" srcset="https://zappysys.com/blog/wp-content/uploads/2019/06/100-create-new-data-source-in-data-gateway-to-load-json-files-into-sql-server.png 627w, https://zappysys.com/blog/wp-content/uploads/2019/06/100-create-new-data-source-in-data-gateway-to-load-json-files-into-sql-server-300x264.png 300w" sizes="(max-width: 627px) 100vw, 627px" /><p id="caption-attachment-7373" class="wp-caption-text">Adding a JSON data source in ZappySys Data Gateway to load it from Amazon S3 bucket into SQL Server</p></div></li>
<li>Then click <strong>Edit</strong> and add the Data Gateway user you created in <strong>Users</strong> tab. We will use this user later when adding a Linked Server to the Data Gateway to authenticate:
<div id="attachment_7557" style="width: 688px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7557" class="wp-image-7557 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/06/125-add-data-gateway-user-to-json-data-source-to-get-json-data-into-sql-server.png" alt="Adding a user to the newly created JSON data source" width="678" height="627" srcset="https://zappysys.com/blog/wp-content/uploads/2019/06/125-add-data-gateway-user-to-json-data-source-to-get-json-data-into-sql-server.png 678w, https://zappysys.com/blog/wp-content/uploads/2019/06/125-add-data-gateway-user-to-json-data-source-to-get-json-data-into-sql-server-300x277.png 300w" sizes="(max-width: 678px) 100vw, 678px" /><p id="caption-attachment-7557" class="wp-caption-text">Adding a user to the newly created Amazon S3 JSON data source</p></div></li>
<li>Once you do that, then click <strong>Edit</strong> to configure the data source:
<div id="attachment_7374" style="width: 637px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7374" class="wp-image-7374 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/06/200-modify-data-source-in-data-gateway-to-load-json-files-into-sql-server.png" alt="Preparing to configure the JSON data source to load a JSON from Amazon S3 bucket to SQL Server" width="627" height="445" srcset="https://zappysys.com/blog/wp-content/uploads/2019/06/200-modify-data-source-in-data-gateway-to-load-json-files-into-sql-server.png 627w, https://zappysys.com/blog/wp-content/uploads/2019/06/200-modify-data-source-in-data-gateway-to-load-json-files-into-sql-server-300x213.png 300w" sizes="(max-width: 627px) 100vw, 627px" /><p id="caption-attachment-7374" class="wp-caption-text">Preparing to configure the Amazon S3 JSON data source to load a JSON from Amazon S3 bucket to SQL Server</p></div></li>
<li>When a window opens, click <strong>Click here to Configure the Connection</strong> and enter your <em>Access Key</em> and <em>Secret Key</em>:
<div id="attachment_7376" style="width: 655px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7376" class="wp-image-7376 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/06/300-create-connection-to-amazon-s3-to-load-json-into-sql-server-1.png" alt="Configuring the authentication to Amazon S3 bucket in ZappySys Data Gateway" width="645" height="702" srcset="https://zappysys.com/blog/wp-content/uploads/2019/06/300-create-connection-to-amazon-s3-to-load-json-into-sql-server-1.png 645w, https://zappysys.com/blog/wp-content/uploads/2019/06/300-create-connection-to-amazon-s3-to-load-json-into-sql-server-1-276x300.png 276w" sizes="(max-width: 645px) 100vw, 645px" /><p id="caption-attachment-7376" class="wp-caption-text">Configuring the authentication to Amazon S3 bucket in ZappySys Data Gateway</p></div></li>
<li>After that, select a JSON file you want to load, and then click <strong>Select Filter</strong> button to choose data you want to be displayed in SQL Server:
<div id="attachment_7377" style="width: 668px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7377" class="wp-image-7377 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/06/400-configure-amazon-s3-json-data-source-to-load-data-into-sql-server.png" alt="Configuring the JSON data source to load a JSON from Amazon S3 bucket into SQL Server" width="658" height="702" srcset="https://zappysys.com/blog/wp-content/uploads/2019/06/400-configure-amazon-s3-json-data-source-to-load-data-into-sql-server.png 658w, https://zappysys.com/blog/wp-content/uploads/2019/06/400-configure-amazon-s3-json-data-source-to-load-data-into-sql-server-281x300.png 281w" sizes="(max-width: 658px) 100vw, 658px" /><p id="caption-attachment-7377" class="wp-caption-text">Configuring the JSON data source to load a JSON from Amazon S3 bucket into SQL Server</p></div></li>
<li>Go to the <strong>Preview</strong> tab and click the <strong>Preview Data</strong> button to make sure everything is configured correctly and preview the results:
<div id="attachment_7378" style="width: 668px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7378" class="wp-image-7378 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/06/500-preview-the-results-of-amazon-s3-json-data-source-to-load-data-into-sql-server.png" alt="Previewing JSON data in the data source based on Amazon S3 JSON Driver" width="658" height="653" srcset="https://zappysys.com/blog/wp-content/uploads/2019/06/500-preview-the-results-of-amazon-s3-json-data-source-to-load-data-into-sql-server.png 658w, https://zappysys.com/blog/wp-content/uploads/2019/06/500-preview-the-results-of-amazon-s3-json-data-source-to-load-data-into-sql-server-150x150.png 150w, https://zappysys.com/blog/wp-content/uploads/2019/06/500-preview-the-results-of-amazon-s3-json-data-source-to-load-data-into-sql-server-300x298.png 300w" sizes="(max-width: 658px) 100vw, 658px" /><p id="caption-attachment-7378" class="wp-caption-text">Previewing JSON data in the data source based on Amazon S3 JSON Driver</p></div></li>
</ol>
<p style="text-align: justify;">Now you are ready to create a Linked Server and connect to the data source you just created. If you used &#8220;<strong>MyContactsJSON</strong>&#8221; as the data source name, make sure to use the same name when creating a Linked Server.</p>
<h3><a id="set-up-a-sql-server-linked-server"></a>Set up a SQL Server Linked Server</h3>
<div class="content_block" id="custom_post_widget-5432">Once you configured the data source in Gateway, we can now set up a Linked Server in a SQL Server.
<ol style="margin-left: 10px;">
 	<li>Open SSMS and connect to a SQL Server.</li>
 	<li>Go to Root &gt; Server Objects &gt; Linked Servers node. Right click and click <strong>New Linked Server...
</strong>
<div class="wp-caption alignnone">
<a href="https://zappysys.com/blog/wp-content/uploads/2018/03/create-new-linked-server-ssms.png">
<img decoding="async" src="https://zappysys.com/blog/wp-content/uploads/2018/03/create-new-linked-server-ssms.png" alt="Add Linked Server in SQL Server" />
</a>
<p class="wp-caption-text">Adding Linked Server in SQL Server</p>

</div></li>
 	<li>Now enter the linked server name, select Provider as SQL Native Client.</li>
 	<li>Enter data source as <strong><span class="lang:default decode:true crayon-inline">GatewayServerName,PORT_NUMBER</span></strong> where server name is where ZappySys Gateway is running (can be the same as SQL Server machine or a remote machine). Default PORT_NUMBER is 5000 but confirm that on the Gateway &gt; General tab in case it's different.</li>
 	<li>Enter Catalog Name. This must match name from Data gateway Data sources grid &gt; Name column
<div class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/ssms-sql-server-configure-linked-server-2.png">
<img decoding="async" src="https://zappysys.com/blog/wp-content/uploads/2018/11/ssms-sql-server-configure-linked-server-2.png" alt="Configure Linked Server Provider, Catalog, Server, Port for ZappySys Data Gateway Connection" />
</a>
<p class="wp-caption-text">Configure Linked Server Provider, Catalog, Server, Port for ZappySys Data Gateway Connection</p>
</div>
<div style="color: #31708f;background-color: #d9edf7;border-color: #bce8f1;padding: 15px;margin-bottom: 20px;border: 1px solid transparent;border-radius: 4px;">
<strong>INFO:</strong><br/>
<ul>
    <li>
      For <strong>SQL Server 2012, 2014, 2016, 2017, and 2019</strong>, use the <em>SQL Server Native Client 11.0</em> as the Provider.
    </li>
    <li>
      For <strong>SQL Server 2022 or higher</strong>, use the <em>Microsoft OLE DB Driver for SQL Server</em> as the Provider.
    </li>
  </ul>
</div></li>
 	<li>Click on Security Tab and select the last option "<strong>Be made using this security context</strong>". Enter your gateway user account here.
<div class="wp-caption alignnone">
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-5456" src="https://zappysys.com/blog/wp-content/uploads/2018/11/add-linked-server-sql-server-3-security-2.png" alt="" width="690" height="625" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/add-linked-server-sql-server-3-security-2.png 690w, https://zappysys.com/blog/wp-content/uploads/2018/11/add-linked-server-sql-server-3-security-2-300x272.png 300w" sizes="(max-width: 690px) 100vw, 690px" />
<p class="wp-caption-text">Configuring Linked Server credentials</p>
</li>
<li>
        <p>Optional: Under the Server Options Tab, Enable <b>RPC</b> and <b>RPC Out</b> and Disable Promotion of Distributed Transactions<b>(MSDTC)</b>.</p>
		<div class="wp-caption alignnone">
			<img decoding="async" class="block margin-bottom-10 img-thumbnail" src="https://zappysys.com/blog/wp-content/uploads/2018/11/linked-server-options-rpc-msdtc.png" title="RPC and MSDTC Settings" alt="RPC and MSDTC Settings" />
			<p class="wp-caption-text">RPC and MSDTC Settings</p>
		</div>
        <hr />
        <p>
            You need to enable RPC Out if you plan to use <b><i>EXEC(...) AT [MY_LINKED_SERVER_NAME]</i></b> rather than OPENQUERY.
            <br />
            If don't enabled it, you will encounter the <i>'Server "MY_LINKED_SERVER_NAME" is not configured for RPC'</i> error.
        </p>
        <p>
            Query Example:
            <code class="sql">EXEC('Select * from Products') AT [MY_LINKED_SERVER_NAME]</code>
        </p>
        <hr />
        <p>
            If you plan to use <b><i>'INSERT INTO...EXEC(....) AT [MY_LINKED_SERVER_NAME]'</i></b> in that case you need to Disable Promotion of Distributed Transactions(MSDTC).
            <br />
            If don't disabled it, you will encounter the <i>'The operation could not be performed because OLE DB provider "SQLNCLI11/MSOLEDBSQL" for linked server "MY_LINKED_SERVER_NAME" was unable to begin a distributed transaction.'</i> error.
        </p>
        <p>
            Query Example:
<pre class="">Insert Into dbo.Products 
EXEC('Select * from Products') AT [MY_LINKED_SERVER_NAME]</pre>
        </p>
        <hr />
</li>
 	<li>Click OK to save the Linked Server.</li>
</ol></div>
<h3>Execute the SQL query</h3>
<p style="text-align: justify;">Once you created the Linked Server to ZappySys Data Gateway, you are ready to execute the SQL query and load data into SQL Server. Supposedly, you created the Linked Server with the name &#8220;GATEWAY&#8221;, then open SSMS and execute this query:</p>
<p><code>SELECT * INTO MyContacts FROM openquery([GATEWAY], 'SELECT * FROM $')<br />
SELECT * FROM MyContacts</code></p>
<h3>The results</h3>
<p>You should see similar results after you execute the query:</p>
<div id="attachment_7536" style="width: 609px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7536" class="wp-image-7536 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/06/600-the-results-of-importing-amazon-s3-data-into-sql-server-using-json-driver.png" alt="" width="599" height="257" srcset="https://zappysys.com/blog/wp-content/uploads/2019/06/600-the-results-of-importing-amazon-s3-data-into-sql-server-using-json-driver.png 599w, https://zappysys.com/blog/wp-content/uploads/2019/06/600-the-results-of-importing-amazon-s3-data-into-sql-server-using-json-driver-300x129.png 300w" sizes="(max-width: 599px) 100vw, 599px" /><p id="caption-attachment-7536" class="wp-caption-text">The results of getting JSON data straight from Amazon S3 bucket using ZappySys Amazon S3 JSON driver</p></div>
<p>Now we are ready to proceed to the next section and import many XML files at once.</p>
<h2>Step-by-Step &#8211; Import many XML files located at Amazon S3 into SQL Server</h2>
<h3>Overview</h3>
<p>Supposedly, you have many XMLs where each one is zipped and you want to load them all into a SQL Server table:</p>
<div id="attachment_7548" style="width: 668px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7548" class="wp-image-7548 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/06/650-load-many-compressed-xml-files-from-amazon-s3-bucket-into-sql-server-1.png" alt="Zipped XML files located in Amazon S3 bucket to be loaded into SQL Server" width="658" height="311" srcset="https://zappysys.com/blog/wp-content/uploads/2019/06/650-load-many-compressed-xml-files-from-amazon-s3-bucket-into-sql-server-1.png 658w, https://zappysys.com/blog/wp-content/uploads/2019/06/650-load-many-compressed-xml-files-from-amazon-s3-bucket-into-sql-server-1-300x142.png 300w" sizes="(max-width: 658px) 100vw, 658px" /><p id="caption-attachment-7548" class="wp-caption-text">Zipped XML files located in Amazon S3 bucket to be loaded into SQL Server</p></div>
<p>The first thing you will have to do is to create a data source, based on ZappySys Amazon S3 XML Driver. Let&#8217;s proceed and just do that.</p>
<h3>Create an Amazon S3 XML data source in ZappySys Data Gateway</h3>
<p>Follow the same steps as in <a href="#create-json-data-source">Create an Amazon S3 JSON data source in ZappySys Data Gateway</a> section when adding a new data source, except for these two steps:</p>
<ol>
<li>When adding a data source select <strong>Native &#8211; ZappySys Amazon S3 XML Driver</strong> as <em>Connector Type</em>:
<div id="attachment_7573" style="width: 430px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7573" class="wp-image-7573 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/06/685-create-new-xml-data-source-in-data-gateway-to-load-xml-files-into-sql-selver.png" alt="Choosing &quot;ZappySys Amazon S3 XML Driver&quot; to load XMLs to SQL Server" width="420" height="296" srcset="https://zappysys.com/blog/wp-content/uploads/2019/06/685-create-new-xml-data-source-in-data-gateway-to-load-xml-files-into-sql-selver.png 420w, https://zappysys.com/blog/wp-content/uploads/2019/06/685-create-new-xml-data-source-in-data-gateway-to-load-xml-files-into-sql-selver-300x211.png 300w" sizes="(max-width: 420px) 100vw, 420px" /><p id="caption-attachment-7573" class="wp-caption-text">Choosing &#8220;ZappySys Amazon S3 XML Driver&#8221; to load XMLs to SQL Server</p></div></li>
<li>Then click <strong>Edit</strong> and edit the data source similarly like in this window:
<div id="attachment_7547" style="width: 668px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7547" class="wp-image-7547 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/06/700-configure-amazon-s3-xml-data-source-to-load-into-sql-server-1.png" alt="Configuring data source based on ZappySys XML Driver to load XMLs into SQL Server" width="658" height="516" srcset="https://zappysys.com/blog/wp-content/uploads/2019/06/700-configure-amazon-s3-xml-data-source-to-load-into-sql-server-1.png 658w, https://zappysys.com/blog/wp-content/uploads/2019/06/700-configure-amazon-s3-xml-data-source-to-load-into-sql-server-1-300x235.png 300w" sizes="(max-width: 658px) 100vw, 658px" /><p id="caption-attachment-7547" class="wp-caption-text">Configuring data source based on ZappySys Amazon S3 XML Driver to load XMLs into SQL Server</p></div></li>
</ol>
<p>Now we are ready to set up a Linked Server to this newly created data source.</p>
<h3>Set up a SQL Server Linked Server</h3>
<p style="text-align: justify;">Follow the very same steps from the section above where we <a href="#set-up-a-sql-server-linked-server">added the Linked Server to a JSON data source</a>, except that change <em>Datasource</em> property of the Linked Server to match the name of the Amazon S3 XML data source you created. Once you do that, you are ready to load XMLs into your SQL Server.</p>
<h3>Execute the SQL query</h3>
<p>Again, if you created the Linked Server with name &#8220;GATEWAY&#8221;, execute this SQL query in SSMS:</p>
<p><code>SELECT * INTO MyContacts FROM openquery([GATEWAY], 'SELECT * FROM $')<br />
SELECT * FROM MyContacts</code></p>
<h3>The results</h3>
<p>You should see a similar view once you execute the query:</p>
<div id="attachment_7550" style="width: 614px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7550" class="wp-image-7550 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/06/750-the-result-of-importing-xml-data-from-amazon-s3-into-sql-server.png" alt="The data of many XMLs loaded from Amazon S3 bucket into SQL Server" width="604" height="360" srcset="https://zappysys.com/blog/wp-content/uploads/2019/06/750-the-result-of-importing-xml-data-from-amazon-s3-into-sql-server.png 604w, https://zappysys.com/blog/wp-content/uploads/2019/06/750-the-result-of-importing-xml-data-from-amazon-s3-into-sql-server-300x179.png 300w" sizes="(max-width: 604px) 100vw, 604px" /><p id="caption-attachment-7550" class="wp-caption-text">The data of many XMLs loaded from Amazon S3 bucket into SQL Server</p></div>
<p>Now we are ready to move to the next section and recursively scan CSVs and load them into SQL Server.</p>
<h2>Step-by-Step &#8211; Import CSV file located at Amazon S3 into SQL Server</h2>
<h3>Overview</h3>
<p>Let&#8217;s say you have many CSVs that are located in a folder tree, including subfolders and you want them all in your SQL Server:</p>
<div id="attachment_7552" style="width: 666px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7552" class="wp-image-7552 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/06/800-load-many-csv-files-from-subfolders-from-amazon-s3-bucket-into-sql-server.png" alt="Many CSV files located in Amazon S3 bucket folders and subfolders to be loaded into SQL Server" width="656" height="299" srcset="https://zappysys.com/blog/wp-content/uploads/2019/06/800-load-many-csv-files-from-subfolders-from-amazon-s3-bucket-into-sql-server.png 656w, https://zappysys.com/blog/wp-content/uploads/2019/06/800-load-many-csv-files-from-subfolders-from-amazon-s3-bucket-into-sql-server-300x137.png 300w" sizes="(max-width: 656px) 100vw, 656px" /><p id="caption-attachment-7552" class="wp-caption-text">Many CSV files located in Amazon S3 bucket folders and subfolders to be loaded into SQL Server</p></div>
<p>We will follow the same steps to accomplish that as we did for loading JSON and XMLs.</p>
<h3>Create an Amazon S3 CSV data source in ZappySys Data Gateway</h3>
<p>Follow the steps as in <a href="#create-json-data-source">Create an Amazon S3 JSON data source in ZappySys Data Gateway</a> section when adding a new data source, except for these two steps:</p>
<ol>
<li>When adding a CSV data source select <strong>Native &#8211; ZappySys Amazon S3 CSV Driver</strong> as <em>Connector Type</em>:
<div id="attachment_7574" style="width: 430px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7574" class="wp-image-7574 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/06/875-create-new-csv-data-source-in-data-gateway-to-load-csv-files-into-sql-selver.png" alt="Choosing &quot;ZappySys Amazon S3 CSV Driver&quot; to load CSVs to SQL Server" width="420" height="296" srcset="https://zappysys.com/blog/wp-content/uploads/2019/06/875-create-new-csv-data-source-in-data-gateway-to-load-csv-files-into-sql-selver.png 420w, https://zappysys.com/blog/wp-content/uploads/2019/06/875-create-new-csv-data-source-in-data-gateway-to-load-csv-files-into-sql-selver-300x211.png 300w" sizes="(max-width: 420px) 100vw, 420px" /><p id="caption-attachment-7574" class="wp-caption-text">Choosing &#8220;ZappySys Amazon S3 CSV Driver&#8221; to load CSVs to SQL Server</p></div></li>
<li>Then click <strong>Edit</strong> and edit the data source similarly:
<div id="attachment_7554" style="width: 752px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7554" class="wp-image-7554 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/06/900-configure-amazon-s3-csv-data-source-to-scan-csvs-recursively-and-load-into-sql-server.png" alt="Configuring data source based on ZappySys CSV Driver to load CSVs into SQL Server" width="742" height="582" srcset="https://zappysys.com/blog/wp-content/uploads/2019/06/900-configure-amazon-s3-csv-data-source-to-scan-csvs-recursively-and-load-into-sql-server.png 742w, https://zappysys.com/blog/wp-content/uploads/2019/06/900-configure-amazon-s3-csv-data-source-to-scan-csvs-recursively-and-load-into-sql-server-300x235.png 300w" sizes="(max-width: 742px) 100vw, 742px" /><p id="caption-attachment-7554" class="wp-caption-text">Configuring data source based on ZappySys Amazon S3 CSV Driver to load CSVs into SQL Server</p></div></li>
</ol>
<p>Now we are ready to proceed and add a Linked Server to this data source.</p>
<h3>Set up a SQL Server Linked Server</h3>
<p style="text-align: justify;">Again, follow the very same steps from the section above where we <a href="#set-up-a-sql-server-linked-server">added the Linked Server to a JSON data source</a>, except that change <em>Datasource</em> property of the Linked Server to match the name of the Amazon S3 CSV data source we created. Once you do that, you are ready to load CSVs into your SQL Server.</p>
<h3>Execute the SQL query</h3>
<p>Once again, if you created the Linked Server with name &#8220;GATEWAY&#8221;, execute this SQL query in SSMS:</p>
<p><code>SELECT * INTO MyContacts FROM openquery([GATEWAY], 'SELECT * FROM $')<br />
SELECT * FROM MyContacts</code></p>
<h3>The results</h3>
<p>You should see a similar view, once you execute the query:</p>
<div id="attachment_7559" style="width: 768px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7559" class="wp-image-7559 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/06/950-the-result-of-importing-multiple-csv-files-from-amazon-s3-into-sql-server-1.png" alt="The results of loading many CSVs from Amazon S3 bucket into SQL Server" width="758" height="365" srcset="https://zappysys.com/blog/wp-content/uploads/2019/06/950-the-result-of-importing-multiple-csv-files-from-amazon-s3-into-sql-server-1.png 758w, https://zappysys.com/blog/wp-content/uploads/2019/06/950-the-result-of-importing-multiple-csv-files-from-amazon-s3-into-sql-server-1-300x144.png 300w" sizes="(max-width: 758px) 100vw, 758px" /><p id="caption-attachment-7559" class="wp-caption-text">The results of loading many CSVs from Amazon S3 bucket into SQL Server</p></div>
<h2>Conclusion</h2>
<p style="text-align: justify;">We had a goal to import Amazon S3 files into SQL Server from SQL Server itself. We learned how to load JSON, XML and CSV files into SQL Server, which some of them were zipped and were located at different folders and subfolders. It was possible to accomplish that using <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ODBC PowerPack</a>, <a href="https://zappysys.com/products/odbc-powerpack/data-gateway/" target="_blank" rel="noopener">ZappySys Data Gateway</a> and ODBC PowerPack drivers &#8211; Amazon S3 JSON Driver, Amazon S3 XML Driver, and Amazon S3 CSV Driver. At first, we created data sources in the Data Gateway, then we created Linked Servers in SQL Server and connected to ZappySys Data Gateway, which finally made it possible to load data from Amazon S3 bucket straight from SQL queries in SSMS.</p>
<h2>Check Amazon S3 Integration with Other BI Tools (Power BI, Excel, SSRS, MS Access, etc.)</h2>
<div class="content_block" id="custom_post_widget-7051">ZappySys ODBC Drivers built using ODBC standard which is widely adopted by industry for a long time. Which mean the majority of BI Tools / Database Engines / ETL Tools already there will support native / 3rd party ODBC Drivers. Below is the small list of most popular tools / programming languages our Drivers support. If your tool / programming language doesn't appear in the below list, which means we have not documented use case but as long as your tool supports ODBC Standard, our drivers should work fine.

&nbsp;

<img loading="lazy" decoding="async" class="" src="//zappysys.com/images/odbc-powerpack/odbc-powerpack-integration.jpg" alt="ZappySys ODBC Drivers for REST API, JSON, XML - Integrate with Power BI, Tableau, QlikView, QlikSense, Informatica PowerCenter, Excel, SQL Server, SSIS, SSAS, SSRS, Visual Studio / WinForm / WCF, Python, C#, VB.net, PHP. PowerShell " width="750" height="372" />
<table style="valign: top;">
<tbody>
<tr>
<td>
<p style="text-align: center;"><strong>BI / Reporting Tools
Integration</strong></p>
</td>
<td style="text-align: center;"><strong>ETL Tools
Integration
</strong></td>
<td style="text-align: center;"><strong>Programming Languages</strong>
<strong>Integration</strong></td>
</tr>
<tr>
<td>
<ul>
 	<li><a href="https://zappysys.com/blog/howto-import-json-rest-api-power-bi/" target="_blank" rel="noopener">Microsoft Power BI</a></li>
 	<li><a href="https://zappysys.com/blog/import-rest-api-tableau-read-json-soap-xml-csv/">Tableau</a></li>
 	<li><a href="https://zappysys.com/blog/read-rest-api-using-ssrs-reports-call-json-xml-web-service/" target="_blank" rel="noopener">SSRS (SQL Reporting Services)</a></li>
 	<li><a href="https://zappysys.com/blog/qlik-rest-connector-examples-read-json-xml-api/" target="_blank" rel="noopener">QlikView /Qlik Sense</a></li>
 	<li><a href="https://zappysys.com/blog/call-rest-api-in-microstrategy-json-soap-xml/" target="_blank" rel="noopener">MicroStrategy</a></li>
 	<li><a href="https://zappysys.com/blog/import-rest-api-google-sheet-call-appscript-load-json-soap-xml-csv/" target="_blank" rel="noopener">Google Sheet</a></li>
 	<li><a href="https://zappysys.com/blog/import-json-excel-load-file-rest-api/" target="_blank" rel="noopener">Microsoft Excel</a></li>
 	<li><a href="https://zappysys.com/api/integration-hub/rest-api-connector/access?context=connector" target="_blank" rel="noopener">Microsoft Access</a></li>
 	<li>Oracle OBIEE</li>
 	<li>Many more (not in this list).....</li>
</ul>
</td>
<td>
<ul>
 	<li><a href="https://zappysys.com/blog/read-json-informatica-import-rest-api-json-file/" target="_blank" rel="noopener">Informatica PowerCenter</a> (Windows)</li>
 	<li>Informatica Cloud</li>
 	<li>SSIS (SQL Integration Services)</li>
 	<li><a href="https://zappysys.com/blog/import-rest-api-json-sql-server/" target="_blank" rel="noopener">SQL Server</a></li>
 	<li><a href="https://zappysys.com/blog/read-write-rest-api-data-in-talend-json-xml-soap/" target="_blank" rel="noopener">Talend Data Studio</a></li>
 	<li><a href="https://zappysys.com/blog/pentaho-read-rest-api-in-pentaho/" target="_blank" rel="noopener">Pentaho Kettle</a></li>
 	<li>Oracle OBIEE</li>
 	<li>Many more (not in this list).....</li>
</ul>
</td>
<td>
<ul>
 	<li>Visual Studio</li>
 	<li><a href="https://zappysys.com/blog/calling-rest-api-in-c/" target="_blank" rel="noopener">C#</a></li>
 	<li>C++</li>
 	<li><a href="https://zappysys.com/blog/connect-java-to-rest-api-json-soap-xml/" target="_blank" rel="noopener">JAVA</a></li>
 	<li><a href="https://zappysys.com/blog/set-rest-python-client/" target="_blank" rel="noopener">Python</a></li>
 	<li>PHP</li>
 	<li><a href="https://zappysys.com/blog/call-rest-api-powershell-script-export-json-csv/" target="_blank" rel="noopener">PowerShell</a></li>
 	<li><a href="https://zappysys.com/blog/import-rest-api-json-sql-server/" target="_blank" rel="noopener">T-SQL (Using Linked Server)</a></li>
</ul>
</td>
</tr>
</tbody>
</table>
&nbsp;</div>
<p>The post <a href="https://zappysys.com/blog/import-amazon-s3-files-sql-server-csv-json-xml-driver/">Import Amazon S3 files into SQL Server (CSV/JSON/XML Driver)</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>
	</channel>
</rss>
