s3-presigned-url

Java

Build Status

Creating a PreSigned URL for the Amazon S3 to download the data via plain HTTP.

Why s3-presigned-url

Usage

s3-presigned-url is available as a dependency jar in Maven central repository.

Maven/Gradle

<dependency>
  <groupId>com.github.gkarthiks</groupId>
  <artifactId>s3-presigned-url</artifactId>
  <version>0.1.1</version>
</dependency>

Apache Buildr


### Apache Ivy
``` <dependency org="com.github.gkarthiks" name="s3-presigned-url" rev="0.1.1" />```

### Groovy Grape

@Grapes( @Grab(group=’com.github.gkarthiks’, module=’s3-presigned-url’, version=’0.1.1’) )


### Gradle/Grails
```compile 'com.github.gkarthiks:s3-presigned-url:0.1.1'```

### Scala SBT
```libraryDependencies += "com.github.gkarthiks" % "s3-presigned-url" % "0.1.1"```

### Leiningen
```[com.github.gkarthiks/s3-presigned-url "0.1.1"]```

## Implementation

<details>
 <summary>
  
  #### Using method arguments</summary><p>
 
* Create a Map for the credentials.
* Construct the End Point URL based on this [Amazon Reference table](http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region).
* Pass "GET" as httpMethod.
* Pass the bucket region where it is hosted.
* Provide the desired expiry time in seconds for TTL.
* Provide the Proxy port and host to retrieve the listof file / folders hosted.

Java
To get the Pre-Signed URL,

Map<String, String> s3Creds = new HashMap<>(); s3Creds.put(S3PresignedURL.AWS_ACCESS_ID, ); s3Creds.put(S3PresignedURL.AWS_SECRET_KEY, );

String preSignedURL = S3PresignedURL.getS3PresignedURL(, s3Creds, "GET", , 3600);

To get the list of files,

Map<String, String> s3Creds = new HashMap<>(); s3Creds.put(S3PresignedURL.AWS_ACCESS_ID, ); s3Creds.put(S3PresignedURL.AWS_SECRET_KEY, );

List lstS3Files = helper.getListFiles(, s3Creds, "GET", , 3600, , );

 
</p></details>

<details>
 <summary>
  
  #### Using Properties File</summary><p>
 
 * Create a <DESIRED_NAME>.properties file in the `resource` folder.
 * Have the following key with case sensitivity and corresponding values assigned to it.

s3.endpoint.url= s3.http.method= GET s3.bucket.region= s3.ttl= s3.access.id= s3.secret.key= s3.proxy.host= s3.proxy.port=



Java
To get the Pre-Signed URL,

String preSignedURL = S3PresignedURL.getS3PresignedURL(“.properties");


To get the list of files,

List lstS3Files = S3PresignedURL.getFilesList(".properties"); ```

</details>