How to pipe Amazon S3 Data to CSV in PowerShell



Use standard PowerShell cmdlets to access Amazon S3 tables.

The CData Cmdlets Module for Amazon S3 is a standard PowerShell module offering straightforward integration with Amazon S3. Below, you will find examples of using our AmazonS3 Cmdlets with native PowerShell cmdlets.

Creating a Connection to Your Amazon S3 Data

To authorize Amazon S3 requests, provide the credentials for an administrator account or for an IAM user with custom permissions. Set AccessKey to the access key Id. Set SecretKey to the secret access key.

Note: You can connect as the AWS account administrator, but it is recommended to use IAM user credentials to access AWS services.

For information on obtaining the credentials and other authentication methods, refer to the Getting Started section of the Help documentation.

$conn = Connect-AmazonS3  -AccessKey "$AccessKey" -SecretKey "$SecretKey"

Selecting Data

Follow the steps below to retrieve data from the ObjectsACL table and pipe the result into to a CSV file:

Select-AmazonS3 -Connection $conn -Table ObjectsACL | Select -Property * -ExcludeProperty Connection,Table,Columns | Export-Csv -Path c:\myObjectsACLData.csv -NoTypeInformation

You will notice that we piped the results from Select-AmazonS3 into a Select-Object cmdlet and excluded some properties before piping them into an Export-Csv cmdlet. We do this because the CData Cmdlets append Connection, Table, and Columns information onto each "row" in the result set, and we do not necessarily want that information in our CSV file.

The Connection, Table, and Columns are appended to the results in order to facilitate piping results from one of the CData Cmdlets directly into another one.

Ready to get started?

Download a free trial of the Amazon S3 Cmdlets to get started:

 Download Now

Learn more:

Amazon S3 Icon Amazon S3 Cmdlets

An easy-to-use set of PowerShell Cmdlets offering real-time access to Amazon S3 data. The Cmdlets allow users to easily access live data - just like working with SQL server.