オンプレミス環境からS3に高速ファイル転送:ExpeDat Gateway for Amazon S3を使ってみた

2016.02.01

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

西澤です。いざオンプレミスに構築済のシステムをAWS環境に移行しようとすると、大容量データの転送が不可欠です。その多くのケースでは、コストが安くて容量を気にせずに利用できるS3にデータを格納したくなると思います。EC2でFTPサーバを構築してS3へ転送するのは骨が折れますし時間もかかります。そこで高速にデータ転送が可能(700 Mbpsとの触れ込み!)というExpeDat Gateway for Amazon S3を試してみることにしました。

Expedat Gateway for Amazon S3の概要

システム構成

Expedatを利用したS3への転送環境は以下のようなイメージとなります。VPC内に構築したEC2がGatewayとしてS3へのファイル転送をサポートしてくれます。

Expedat S3 Gateway

構築に必要な作業

以下の作業が必要です。

  • データ格納用のS3バケット
    • Expedat Gatewayからアクセスが可能なS3バケット
  • Expedat Gateway(EC2)
    • 公開されているAMIからのEC2環境構築(適切なVPC環境を含む)
  • Expedat Client(作業用サーバ)
    • オンプレミス環境にクライアントソフトウェアを導入
    • クライアントソフトウェアは構築したExpedat GatewayのWebよりダウンロード

利用料金

14日間のFreeTrialが可能ですが、ソフトウェア利用料は割とお高めです。クラウドのメリットは使いたい時だけ使いたい分だけ利用できること。ユースケースとして考えられるような一時的な初期構築時のデータ転送のみで利用するなら、データ移行作業を結果的に短期間で済ませられるので、そこまで割高にはならないのではないでしょうか?

下記は対応しているインスタンスタイプ別の東京リージョンでの料金表ですが、このうちのソフトウェア利用料金にのみ14日間のFreeTrialが適用されますが、EC2インスタンス利用料は計上されますのでご注意ください。長期間利用する場合には、月単位や年単位での利用オプションも選択できるようです。

EC2 Instance Type EC2 Usage Software Total
m3.xlarge $0.385/hr $1.50/hr $1.885/hr
c4.large $0.133/hr $1.50/hr $1.633/hr
c4.xlarge $0.265/hr $1.50/hr $1.765/hr
c4.2xlarge $0.531/hr $1.50/hr $2.031/hr

Expedat Gateway(EC2)環境構築

それでは早速環境を構築してみましょう。AWS Marketplaceのページから、"Continue"をクリックします。

expedat1

"Accept Terms"をクリックして、EC2を起動しましょう。Marketplaceの利用方法は、他のマシンイメージと同様です。

expedat2

今回は"Manual Launch"から、手動で起動してみました。EC2起動操作は割愛しますが、SecurityGroupでは下記ポートの開放が必要です。また、インスタンスタイプはc4.xlargeを利用することにしました。

  • SSH(tcp/22)
    • 初期設定を行うクライアント環境から
  • HTTP(tcp/80)
    • ExpeDatクライアント環境から(ソフトウェアダウンロードの為)
  • データ転送用(udp/8080)
    • ExpeDatクライアント環境から

EC2インスタンスが起動したら、SSHログインしてみましょう。EC2起動時に指定したSSHキーペアを使ってec2−userでログインします。

SSHログインすると、自動的にスクリプトが実行され、Gatewayのセットアップが始まります。

ExpeDat Gateway for Amazon S3 Setup

This script will gather information necessary to access an S3
bucket using ExpeDat.

Enter the name of the target S3 bucket:expedat-bucket

Getting credentials for the S3 bucket


Enter new values or accept defaults in brackets with Enter.
Refer to user manual for detailed description of all options.

Access key and Secret key are your identifiers for Amazon S3. Leave them empty for using the env variables.
Access Key [ASIAxxxxxxxxxxxxxxxx]: 
Secret Key [hNd1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]: 
Default Region [US]: us-west-2

New settings:
  Access Key: ASIAxxxxxxxxxxxxxxxx
  Secret Key: hNd1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  Default Region: us-west-2

Test access with supplied credentials? [Y/n] Y
Please wait, attempting to list all buckets...
Success. Your access key and secret key worked fine :-)

Save settings? [Y/n] Y
Configuration saved to '/usr/local/expedat/s3cfg'

Creating an ExpeDat account
This username and password will be used to access the ExpeDat S3 Gateway

Enter a username: [s3user]: 
Enter a password:

Replacing /etc/svpasswd

Restarting ExpeDat Server

This ExpeDat Gateway for Amazon S3 should now be operational.
This setup script can be repeated by logging back in and running:
/usr/local/expedat/s3setup.sh

To access S3 via this server, download an ExpeDat client from here:

http://ec2-xxx-xxx-xxx-xxx.us-west-2.compute.amazonaws.com/

Then verify that the security group permits incoming UDP port 8080.

Press Return to end this setup session
Connection to xxx.xxx.xxx.xxx closed by remote host.
Connection to xxx.xxx.xxx.xxx closed.

全ての入力が完了すると、一旦接続が自動的に切断されましたが、もう一度ec2−userでログインすると、普通にLinuxインスタンスとして操作できるようでした。上記コマンド結果に出力がありますが、セットアップをやり直したい場合には/usr/local/expedat/s3setup.shを実行すれば良いようです。

セットアップでは、下記情報の入力が必要です。

  • 作成済のS3バケット名
  • アクセスキー/シークレットアクセスキー
  • 利用リージョン
  • ExpeDat接続用ユーザ名/パスワード(クライアントから接続する際の認証情報をここで新規に設定)

アクセスキー/シークレットアクセスキーの項目ですが、EC2インスタンスに対象S3バケットへのアクセスが可能なIAMロールを割り当てたところ指定せずに動作することが確認できました。"Leave them empty for using the env variables."とのことでしたが、内部的にはs3cmdを使っているようで、インスタンスプロファイル(IAMロール)権限も自動で参照してくれるので、個別にアクセスキーを作成する必要は無さそうです。

以上でGateway環境の構築は完了です。簡単ですね。

Expedatクライアント環境の構築

続いてクライアント環境をセットアップしましょう。今回はWindows Server 2008 R2環境を利用しました。SecurityGroupが適切に設定されていれば、EC2インスタンスに割り当てられたPublic IPアドレスにクライアント環境のブラウザから接続できるはずです。

expedat4

こちらからクライアントツールをダウンロードしましょう。GUIベースのクライアントは、Windows OSとMac OS X環境のみ用意されているようです。今回はWindows用のフルクライアントパッケージをダウンロードしました。インストール作業は不要で、zipに含まれるexeファイルを起動するだけで利用できました。

expedat6

それぞれのツールを利用してS3へのファイル転送を確認してみましょう。

MTPexpedat

MTPexpedatは、Windows環境ではお馴染みのFTPやSFTPのクライアントツールによく似たUIを持つ転送ツールです。早速exeファイルを実行してみましょう。接続するサーバの情報とユーザ/パスワードを入力し、Handlersに"S3"を選択して、矢印のボタンをクリックするとGatewayに接続します。

expedat7

転送対象のファイルを選択し、"Send"ボタンをクリックすると転送が始まりました。転送中は、途中経過や終了時間予測がウィンドウ下部に表示されます。

expedat8

無事にS3に格納されました!

expedat10

ちょっと注意です。S3オブジェクトに理解がある方には当然の挙動かもしれませんが、UIからS3バケット上にフォルダを作成するボタンが正常に機能しませんでした。

expedat11

S3バケット内にフォルダを作ってファイルを配置したい場合には、prefix指定をすればフォルダ配下にファイルを格納することができるようです。

expedat12

DropDat

DropDatは転送用環境を事前にセットアップして、ファイルをドラッグ&ドロップして利用することができる転送ツールです。こちらもexeファイルを実行してみます。NewNameの欄には、"DropDat"以外の名前を指定する必要があります(理由はこの後を読めばわかります)。サーバの接続情報やユーザ情報を入力し、"Create"をクリックします。フォルダごと転送をする"Streaming Folders"のチェックボックスは、MTPexpedatの設定画面にも存在していましたが、S3 Handlerからは有効としてもエラーとなり、利用できませんでした。

expedat14

すると、同一フォルダ内に指定した名前のexeファイルが生成されました。こちらに転送したいファイルをドラッグ&ドロップして利用します。

expedat15

こちらからも無事に転送が確認できました。パス指定をする場合は、exeを生成する際に"Destination Folder"にprefixを指定しておく必要があるようです。

expedat16

movedat

movedatはコマンドラインから利用できるクライアントツールです。コマンドプロンプトからexeファイルを格納したフォルダに移動するか、PATH指定をすることで利用できます。

>movedat
movedat - 1.17.0 October 2015 - DEI
usage:
  LIST   movedat [options] [user@]host:[directory/]
  GET    movedat [options] [user@]host:[path] <file>
  GET    movedat [options] [user@]host:[path] [[user@]host:[path]...] <dir>
  SEND   movedat [options] <file> [<file>...] [user@]host:[path]
  MOVE   movedat [options] -m [user@]host:oldpath newpath
  DELETE movedat [options] -x [user@]host:deletepath ...
  MKDIR  movedat [options] -n [user@]host:newfolder ...
  FIND   movedat [options] -F [user@]host:<pattern>
  CACHE  movedat [-p port] [-A|-E] user[:passwd]@host
  "movedat -v" for more options

>movedat -v
(C)2015 Data Expedition, Inc.(R) US Pat. 7158479,7313627,7404003,7630315,8014289
movedat - 1.17.0 October 2015 - DEI, EXP-1.17.0, DOC-2.1.2 MTP-win32-4.2.0 1692
00000002: ExpeDat-1.17A Gateway for Amazon S3 - 151130, Client
usage:
  LIST   movedat [options] [user@]host:[directory/]
  GET    movedat [options] [user@]host:[path] <file>
  GET    movedat [options] [user@]host:[path] [[user@]host:[path]...] <dir>
  SEND   movedat [options] <file> [<file>...] [user@]host:[path]
  MOVE   movedat [options] -m [user@]host:oldpath newpath
  DELETE movedat [options] -x [user@]host:deletepath ...
  MKDIR  movedat [options] -n [user@]host:newfolder ...
  FIND   movedat [options] -F [user@]host:<pattern>
  CACHE  movedat [-p port] [-A|-E] user[:passwd]@host
     Argument   Config          Help
  -a <integer>  Aggression      MTP aggression level (-3 to 5)
  -A <string>                   Permanently cache credentials
  -b <integer>  StreamSize      Compression and packing buffer (kilobytes)
  -B            BuildPath       Create remote directories as required
  -c            NoCheck         No checkfiles, disable download resume
  -C            NoPWCache       Do not use the password cache
  -d <integer>  Debug           Diagnostic level (0 to 6)
  -D            Display         Deliver contents to stdout
  -e <integer>  Expire          Idle timeout (seconds)
  -E <string>                   Expire credentials now
  -f <path>                     Alternate configuration file, "" for none
  -F                            Find files matching wildcard pattern
  -h                            Transfer folder contents one file at a time
  -H            ShowHidden      Include hidden files
  -i                            Transfer folder contents as a stream
  -I            IgnoreExisting  Skip files which already exist
  -k <integer>  MaxRate         Speed limit (kilobytes/second)
  -K            Encrypt         Require content encryption
  -L <integer>  Latency         Advise large minimum RTT (milliseconds)
  -m                            Move/rename a remote file or directory
  -M <integer>  MaxRTT          Limit RTT (milliseconds)
  -n                            Create a new remote directory
  -N <integer>  NoiseRatio      Loss tolerance factor (4 to 5000)
  -o            Objects         Run server scripts as object handlers
  -O            StartOver       Do not resume interrupted transfers
  -p <integer>  Port            Look for server on alternate UDP port
  -q            Quiet           Minimal output, non-interactive
  -r                            Resume interrupted transfers when possible
  -R                            Register a license code
  -s            ShowLogs        Output parseable log format
  -S <integer>  StopTime        Limit total runtime (minutes)
  -t <string>   TryInterval     Set retry behavior ("fail", "skip", or seconds)
  -T <integer>  MaxDatagram     Maximum UDP payload size (bytes)
  -U <integer>  MinDatagram     Minimum UDP payload size (bytes)
  -v                            Display version and help
  -W <string>                   Set user domain for Windows servers
  -x                            Delete one or more remote files
  -y            Yes             Answer 'y' (default) to all queries
  -z            Compress        Enable inline compression

コマンドラインからもファイルを転送してみましょう。今回は2つのファイルを指定して、新しいフォルダに向けてファイルを転送してみました。複数指定した場合には、シーケンシャルに動作するようですね。

>movedat -o testfile3 testfile4 s3user@xxx.xxx.xxx.xxx:testdir3/=S3
Password for s3user@xxx.xxx.xxx.xxx:
 1.00 gigabytes of  1.00 gigabytes at   41.2 megabits/sec
testfile3  1.00 GB in 39.5 sec ( 218 mbit/s)
 1.00 gigabytes of  1.00 gigabytes at   55.2 megabits/sec
testfile4  1.00 GB in 37.0 sec ( 232 mbit/s)

アップロードされたファイルをリストしてみます。2回目の接続時はパスワードが聞かれませんでした。しばらくキャッシュする仕様のようなので、継続して利用したい場合には、"-A"オプションを指定することで、Credential情報を保存して利用することができるようです。詳細は前述のコマンドオプションをご覧ください。

>movedat -o s3user@xxx.xxx.xxx.xxx:testdir3/=S3
-rwxrwxrwx  1,073,741,824  Jan 30 2016 16:19  testfile3
-rwxrwxrwx  1,073,741,824  Jan 30 2016 16:20  testfile4

このツールでもS3にファイルが転送されていることを確認できました。

expedat17

まとめ

今回は、大容量ファイルをS3に高速転送するツールをご紹介しました。今回検証したクライアント環境は、同一リージョン内のEC2インスタンスを利用した為、参考値にしかなりませんが、1GBのファイルを30s前後で転送できる(200〜300Mbps)ことが確認できましたので、1TBのファイルなら8.5hくらいの計算になります。安定してこれくらいの速度が出るなら、かなり有用なツールになりますね。ただし、実際の性能については、Gatewayのインスタンスタイプや、クライアントマシンの性能、インターネット接続環境等にも依存すると思われます。また、AWS環境への安定したネットワーク性能を確保したい場合には、Direct Connectを利用できれば確実です。

エラー発生時の挙動や、複数ファイルを同時に取り扱うケース、負荷がかかった場合にどこがボトルネックになるか等、実際に利用にはもう少し調査が必要です。その結果については、また改めてご報告できればと思います。