Skip to content

micke-a/grails-aws

 
 

Repository files navigation

Grails AWS Plugin

About

Grails AWS plugin intends to provide most of any other reason, an EASY WAY to access and use AWS services

Installing

	grails intall-plugin aws

FAQ

Q) Why not use amazon-s3 plugin?
A) Because it is not under massive development anymore, because it depends on quartz plugin, and because I found some itchy bugs on it that really annoys me on my other project using it.

Q) Why you don’t submit a patch to it?
A) Because it is not under massive development anymore (again), and because the idea on this grails-aws plugin, as I said before, is to offer an easier way to use AWS service, and not only S3.

Features

AWS S3 Uploads

Plugin adds the s3upload method to the usual io.File class, you can call this method passing a simple closure configuring the upload request.
Check the action snippet below:

	def file = new File("/tmp/test123.txt") //the uploaded file
	file.s3upload {
		credentials "your-access-key-id", "your-secret-access-key"
		bucket "the-bucket-name"
		acl "public"
		rrs true
		metadata [param: value, param2: value2]
	}

credentials

Use your credentials to connect to AWS.

	credentials "AAAAAAAAAAAAAAAAAA", "ZZZZZZZZZZZZZZZZZZZZZZ"

bucket

The name of the bucket to upload this file. Bucket will not be created, check if exists before uploading to it.

	bucket "user-pictures"

acl

The permissions that will be granted on this file, you can use:

public: Allow public access to everyone that attemps to read this file
private: Sets private access to this file, only your account will read/write on it
public_read_write: This will make this file wide open to any AWS account, read and write
authenticated_read: Using this acl string, only logged AWS accounts will have permissions to read the file

	acl "public"|"private"|"public_read_write"|"authenticated_read"

rrs

If this file will rely on RRS (Reduced Redundancy Storage) or not.

	rrs true|false

metadata

receives a map containing all metadata that will be attached to this file:

	metadata [user-id: 123, username: 'johndoe', registered-date: new Date().format('dd/MM/yyyy')]

Defining default parameters

If you do not set credentials, bucket or other params everytime, you can set this on your Config.groovy file, this way:

	grails.plugin.aws.s3.config.accessKey = "AKICAAJI313YAXNMAEXORAJ6WUA"
	grails.plugin.aws.s3.config.secretKey = "6OMHlB3RpCodfa3MhRbs4Rur4iuW_=3MdSt42MnZTWWh"
	grails.plugin.aws.s3.config.bucket    = "grails-plugin-test"
	grails.plugin.aws.s3.config.acl       = "public"
	grails.plugin.aws.s3.config.rrs       = true

Changelog

Version 0.1 (01/13/2011)

  • Upload to AWS S3

Roadmap

Amazon S3

  • Create public links for private resources with a pre-defined time to expire
  • Ability to remove files from S3
  • Bucket management

Amazon Cloudfront

  • Cloudfront management

Amazon SNS

  • Basic integration with Amazon SNS

Amazon SQS

  • Basic integration with Amazon SQS

Contributions

If you want to contribute, just fork the repo, implement what you want and send me a pull request.
Just remember, the focus on this plugin it is not the complexity of features, but the ease on using it! :)

Contact

Lucas Teixeira
lucastex at gmail dot com
twitter @lucastex

Releases

No releases published

Packages

No packages published