villasv
villasv

Reputation: 6861

How to enable the CodeDeploy Agent on Amazon Linux 2?

Amazon Linux 2 already comes with cfn-init and other AWS integrated tools, but the CodeDeploy docs doesn't mention Amazon Linux 2 and running any service commands respond something similar to:

Redirecting to /bin/systemctl start codedeploy-agent.service
Failed to start codedeploy-agent.service: Unit not found.

How can I enable the CodeDeploy agent, preferably using cfn-init?

Upvotes: 7

Views: 8907

Answers (1)

villasv
villasv

Reputation: 6861

sudo yum update
sudo yum install ruby
sudo yum install wget
wget https://aws-codedeploy-us-east-1.s3.amazonaws.com/latest/install
chmod +x ./install
sudo ./install auto

The above worked, though it's not integrated to cfn-init so I'm still looking for a better answer.

EDIT: Working configSet for cfn-init

    cdagent:
      packages:
        yum:
          ruby: []
          wget: []
      commands:
        install:
          command: !Sub |
            wget https://aws-codedeploy-${AWS::Region}.s3.amazonaws.com/latest/install
            chmod +x ./install
            ./install auto

Upvotes: 15

Related Questions