2021-08-27

Export users from Amazon Connect to CSV

This article is about exporting users from Amazon Connect to CSV with powershell script.
I also have new article where I use Lambda functions to export users and queues to CSV-files stored on S3.

*****************


So far there is no out-of-the-box method to export users from Amazon Connect to let's say CSV-file.

In order to do that you can use Amazon Connect API.

I created a sample PowerShell script that exports users to CSV file.


How to use it:

1. Install PowerShell module for AWS

Run PowerShell as Administrator

Execute command 

PS > Install-Module -name AWSPowerShell.NetCore


2. Create an access key

In AWS -  go to Identity and Access Management (IAM) 

  • Select Access Management -> Users 
  • Select a user that you will be running your PowerShell script as.
  • Go to "Security credentials" tab and click "Create access key"


3. Add Security Profile to Powershell

In powershell console run this command to create Security Profile

Set-AWSCredential -AccessKey <your access key> -SecretKey <your secret key> -StoreAs <ProfileName>

Example:

Set-AWSCredential -AccessKey AKIA9WFOV27FAFT467AD -SecretKey XwPuuFEWQ7K4zbpkfesr/k/VUbsUP0//DKbroOiV -StoreAs MyProfile

Make it default by running this command:

Initialize-AWSDefaultConfiguration -ProfileName <ProfileName> -Region <Your Amazon Connect region>

Example:

Initialize-AWSDefaultConfiguration -ProfileName MyProfile -Region us-east-1

4. Modify Powershell script for your situation and run it

  • Specify InstanceID of your Amazon Connect
  • Specify ExportPath for CSV file
  • Copy script below to .ps1 file and run it in PowerShell.
Link to ps1 script in my github:



5. Additional info 

  • Remember this is just a sample script, so you can fit it to your own purpose
  • The script is limited to the first 1000 users. If you need to export more - read about NextToken parameter
  • Links to documentation about Powershell tools and Amazon Connect API:
https://docs.aws.amazon.com/powershell/latest/userguide/pstools-welcome.html
https://docs.aws.amazon.com/powershell/latest/reference/items/Connect_cmdlets.html https://docs.aws.amazon.com/connect/latest/APIReference/Welcome.html
  • I also have new article where I use Lambda functions to export users and queues to CSV-files stored on S3.