实践从AMAZON S3获取数据

参考了http://doc.chinaunix.net/storage/200912/128835.shtml,实践了一下,获取成功。


import org.jets3t.service.security.AWSCredentials;
import org.jets3t.service.impl.rest.httpclient.RestS3Service;
 
class GroovyClass {
    public static void main(def args){
   def awsAccessKey = "myAccessKey"
   def awsSecretKey = "mySecretKey"
   def awsCredentials = new AWSCredentials(awsAccessKey, awsSecretKey)
   def now = new Date()
   def s3Service = new RestS3Service(awsCredentials)
   def url = s3Service.createSignedGetUrl("my-json", "334194.json", awsCredentials, now + 2)
       println url
    }  
}

转载于:https://my.oschina.net/xiang1987/blog/140547

你可能感兴趣的:(实践从AMAZON S3获取数据)