All Versions
Bamboo 5.13Bamboo 5.7.x
Bamboo 5.6.x
More...
Each elastic image in the Amazon S3 has its own unique identifier, known as an AMI ID.
You can associate multiple elastic images with a Bamboo server. One default shared image is maintained by Atlassian in the Amazon S3, and is available to all Elastic Bamboo users. You also create your own custom elastic images.
At a high level, the process for creating a custom elastic image consists of taking one of the existing Amazon Machine Images (AMIs) available on Amazon EC2, starting an instance of the AMI, customising the instance and then creating an image from the customised instance. This image can then be used as an elastic image in your Bamboo installation.
Please note, this is not a trivial process. You may wish to consider customising the elastic agents started from your existing image instead, by using Amazon's Elastic Block Store (EBS), as described in Configuring Elastic Instances to use the EBS. This is a much simpler option. If you are having problems, please don't hesitate to contact us for further help.
Please note that we do not support custom elastic images. Consider customising the elastic agents started from your existing image instead.
Important Information
Please note the following important information:
On this page:
Before you begin, you need to ensure that you have set up the following:
wget http://s3.amazonaws.com/ec2-downloads/ec2-api-tools-1.3-30349.zip unzip ec2-api-tools-1.3-30349.zip
EC2_HOME
— set this to the path to the installed EC2 API ToolsEC2_CERT
— set this to the path to the certificate assigned to EC2 accountEC2_PRIVATE_KEY
— set this to the path to the private key assigned to your AWS account$EC2_HOME/bin/ec2-add-keypair <key_pair_name>
"--BEGIN RSA PRIVATE KEY--"
and ending with the line "--END RSA PRIVATE KEY--"
. This private key file will be used to access your AMI instance. Set up the appropriate permissions on the private key file by executing the following command.
chmod 600 <private_key_file>
We strongly recommend that you select an existing Linux/UNIX AMI to customise, rather than starting with a blank AMI. You can get the list of available AMIs by executing the following command:
$EC2_HOME/bin/ec2-describe-images -a
Please check whether you want to launch 32-bit or 64-bit instances from your custom elastic image before selecting an existing AMI. Elastic Bamboo creates"High-CPU Medium" instances (32-bit) by default.
We recommend the following existing Linux/UNIX AMIs for customisation:
The names of Atlassian's and Amazon's AMIs (and hence, their IDs) change with each release of Bamboo, including both major and minor (or point) releases.
Therefore, to find out the AMI ID for your version of Bamboo:
https://maven.atlassian.com/content/repositories/atlassian-public/com/atlassian/bamboo/atlassian-bamboo-agent-elastic-image-default/
in a web browser..ami
, a .pom
and some additional checksum files.atlassian-bamboo-agent-elastic-image-default-A.B.C.ami
file (where A.B.C
relate to numbers of your version of Bamboo).
atlassian-bamboo-agent-elastic-image-default-A.B.C.pom
XML file (where A.B.C
relate to numbers of your version of Bamboo).
ec2ImageID
element in this file. The text content of this element is the name of this AMI.To quickly access Atlassian's AMI ID for a currently-running version of Bamboo:
Open that Bamboo site in a web browser and access its Image Configurations page (see Managing your Elastic Image Configurations for more information). The AMI ID of Atlassian's AMI is listed in the table at the top of this page, in the row whose image configuration contains '(default)' in its name.
After you have selected an existing AMI to customise, the next step is to start an instance of the AMI.
If you chose to customise Atlassian's default AMI, you will have to start the instance from the admin section of Bamboo. See Starting an Elastic Instance.
On start up, the Bamboo agent on Atlassian's AMI checks to see if it was started from a Bamboo server, and immediately shuts itself down if it was not. Because of this, Atlassian's default AMI cannot be started using the command line ec2 tools.
Once started, see Accessing an Elastic Instance for details on how to access the running instance.
Use the ec2-run-instances
command to start your instance, as follows:
$EC2_HOME/bin/ec2-run-instances <image_name> -k <key_pair_name>
where <image_name>
is the name of the AMI selected in the previous step and <key_pair_name>
is the name of the registered key pair generated in '1. Requirements' (the public certificate of this key will be injected into your instance).
For example, if you wanted to start an instance of image ami-e55bbd8c
using key pair my-keypair
, you would run the following command:
$EC2_HOME/bin/ec2-run-instances ami-e55bbd8c -k my-keypair
This command would produce the following command-line output:
INSTANCE i-25b86743 ami-e55bbd8c running my-keypair
i-25b86743
is the name of your new instance, in the above example. Note this down, as you will need the instance name to access your instance in the next step.
Don't forget to shut down unused instances
Please note, once you start an instance, you will be billed by Amazon for instance uptime. If you decide to abandon the setup of a custom elastic image after this step, please ensure that you shut down your instance via the AWS console.
If you started the instance from Bamboo, see Accessing an Elastic Instance for details on how to access the running instance.
Once your instance is running, you will need to obtain the address of the instance so you can access it. To do this, use the following command:
ec2-describe-instances <instance_name>
For example, if you wanted to find the address of instance i-25b86743
, you would enter:
ec2-describe-instances i-25b86743
This command would produce the following command-line output similar to this:
RESERVATION r-790f7210 121852097033 default INSTANCE i-25b86743 ami-e55bbd8c ec2-174-129-94-241.compute-1.amazonaws.com domU-12-31-39-04-38-87.compute-1.internal running elasticbamboo 0 m1.small 2009-06-24T12:36:20+0000 us-east-1c aki-a71cf9ce ari-a51cf9cc monitoring-disabled
The address of your instance in the above example is ec2-174-129-94-241.compute-1.amazonaws.com
You can then use this address to access the instance via SSH. See Accessing an Elastic Instance for instructions. If you are using the example command text from that document, you will need to adjust it as follows:
/opt/bamboo/home/xml-data/configuration/elasticbamboo.pk
in the example command text with the private key file you generated in '1. Requirements'.ec2-68-111-185-197.compute-1.amazonaws.com
in the example command text with the address of your instance.Customising your instance is the most complicated part of creating a custom elastic image. You need to install the packages that are prerequisites for Bamboo onto your instance (if you didn't choose the Elastic Bamboo default image as your base AMI), add your customisations, deploy Bamboo onto your instance and set up an EC2 environment on your instance.
If you selected ami-e55bbd8c
as your base AMI in '2. Selecting an Existing AMI', you can skip this step and go to '5.2 Adding Customisations' as image ami-e55bbd8c
has been pre-configured for Bamboo. If you have selected a different AMI, you will need to install the following packages onto your instance using the commands shown below:
wget http://s3.amazonaws.com/ec2-downloads/ec2-api-tools-1.3-30349.zip unzip ec2-api-tools-1.3-30349.zip mv ec2-api-tools-1.3-30349 /usr/local/ec2/ec2-api-tools
# get Java 6 wget "http://download.java.net/dlj/binaries/jdk-6u11-dlj-linux-i586.bin" mkdir unbundle-jdk-6 cd unbundle-jdk-6 sh ../jdk-6u11-dlj-linux-i586.bin --accept-license cd .. # get Java 5 wget "http://download.java.net/dlj/binaries/jdk-5.0u17-dlj-linux-i586.bin" mkdir unbundle-jdk-5 cd unbundle-jdk-5 sh ../jdk-5.0u17-dlj-linux-i586.bin --accept-license cd .. # Build the JDKs curl "https://jdk-distros.dev.java.net/source/browse/jdk-distros/trunk/utils/construct.sh?content-type=text/plain&rev=148" > construct.sh chmod +x construct.sh ./construct.sh unbundle-jdk-6 /opt/jdk-6 /opt/jre-6 ./construct.sh unbundle-jdk-5 /opt/jdk-5 /opt/jre-5
wget "http://www.apache.org/dist/ant/binaries/apache-ant-1.7.1-bin.tar.bz2" tar xjC /opt -f apache-ant-1.7.1-bin.tar.bz2
wget "http://www.apache.org/dist/maven/binaries/apache-maven-2.0.10-bin.tar.bz2" tar xjC /opt -f apache-maven-2.0.10-bin.tar.bz2 mv /opt/apache-maven-2.0.10 /opt/maven-2.0 ln -fs /opt/maven-2.0 /opt/apache-maven-2.0.10
wget "http://archive.apache.org/dist/maven/binaries/maven-1.1.tar.bz2" tar xjC /opt -f maven-1.1.tar.bz2
Adding your own customisations is quite a simple process, once you have made it this far.
To add user customisations to your instance,
sudo apt-get install tomcat6
', configure it, ensure that your startup scripts are in place, etc, just as you would when installing Tomcat on a standalone machine.
Once you have installed the Bamboo pre-requisites on you instance and added your customisations, you can deploy Bamboo onto your instance.
Before you deploy anything however, you need to create a 'bamboo
' user on your instance by running the following command:
useradd -m bamboo
After you have created the 'bamboo
' user, you need to download the Bamboo agent elastic assembly. The latest version of the Bamboo agent elastic assembly can be downloaded from the Bamboo download center (choose the desired tab and click 'Show all'). If you need an earlier version of the Bamboo agent elastic assembly, you can download it from the Bamboo Archive Downloads page or for a more complete list, our maven repostiory.
Once you have downloaded the Bamboo agent elastic assembly, you need to copy it onto your instance by using the following commands:
cd <BAMBOO_AGENT_ELASTIC_ASSEMBLY_DOWNLOAD_DIRECTORY>/webapp scp -i <private_key_file> atlassian-bamboo-agent-elastic-assembly-<x.x.x>.tar.gz root@<instance_address>:/mnt
where <private_key_file> is the private key file generated in '1. Requirements', <instance_address> is the address of your instance from '4. Accessing your Instance' and <BAMBOO_STANDALONE_DIRECTORY> is your Bamboo Installation directory
Navigate to the /mnt
directory on your instance and install the artifacts, as described below:
tar xzC /opt -f maven-1.0.2.tar.gz
tar xzC /opt -f atlassian-bamboo-agent-elastic-assembly-<x.x.x>.tar.gz ln -s /opt/bamboo-elastic-agent-<x.x.x> /opt/bamboo-elastic-agent
atlassian-bamboo-agent-elastic-assembly-2.3.tar.gz
is available in the webapp
sub-directory of the Bamboo installation directory.mv bamboo-elastic-agent/bamboo-capabilities.properties /home/bamboo/
At this stage, you should have a customised instance with Bamboo deployed onto it. The last step in creating a customised instance is to set up an EC2 environment on your instance. Carry out the following steps to set this up:
scp -i <private_key_file> $EC2_PRIVATE_KEY root@<instance_address>:/mnt scp -i <private_key_file> $EC2_CERT root@<instance_address>:/mnt
export EC2_HOME=/usr/local/ec2/ec2-api-tools export EC2_PRIVATE_KEY=/mnt/<ec2_private_key_file> export EC2_CERT=/mnt/<ec2_certificate_file> export JAVA_HOME=/opt/jdk-5
chown -R bamboo:bamboo /home/bamboo/
/mnt
directory. This file contains the default Elastic Bamboo path configuration settings, as seen below:
export JAVA_HOME=/opt/jdk-5 export M2_HOME=/opt/maven-2.0 export MAVEN_HOME=/opt/maven-1.0.2 export ANT_HOME=/opt/apache-ant-1.7.1 export EC2_HOME=/usr/local/ec2/ec2-api-tools export EC2_PRIVATE_KEY=/root/pk.pem export EC2_CERT=/root/cert.pem export PATH=/opt/bamboo-elastic-agent/bin:$EC2_HOME/bin:$JAVA_HOME/bin:$M2_HOME/bin:$MAVEN_HOME/bin:$ANT_HOME/bin:$PATH
/etc/profile.d
directory by running the following command on your instance in the /mnt
directory:
mv profile.sh /etc/profile.d/bamboo.sh
rc.local
file to the one that already exists on your instance, by running the following command on your instance in the mnt
directory:
cat /opt/bamboo-elastic-agent/rc.local >> /etc/rc.d/rc.local
echo bamboo-<x.x.x> >> /opt/bamboo-elastic-agent/motd mv /opt/bamboo-elastic-agent/motd /etc/motd rm -f /root/firstlogin /etc/ssh/ssh_host_da_key /etc/ssh/ssh_host_dsa_key.pub /etc/ssh/ssh_host_key /etc/ssh/ssh_host_key.pub /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub /root/.ssh/authorized_keys touch /root/firstrun
The final step is to create an image from your customised instance. To do this, you will require the following information:
You can create an image of your customised instance by using the ec2-bundle-vol
command, as follows:
/usr/local/bin/ec2-bundle-vol -c $EC2_CERT -k $EC2_PRIVATE_KEY -u <amazon_account_number> -p <elastic_image_name> --batch --debug
where <elastic_image_name> is the name that you want to assign to your custom image (e.g. 'CustomImage1')
Once the image is created, you need to upload it to Amazon S3 by running the command below:
/usr/local/bin/ec2-upload-bundle -b <s3_bucket_name> -m /tmp/<elastic_image_name>.manifest.xml -a <access_key_id> -s <secret_access_key> --retry --debug
where <s3_bucket_name>, <access_key_id> and <secret_access_key> are the Amazon S3 bucket name, Access Key ID and Secret Access Key described previously, and <elastic_image_name> is the name that you want to assign to your custom image (e.g. 'CustomImage1')
You will then need to register your image with Amazon EC2 by using the ec2-register
command:
$EC2_HOME/bin/ec2-register <s3_bucket_name>/<elastic_image_name>.manifest.xml
where <s3_bucket_name> is the Amazon S3 bucket name described previously and <elastic_image_name> is the name that you want to assign to your custom image (e.g. 'CustomImage1')
The output of this command will show the AMI ID of your custom image.
Congratulations, you have successfully set up a custom elastic image!
Now that you have created a custom elastic image, there are two more steps that you will need to complete before you can use it.
First, you will need to associate your custom elastic image with your Bamboo installation by creating an Elastic Image Configuration. Please note the AMI ID of your new custom image and read Managing your Elastic Image Configurations for further instructions.
Secondly, you will need to configure the capabilities of the elastic agents that will run on instances started from your image. This is done by adding the appropriate builder, JDK, Perforce and custom capabilities to your elastic image configuration, so that it reflects what your custom elastic image actually can do. For example, if you have created a custom elastic image with JDK 1.6 and Maven 2 installed, you will need to add capabilities for JDK 1.6 and Maven 2 to the elastic image configuration. Read Configuring Elastic Agent Capabilities for further instructions.
If you need more help, there are a number of resources that you can take advantage of: