Copy Amazon S3 Files in SSIS to different AWS Account

Introduction

In our previous blog we saw how to upload data to Amazon S3 now let’s look at how to Copy Amazon Files from one AWS account to another AWS account (Server Side Copy) using SSIS Amazon Storage Task. (Must be version v2.7.9 or higher)

If you are doing file copy within same account then there is no issue. Just use Copy File feature. However if you want to copy between multiple AWS Accounts (e.g. Your Company AWS account to Vendor AWS Account) then you have to perform extra steps.

Prerequisites

Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:
  1. SSIS designer installed. Sometimes it is referred to as BIDS or SSDT (download it from the Microsoft site).
  2. Basic knowledge of SSIS package development using Microsoft SQL Server Integration Services.
  3. Make sure ZappySys SSIS PowerPack is installed (download it, if you haven't already).
  4. (Optional step). Read this article, if you are planning to deploy packages to a server and schedule their execution later.

Amazon S3 File Copy Scenario

Now let’s think about a scenario where you have to copy some files from Account-A to Account-B. Account-B can be owned by totally different company (may be your Vendor) and you don’t have security control of it.

Before we can copy from Account-A to Account-B we first have to Configure permissions in Account-B. Basically when you use SSIS S3 Task for Copy operation it uses Source account (i.e. Account-A) to push files to destination account (Account-B). So you have Allow write permission for Source Account-A in Destination AWS Bucket (i.e. Account-B).

Find Canonical ID of Source Account

  1. First login to Account-A and findout Canonical ID (Usually 64-digit long)
  2. To get Canonical ID click on Your Account Name > My Security Credentials
  3. When prompted click Continue to Security Credentials option.
  4. Expand Account Identifier and copy Canonical ID
    How to find AWS Account ID and Canonical User ID

    How to find AWS Account ID and Canonical User ID

Configure Target S3 Bucket Permissions to allow Source Account (Write Access)

Now once you have Source account Canonical User ID, you can proceed to next step.

  1. Log in to Target account (i.e. Account B). Where you like to copy files.
  2. Go to S3 Area and Click on the target bucket where you like to copy files
  3. Go to Security Tab
  4. Add Source Account Canonical ID and Check Write Permission (List is Optional for most).
    Give Write permission in Target AWS S3 Bucket (Enter Amazon Source Account Canonical User ID)

    Give Write permission in Target AWS S3 Bucket (Enter Amazon Source Account Canonical User ID)

Copy Amazon S3 Files from one Account Bucket to Another

Now once you configure permission on target bucket. We are ready to execute Amazon S3 File Copy Operation in SSIS

  1. Open SSIS Package in Visual Studio
  2. Drag ZS Amazon Storage Task from SSIS Toolbox
  3. Double click it to configure
  4. Select Copy File Operation from Action Dropdown
  5. Click New for Source Connection (Enter Source Account Credentials). Click Test and OK to save.
  6. Now Click Browse to Select Source Files you like to Copy. You can use Wild card pattern for multiple file copy.
    Example:  mysourcebucket/subfolder/localsubfile*.csv
  7. Click New for Target Connection (Enter Target Account Credentials). Click Test and OK to save.
  8. Now Click Browse to Select Target Folder Location where you like to Save Copied files.
    Example:  mytargetbucket/somefolder/
  9. Click OK to Save
  10. Execute SSIS Package to test
Copy Amazon S3 Files using SSIS (Copy Files between multiple Accounts / S3 Buckets)

Copy Amazon S3 Files using SSIS (Copy Files between multiple Amazon Accounts / S3 Buckets)

Conclusion

In this post you have seen how easy it is to copy S3 Files between multiple AWS accounts in few clicks. Try SSIS PowerPack for free and find out yourself how easy it is to Automate Amazon S3 related operations in SSIS.

 

Posted in SSIS Amazon Storage Task and tagged , .