Use EC2 ephemeral storage as build directory even with an EBS volume attached


アトラシアン コミュニティをご利用ください。



When using Elastic Bamboo, an instance with an EBS volume attached will use /mnt/bamboo-ebs/bamboo-agent/build-dir/ as the place where it checks out code (instead of /home/bamboo/bamboohome/xml-data/build-dir/ when not using EBS). This is usually useful because future Elastic instances will avoid the need to do full checkouts from scratch (speeding up build time).

One downside with this approach is that EBS volumes are usually much smaller than the ephemeral storage supplied with most types of EC2 instances. If you have many plans, the checked-out code for each of them (sitting in the build directory, even after the build completes) could use up all the available space, eventually preventing builds from running until the build directory is manually cleaned out.


If it's important for you that the code checkouts occur on the EBS volume then you will need to simply use a larger EBS volume.

If you don't care about the ability to persist code checkouts between elastic instances (e.g. you only use the EBS volume to customise the EC2 instance), then you can change the location the code is checked-out to by editing /mnt/bamboo-ebs/bin/ and adding the following lines:

# Create an alternative build directory on EC2 ephemeral storage
echo "Creating ephemeral build-dir at: ${NEW_BUILD_DIR}"
mkdir -p "${NEW_BUILD_DIR}"
chown bamboo:ec2-user "${NEW_BUILD_DIR}"

# Change agent configuration to point to the alternative directory
sed -i /mnt/bamboo-ebs/bamboo-agent/bamboo-agent.cfg.xml -e "s#/mnt/bamboo-ebs/bamboo-agent/build-dir/#${NEW_BUILD_DIR}#"

You will then want to generate a new EBS snapshot and modify your image configuration to use this new snapshot (you can read details on how to do this at: Configuring elastic instances to use the EBS).

Source code checkouts will now go under /media/ephemeral0/build-dir/ instead of using up space on the EBS volume. Of course, the checkouts will be lost once the Elastic instance shuts down.


Manually modify /mnt/bamboo-ebs/bamboo-agent/bamboo-agent.cfg.xml to point to /home/bamboo/bamboohome/xml-data/build-dir/


最終更新日 2015 年 8 月 14 日


Powered by Confluence and Scroll Viewport.