How to Use cloud-init with the Gateway AMI

You can use cloud-init to automatically perform certain operations when starting a new Gateway instance. To do this, pass user data to the instance using either of the following methods:
gateway90
You can use cloud-init to automatically perform certain operations when starting a new Gateway instance. To do this, pass user data to the instance using either of the following methods:
  • Use the "--user-data" parameter for the AWS CLI
  • Set it in the Advanced options when creating the instance through the AWS EC2 web interface.
The Gateway includes version 0.7.4-2 of cloud-init.
Example
A simple example of user data is a bash script. Suppose there is a Custom Assertion stored on an EBS volume that should be copied into each Gateway instance during start up. When the instance is created, the volume maps to
/dev/sdc
. The script for user data might look like:
#!/bin/bash mount /dev/sdc /mnt cp /mnt/MyCustomAssertion.jar /opt/SecureSpan/Gateway/runtime/modules/lib/ chown layer7:layer7 /opt/SecureSpan/Gateway/runtime/modules/lib/MyCustomAssertion.jar chmod 444 /opt/SecureSpan/Gateway/runtime/modules/lib/MyCustomAssertion.jar
The same script implemented using cloud-init modules could look like this:
#cloud-config mounts: - [ sdc, /mnt ] runcmd: - cp /mnt/MyCustomAssertion.jar /opt/SecureSpan/Gateway/runtime/modules/lib/ - chown layer7:layer7 /opt/SecureSpan/Gateway/runtime/modules/lib/MyCustomAssertion.jar - chmod 444 /opt/SecureSpan/Gateway/runtime/modules/lib/MyCustomAssertion.jar
The upper limit for user-data payload is 16KB. For complex operations with artifact dependencies, consider treating the user-data as a mechanism to bootstrap downloading a script (with its dependencies from an S3 bucket) instead of placing the entire script in user-data.
To see which modules are available:
  1. Start up a Gateway instance. 
  2. Connect to the Gateway via SSH as the
    root
    user.
  3. Examine the file:
    /etc/cloud/cloud.cfg
For more information on how the modules function, see http://cloudinit.readthedocs.org/