1 Introduction to Grails AWS Plugin - Reference Documentation
Authors: Lucas Teixeira, Jay Prall
Version: 1.2.12.4
Table of Contents
1 Introduction to Grails AWS Plugin
Grails AWS plugin intends to provide most of any other reason, an EASY WAY to access and use AWS services.Not all services are included in the plugin, you can check this guide to see what you can do and how. If you want to contribute with another service that is not implemented yet, check Section "Contributions ad Reporting Bugs" of this guide.1.1 Installing Grails AWS Plugin
As other grails plugins you can install it using theinstall-plugin
command like this:grails install-plugin aws
BuildConfig.groovy
file, as shown here:grails.project.dependency.resolution = { inherits("global") { } log "info" repositories { //your repositories } dependencies { //your regular dependencies } plugins { //here go your plugin dependencies runtime ':aws:1.2.12.3' } }
aws
as the plugin name, and the 1.2.12.3
as the plugin version. As the time you're reading this, 1.2.12.3 won't probably be the last version, so change it for the correct version you want to grab, or use latest.release as version to grab the latest one.
1.2 Getting the source code
The source code for the plugin is available on Github. http://github.com/grails-aws/grails-aws1.3 Configuring the plugin in your application
You'll have to configure the plugin in Config.groovy to set AWS credentials and other properties specifically to each AWS service you may use.1.3.1 Setting AWS Credentials
Setting AWS Credentials
You can set your access-key and secret-key in two different manners as belowProperty-file credentials configuration
As recommended by Amazon, you can use a .properties file to handle your secret and access keys for this plugin.You'll have to create some properties file with the content as show below:accessKey = your-access-key secretKey = your-secret-key
grails {
plugin {
aws {
credentials {
properties = "/my/path/to/AwsCredentials.properties"
}
}
}
}
Plain-text credentials configuration
If you don't have access to the filesystem in someway, or prefer to set the access and secret key directly in Config.groovy, you can do it this way:grails { plugin { aws { credentials { accessKey = "your-access-key" secretKey = "your-secret-key" } } } }
Remember, if you set a properties file, it will take priority over this way.
Using System Properties as credentials
Sometimes, you still don't have access to filesystem, but don't want to store your credentials wide open in your configuration file, or you want to deploy the same app in more than one place, and use different credentials for each one. So, in these cases, the best approach to solve this, is to pass them as-D
params to your application server. It is easy and the plugin will understand this as a plain text credential, but with nothing hardcoded in your app.You'll have to start your console passing the accessKey and secretKey as param values. In the dev environment, would be like this:grails -DawsAccessKey=xxxxxx -DawsSecretKey=yyyyyy run-app
grails { plugin { aws { credentials { accessKey = System.properties['awsAccessKey'] secretKey = System.properties['awsSecretKey'] } } } }
1.4 Gant scripts
Grails AWS Plugin brings some scripts to use in your app, all scripts names follow this rule:aws-[service]-[operation]
grails aws-ses-get-send-statistics