Skip to content

Instantly share code, notes, and snippets.

@lifeeth
Last active January 20, 2022 01:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save lifeeth/557722cd62eb41010807ad1a2ce6ba41 to your computer and use it in GitHub Desktop.
Save lifeeth/557722cd62eb41010807ad1a2ce6ba41 to your computer and use it in GitHub Desktop.
AWS Codedeploy Agent install on Ubuntu 20.04 - Until a package is released for Ubuntu 20.04
#!/usr/bin/env bash
sudo snap install ruby --channel=2.5/stable --classic
sudo gem install bundler
sudo git clone https://github.com/aws/aws-codedeploy-agent.git /opt/codedeploy-agent
sudo chown -R root.root /opt/codedeploy-agent
sudo chmod 644 /opt/codedeploy-agent/conf/codedeployagent.yml
sudo chmod 755 /opt/codedeploy-agent/init.d/codedeploy-agent
sudo chmod 644 /opt/codedeploy-agent/init.d/codedeploy-agent.service
pushd /opt/codedeploy-agent
sudo bundle install --system
sudo /snap/bin/rake clean && sudo /snap/bin/rake
sudo cp /opt/codedeploy-agent/init.d/codedeploy-agent.service /etc/systemd/system
# Run codedeploy as root - Be aware of the security implications
sudo sed -i 's/\(User=\)\(.*\)/\1root/' /etc/systemd/system/codedeploy-agent.service
sudo sed -i 's/#User/User/g' /etc/systemd/system/codedeploy-agent.service
sudo systemctl daemon-reload
sudo systemctl enable codedeploy-agent
popd
@cmllamosas
Copy link

Hello, after all steps, it seems like codedeploy-agent doesn´t work

With

sudo systemctl status codedeploy-agent

Returns

● codedeploy-agent.service - AWS CodeDeploy Host Agent
     Loaded: loaded (/etc/systemd/system/codedeploy-agent.service; enabled; vendor preset: enabled)
     Active: inactive (dead)

May 01 12:44:33 ip-172-31-4-202 systemd[1]: /etc/systemd/system/codedeploy-agent.service:6: Unknown key name 'After' in section 'Service', ignoring.

Is there another step is missing?

Screen Shot 2020-05-01 at 12 48 43

I can help you to try any updates u post, with ubuntu ami id: ami-068663a3c619dd892 (public ami)

@lifeeth
Copy link
Author

lifeeth commented May 2, 2020

@cmllamosas That seems odd. These are the exact steps that worked for me on ubuntu/images/*ubuntu-focal-20.04-amd64-server-* ami.

@cmllamosas
Copy link

@lifeeth That is weird i try many times with your snippet, can you share ur public ami-id, to try with that again.

@lifeeth
Copy link
Author

lifeeth commented May 4, 2020

@cmllamosas - I have been using the same AMI. Could you share your codedeploy-agent.service? I do run an apt-get upgrade before installing though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment