Having trouble downloading multiple S3 call recording files of your Amazon Connect contact center at once using AWS CLI on Windows machine?
The Problem:
Well, we all know as DevOps Engineers/Architects that we can use AWS CLI, copy or sync commands to download multiple S3 files at once. However, I faced a weird challenge when doing so from my windows machine using AWS CLI.
Let's see an example:
I wanted to download a file from my S3 bucket as below:
27XXXXXX-bcYYYYYY_20230112T20:19_UTC.wav
However, whenever I used sync or cp commands on my AWS CLI, the file name used to be re written with an appended string in hexadecimal format at the end of the file like below:
27XXXXXX-bcYYYYYY_20230112T20:19_UTC.wav.A7Fe4F15
And hence the error that came up was as below, on debugging:
OSError: [WinError 87] The parameter is incorrect.
Now, this is an error thrown out of OS, and not AWS CLI, to try it out I used EC2 on Linux OS, and no problem using cp or sync commands, file gets downloaded fine.
So, it was clear, its an OS issue not a AWS CLI or commands.
Where to next?
Well in my search, I came across AWS Storage gateway, a hybrid cloud storage service that gives you on-premises access to virtually unlimited cloud storage. Storage Gateway provides a standard set of storage protocols such as iSCSI, SMB, and NFS, which allow you to use AWS storage without rewriting your existing applications.
It struck me what if I can rely on SMB protocol for getting my S3 entirely as a Windows Local drive that would be amazing and can also use that folder as on prem syncing option. The cost is not super expensive, and is worth for the use case.
The Solution:
Steps to setup storage gateway with S3 on EC2
Pre-Requisites:
Created a IAM user, with programmatic access and save the access key and secret access key locally for that account, provide AWS admin access to the user.
Running a VPC with a public subnet, where you will launch your EC2 and security group allowing SMB traffic inbound/outbound rule restricted to your ip or your organization's ip.
领英推荐
net use Z: \\Enter your Public IPV4 address of your EC2 \your bucket name will be shown here /user:sgw-XXXX\smbguest.
Summary:
In the above article, we saw how we can leverage AWS Storage gateway to access our entire S3 bucket storage, which stores call recordings, chat transcripts or any files of a contact center in bulk on local windows file share and can leverage on that data for further integrations or use case. I hope this article helps and provides useful insights for your use case.
Thanks :-)