Search code examples
linuxamazon-web-servicessshaws-code-deployamazon-lightsail

Create a Lightsail instance and install the CodeDeploy agent


While following this tutorial, I created the instance with the desired script. Yet, when I ssh in and run

sudo service codedeploy-agent status

I'm getting the error

Redirecting to /bin/systemctl status codedeploy-agent.service

Unit codedeploy-agent.service could not be found.

What can be done to fix it?


Solution

  • If I created the instance using Amazon Linux 2, ssh in and run

    sudo service codedeploy-agent status
    

    then would get the error

    Redirecting to /bin/systemctl status codedeploy-agent.service

    Unit codedeploy-agent.service could not be found.

    In order to fix it, created a new instance but this time made sure to be using Amazon Linux (as opposed to Amazon Linux 2).

    Amazon Lightsail Linux instance with codedeploy script

    Now, when running

    sudo service codedeploy-agent status
    

    I get the following result

    The AWS CodeDeploy agent is running as PID 2780

    The AWS CodeDeploy agent is running as PID 2780

    P.S. - if you still want to use Amazon Linux 2 instead, consider reading this question and it's answer.