While setting up EC2 Instance for Elastic agent does not start
Asked by William Flow:

Ok so I am setting up an EC2 instance to be a Elastic agent I setup everything as per instructions then reboot the box and the it does not start, I am under the impression that the first time it runs it downloads file etc then you run a prep script and create your AMI

I get this error:

\[root@ip-10-245-163-211 bamboo\]# sudo systemctl status rc.local.service  
? rc.local.service - /etc/systemd/system/rc.local Compatablity  
Loaded: loaded (/etc/systemd/system/rc.local.service; enabled; vendor preset: disabled)  
Active: active (exited) since Fri 2023-03-17 19:15:03 UTC; 7min ago  
Tasks: 0 (limit: 99637)  
Memory: 0B  
CGroup: /system.slice/rc.local.service

Mar 17 19:15:02 ip-10-245-163-211.us-west-2.compute.internal systemd\[1\]: Starting /etc/systemd/system/rc.local Compatablity...  
Mar 17 19:15:02 ip-10-245-163-211.us-west-2.compute.internal rc.local\[792\]: Fri Mar 17 19:15:02 UTC 2023 - Started execution of Bamboo instance startup scripts, uptime: up 0 minutes  
Mar 17 19:15:02 ip-10-245-163-211.us-west-2.compute.internal rc.local\[799\]: Fri Mar 17 19:15:02 UTC 2023 - Testing if instance has been started from Bamboo...  
Mar 17 19:15:03 ip-10-245-163-211.us-west-2.compute.internal rc.local\[853\]: Fri Mar 17 19:15:03 UTC 2023 - This instance has not been started by Bamboo. The agent will not be started.  
Mar 17 19:15:03 ip-10-245-163-211.us-west-2.compute.internal systemd\[1\]: Started /etc/systemd/system/rc.local Compatablity.  
Mar 17 19:21:47 ip-10-245-163-211.us-west-2.compute.internal systemd\[1\]: /etc/systemd/system/rc.local.service:9: Unknown lvalue 'StanardOutput' in section 'Service'  
Mar 17 19:21:47 ip-10-245-163-211.us-west-2.compute.internal systemd\[1\]: /etc/systemd/system/rc.local.service:11: Support for option SysVStartPriority= has been removed and it is ignored  
Mar 17 19:22:44 ip-10-245-163-211.us-west-2.compute.internal systemd\[1\]: /etc/systemd/system/rc.local.service:9: Unknown lvalue 'StanardOutput' in section 'Service'  
Mar 17 19:22:44 ip-10-245-163-211.us-west-2.compute.internal systemd\[1\]: /etc/systemd/system/rc.local.service:11: Support for option SysVStartPriority= has been removed and it is ignored  


Answers:
author: Eduardo Alvarenga
body: Hello [@William Flow](/t5/user/viewprofilepage/user-id/4551025)

Once your Elastic Instance is started, the Agent will validate the EC2 instance's metadata looking for indicators that it's been initialised by Bamboo. As you are starting the instance outside of that scope, the Agent refuses to start.

```
Mar 17 19:15:02 ip-10-245-163-211.us-west-2.compute.internal rc.local[799]: Fri Mar 17 19:15:02 UTC 2023 - Testing if instance has been started from Bamboo...
Mar 17 19:15:03 ip-10-245-163-211.us-west-2.compute.internal rc.local[853]: Fri Mar 17 19:15:03 UTC 2023 - This instance has not been started by Bamboo. The agent will not be started.
```

If it passes, it will then start the Tunnel listener, which will wait for a connection from the Server. Then the server will connect to the Agent and call the bootstrap process by downloading extra files from the Atlassian S3 buckets and the Bamboo Server via the tunnel.

Kind regards,

Eduardo Alvarenga  
Atlassian Support APAC

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

comments: author: William Flow
body: I understand that I am not sure why it did not start it does a reboot and and I setup systemd so it should just start


author: Eduardo Alvarenga
body: Hello [@William Flow](/t5/user/viewprofilepage/user-id/4551025)

The Bamboo Elastic Agent will refuse to start if its EC2 instance wasn't started by the Bamboo application. Are you starting the instance through the Bamboo interface by following **Administration \>\> Elastic Bamboo (Instances) \>\> Start New Elastic Instances** ?

Thanks,

Eduardo Alvarenga  
Atlassian Support APAC

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


Tags: cloud

elastic-agent