Setting Locations

Brooklyn supports a very wide range of target locations – localhost is mainly a convenience for testing. With deep integration to Apache jclouds, most well-known clouds and cloud platforms are supported. The following example is for Amazon EC2:

name: simple-appserver-with-location
location:
  jclouds:aws-ec2:
    region: us-east-1
    identity: AKA_YOUR_ACCESS_KEY_ID
    credential: <access-key-hex-digits>
services:
- type: brooklyn.entity.webapp.jboss.JBoss7Server

(You’ll need to replace the identity and credential with the “Access Key ID” and “Secret Access Key” for your account, as configured in the AWS Console.)

Other popular public clouds include softlayer, google-compute-engine, and rackspace-cloudservers-us. Private cloud systems including openstack-nova and cloudstack are also supported, although for these you’ll supply an endpoint: https://9.9.9.9:9999/v2.0/ (or client/api/ in the case of CloudStack) instead of the region.

You can also specify pre-existing servers to use – “bring-your-own-nodes”. These can be a global pool or specific to a service. Both styles are shown here (though normally only one will be selected, depending on the blueprint):

name: simple-appserver-with-location-byon
location:
  byon:
    user: brooklyn
    privateKeyFile: ~/.ssh/brooklyn.pem
    hosts:
    - 192.168.0.18
    - 192.168.0.19
services:
- type: brooklyn.entity.webapp.jboss.JBoss7Server
  location:
    byon: { hosts: [ 127.0.0.1 ] }

Note in this example that we’ve used JSON-style notation in the second location block. YAML supports this, and sometimes that makes more readable plans. (Although in this case a simple location: localhost is equivalent and even more succinct, but this is a tutorial.)

For more information see the Operations: Locations section of the User Guide. This includes support for defining locations externally in a brooklyn.properties file, after which you can deploy to clouds or bring-your-own-nodes simply as location: jclouds:aws-ec2:eu-west-1 or location: named:my_cloudstack.