Created
April 20, 2013 17:45
-
-
Save shinofara/5426789 to your computer and use it in GitHub Desktop.
RubyのAWS::S3を使ってS3の東京リージョンにファイル出来ない場合の対処法!! ref: http://qiita.com/items/371fd9c811929efcd182
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# S3設定 | |
AWS::S3::Base.establish_connection!( | |
:access_key_id => ACCESS_KEY_ID, | |
:secret_access_key => SECRET_ACCESS_KEY, | |
); | |
# 東京リージョンの場合設定値を置換します。 | |
if REGION == "Tokyo" then | |
AWS::S3::DEFAULT_HOST.replace "s3-ap-northeast-1.amazonaws.com" | |
end | |
# アップロード | |
AWS::S3::S3Object.store( | |
remote_file, # アップロード先のファイル名 | |
open(local_file), # アップロードしたいローカルファイル | |
BUCKET_NAME, # バケット名 | |
:access => :public_read # 全体に読み込み公開 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment