Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

can i create an elastic agent via an api call

William Flow March 28, 2023

so i have a script that 

creates and ec2 instance

configures it as an elastic agent

creates the AMI

 

now i want create an elastic agent via that AMI with a API call is this doable via API call? or is there another automated way

 

 

Thanks

 

Bill

1 answer

1 accepted

1 vote
Answer accepted
Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 28, 2023

Hello @William Flow

Bamboo relies on premade AMIs to launch its Elastic Agents. An EC2 instance that is supposed to be used as an Elastic Agent needs to be launched by Bamboo and cannot be running before that.

Considering your AMI contains all the required applications to launch an Elastic Agent, you just have to add your AMI as a Custom image in Bamboo and launch an Elastic Agent.

Here are some links for you:

Best regards,

Eduardo Alvarenga
Atlassian Support APAC

--please don't forget to Accept the answer if the reply is helpful-- 

William Flow March 28, 2023

Hi Eduardo

  Yes I understand that my question is can I fire up an elastic agent via an api call to bamboo? i will know the image id etc

 

Thanks

 

Bill

Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 28, 2023

Hey @William Flow

There is no REST API endpoint that would allow you to control Elastic Agents up/down specifically. Elastic Agents are expected to be started automatically by the Automatic Elastic Instance Management feature.

But you can always call the UI through curl, for example, below I'm starting one Elastic Agent from imageId=688129:

$ curl -u user:pass 'https://bamboo.mydomain.net/admin/elastic/createElasticInstances.action' -H 'content-type: application/x-www-form-urlencoded' -H 'x-atlassian-token: no-check' -X POST --data-raw 'numAgentsToCreate=1&elasticImageConfigurationId=688129&selectFields=elasticImageConfigurationId&save=Submit'

Cheers,

Eduardo Alvarenga
Atlassian Support APAC

--please don't forget to Accept the answer if the reply is helpful--  

Like Steffen Opel _Utoolity_ likes this
William Flow March 29, 2023

Hi Eduardo

   I do have one more question on this in your example you have 

elasticImageConfigurationId=688129&selectFields=elasticImageConfigurationId&save=Submit'

my question is in my instance of Bamboo i dont have the  elasticImageConfigurationId I only have elasticImageConfigurationId how do i get the elasticImageConfigurationId ? or do i just use the elasticImageConfigurationId

ed.png

Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 29, 2023

Hey @William Flow

You can find the list of elastigImageConfigurationId by going to the Bamboo UI:

  • Bamboo Administration >> Elastic Bambo (Image configuration) >> Hover the mouse over each instance and take notes of their configurationId

For that, you can use the REST API to get a list of the images:

For example, the curl below will return all Images Ids and their Names configured on my AWS "ap-se2" region:

$ curl -s -H "Accept: application/json" -uuser:pass -X GET 'https://bamboo.mydomain.net/rest/api/latest/elasticConfiguration' | jq -j '.[] | select(.region == "ap-se2") | .configurationId, " ", .configurationName, "\n"'
491526 Ubuntu stock image
491534 Windows stock image
688129 ealvarenga-bamboo-agent-linux
9633793 ealvarenga-bamboo-agent-windows
35192833 ealvarenga-bamboo-agent-linux-custom

Kind regards,

Eduardo Alvarenga
Atlassian Support APAC

--please don't forget to Accept the answer if the reply is helpful-- 

Like # people like this
William Flow March 29, 2023

Thank you so much! that worked!!~

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events