Initialize AWS CLI for Elastic Bamboo Agents in Bamboo Data Center

Platform Notice: Data Center Only - This article only applies to Atlassian apps on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Learn how to use an Elastic Bamboo agent's startup script to initialize the AWS CLI on Elastic Bamboo agents using existing AWS keys.

Solution

This script initially configures the AWS credentials for the root user and then copies those credentials into the bamboo user's home directory on the EC2 instance. We confirmed the setup by running a build plan with the AWS CLI and got the expected results.

Security Advisory: When the AWS CLI is initialized in this manner, it grants build plans running on that instance the privilege to execute commands against your AWS infrastructure. This could potentially expose your AWS environment to unauthorized access if not managed carefully.

  1. Access Elastic Image Configuration

    • Navigate to the Bamboo Administration page.

    • Go to Elastic Bamboo > Image Configurations.

  2. Edit Image Configurations

    • Select the image configuration you want to modify and click Edit.

  3. Add Instance Start-up Script

    • In the Instance Startup Script section, add the custom script below. This script runs when the instance starts to customize the environment.

  4. Save the Changes

#!/bin/bash export AWS_ACCESS_KEY=$(cat /root/awsAccessKey) export AWS_SECRET_KEY=$(cat /root/awsSecretKey) aws configure set aws_access_key_id "$AWS_ACCESS_KEY" aws configure set aws_secret_access_key "$AWS_SECRET_KEY" aws configure set default.region us-east-1 aws configure set default.output json cp -R /root/.aws /home/bamboo/ chown -R bamboo:bamboo /home/bamboo/.aws

Updated on March 2, 2026

Still need help?

The Atlassian Community is here for you.