Bamboo 3.4 : Upgrading the Agent for your Custom Elastic Image

If you are using a custom elastic image with your Bamboo installation, you need to ensure that the agent running on your custom elastic image is the same version as your Bamboo server (down to the point version).

For example, if you are running a Bamboo 2.6 server, the agents running on your custom elastic image also need to be version 2.6.

Download the Bamboo Agent

 

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 repository.

Start Up an Instance of your Custom Image

 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 previously (see '1. Requirements of 'Creating a Custom Elastic Image'). Please note, 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 (see 'Accessing your Instance' in 'Creating a Custom Elastic Image') 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.

Replace the Existing Agent with the New Agent

 

Once you have started an instance of your custom image, you can replace the existing agent with a new agent. To do this, copy the Bamboo agent elastic assembly that you previously downloaded onto your instance, by using the following commands:

cd <BAMBOO_AGENT_ELASTIC_ASSEMBLY_DOWNLOAD_DIRECTORY>
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 when you created your custom image, <instance_address> is the address of your instance (see 'Accessing your Instance' in 'Creating a Custom Elastic Image') and <BAMBOO_DIRECTORY> is your Bamboo Installation directory.

You then need to unzip the agent tarball by using ssh to access your instance and then running the following command:

tar -zxvf file.tar.gz

Create an Image of your Customised Instance

 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.

Associate the new Custom Image with Bamboo

 

Finally, 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.

Notes

Related topics

Managing your Elastic Image Configurations