Skip to content

Instantly share code, notes, and snippets.

@GRGSIBERIA
Created January 16, 2014 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GRGSIBERIA/8456281 to your computer and use it in GitHub Desktop.
Save GRGSIBERIA/8456281 to your computer and use it in GitHub Desktop.
S3にテキストファイルをアップロードする
#-*- encoding: utf-8
require 'sinatra/base'
require 'sinatra/reloader'
require 'slim'
require 'aws-sdk'
require './access_secret.rb'
class Server < Sinatra::Base
register Sinatra::Reloader
get '/' do
as = Credential.new
s3 = AWS::S3.new(
:access_key_id => as.access,
:secret_access_key => as.secret
)
bucket = s3.buckets['fukuwarai']
object = bucket.objects['test2.txt']
object.write("hogehogehogehogepuyo")
slim :index
end
end
Server.run! :host => 'localhost', :port => 4567
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment