(Quick Reference)

3 Configuration - Reference Documentation

Authors: Benoit Hediard

Version: 1.9.40

3 Configuration

Credentials

Add your AWS credentials parameters to your grails-app/conf/Config.groovy :

grails.plugin.awssdk.accessKey = {ACCESS_KEY}
grails.plugin.awssdk.secretKey = {SECRET_KEY}

If you do not provide credentials in grails-app/conf/Config.groovy , a credentials provider chain will be used that searches for credentials in this order:

  • Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
  • Java System Properties - aws.accessKeyId and aws.secretKey
  • Instance profile credentials delivered through the Amazon EC2 metadata service (IAM role)

For example, you can pass your credentials through VM Options:

grails run-app -Daws.accessKeyId={ACCESS_KEY} -Daws.secretKey={SECRET_KEY}

Or you can create an IAM role with custom permissions/policy and select this role when you launch your EC2 instance.

Region

The default region used is us-east-1. You might override it in your config:

grails.plugin.awssdk.region = 'eu-west-1'

Client config

If required, you can override default client configuration, which will be used each time a new client is created by amazonWebService.

grails {
    plugin {
        awssdk {
            // Amount of time to wait (in milliseconds) when initially establishing a connection before giving up and timing out.
            connectionTimeout = {CONNECTION_TIMEOUT}
            // Maximum number of allowed open HTTP connections.
            maxConnections = {MAX_CONNECTIONS}
            // Maximum number of retry attempts for failed retryable requests (ex: 5xx error responses from a service).
            maxErrorRetry = {MAX_ERROR_RETRY}
            // Protocol (HTTP or HTTPS) to use when connecting to Amazon Web Services.
            protocol = {PROTOCOL}
            // Size hints (in bytes) for the low level TCP send and receive buffers.
            socketBufferSizeHints = [{SOCKET_SEND_BUFFER _SIZE_HINT},{SOCKET_RECEIVE_BUFFER_SIZE_HINT}]
            // Amount of time to wait (in milliseconds) for data to be transfered over an established, open connection before the connection times out and is closed.
            socketTimeout = {SOCKET_TIMEOUT}
            // HTTP user agent header to send with all requests.
            userAgent = {USER_AGENT}
            // Proxy settings
            proxyDomain = {PROXY_DOMAIN}
            proxyHost = {PROXY_HOST}
            proxyPassword = {PROXY_PASSWORD}
            proxyPort = {PROXY_PORT}
            proxyUsername = {PROXY_USERNAME}
            proxyWorkstation = {PROXY_WORKSTATION}
        }
    }
}

If required, you can also override default client configuration for each service.

For example this will define specific properties for SQS and SES.

grails {
    plugin {
        awssdk {
            accessKey = {ACCESS_KEY}    // Default access key
            secretKey = {SECRET_KEY}    // Default secret key
            region = 'eu-west-1'        // Default region
            sqs {
                accessKey = {SQS_ACCESS_KEY}    // Custom access key
                secretKey = {SQS_SECRET_KEY}    // Custom secret key
                region = {SQS_REGION}           // Custom region
                connectionTimeout = {SQS_CONNECTION_TIMEOUT}  // Custom timeout
            }
            ses {
                region = 'us-east-1'    // Since SES is currently only available in this region
            }
            // Other available services
            autoScaling {}
            cloudFormation {}
            cloudFront {}
            cloudSearch {}
            cloudTrail {}
            cloudWatch {}
            codeDeploy {}
            cognitoIdentity {}
            cognitoSync {}
            config {}
            dynamoDB {}
            ec2 {}
            elasticBeanstalk {}
            elasticLoadBalancing {}
            elasticMapReduce {}
            elasticTranscoder {}
            elastiCache {}
            glacier {}
            iam {}
            importExport {}
            kms {}
            kinesis {}
            opsWorks {}
            rds {}
            redshift {}
            route53 {}
            s3 {}
            s3Encryption {}
            sdb {}
            sns {}
            sqs {}
            storagegateway {}
            sts {}
            swf {}
        }
    }
}