AWS CodeDeploy
User Guide (API Version 2014-10-06)
AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Install or Reinstall the AWS CodeDeploy Agent

If you suspect the AWS CodeDeploy agent is missing or not working, you can run commands on an instance to install or reinstall it.

Install or reinstall the AWS CodeDeploy agent for Amazon Linux or RHEL

Sign in to the instance, and run the following commands, one at a time.

Note

In the fourth command, /home/ec2-user represents the default user name for an Amazon Linux or RHEL Amazon EC2 instance. If your instance was created using a custom AMI, the AMI owner might have specified a different default user name.

Copy
sudo yum update

Copy
sudo yum install ruby

Copy
sudo yum install wget

Copy
cd /home/ec2-user

Copy
wget https://aws-codedeploy-cn-north-1.s3.cn-north-1.amazonaws.com.cn/latest/install

Copy
chmod +x ./install

Copy
sudo ./install auto

Copy
sudo service codedeploy-agent status

If the AWS CodeDeploy agent is installed and running, you should see a message like The AWS CodeDeploy agent is running.

If you see a message like error: No AWS CodeDeploy agent running, start the service and run the following two commands, one at a time:

Copy
sudo service codedeploy-agent start
Copy
sudo service codedeploy-agent status

Install or reinstall the AWS CodeDeploy agent for Ubuntu Server

Sign in to the instance, and run the following commands, one at a time.

Note

In the fifth command, /home/ubuntu represents the default user name for an Ubuntu Server instance. If your instance was created using a custom AMI, the AMI owner might have specified a different default user name.

Copy
sudo apt-get update

On Ubuntu Server 14.04:

  • Copy
    sudo apt-get install ruby2.0

On Ubuntu Server 16.04:

  • Copy
    sudo apt-get install ruby

Copy
sudo apt-get install wget

Copy
cd /home/ubuntu

Copy
wget https://aws-codedeploy-cn-north-1.s3.cn-north-1.amazonaws.com.cn/latest/install

Copy
chmod +x ./install

Copy
sudo ./install auto

Copy
sudo service codedeploy-agent status

If the AWS CodeDeploy agent is installed and running, you should see a message like The AWS CodeDeploy agent is running.

If you see a message like error: No AWS CodeDeploy agent running, start the service and run the following two commands, one at a time:

Copy
sudo service codedeploy-agent start
Copy
sudo service codedeploy-agent status

Install or reinstall the AWS CodeDeploy agent for Windows Server

Sign in to the instance, and run the following commands in Windows PowerShell, one at a time:

Note

On both new and existing instances, we recommend installing the AWS CodeDeploy agent updater for Windows Server. The updater checks periodically for new versions of the agent and installs it when a new version is available. On new instances, you can install the updater instead of the agent, and the current version of the agent will be installed immediately after the updater. For more information, see Update the AWS CodeDeploy Agent on Windows Server.

Copy
Set-ExecutionPolicy RemoteSigned

Copy
Import-Module AWSPowerShell

Copy
New-Item –Path "c:\temp" –ItemType "directory" -Force

Copy
powershell.exe -Command Read-S3Object -BucketName bucket-name -Key latest/codedeploy-agent.msi -File c:\temp\codedeploy-agent.msi

Copy
c:\temp\codedeploy-agent.msi /quiet /l c:\temp\host-agent-install-log.txt

Copy
powershell.exe -Command Get-Service -Name codedeployagent

bucket-name represents one of the following:

  • aws-codedeploy-us-east-2 for instances in the US East (Ohio) region

  • aws-codedeploy-us-east-1 for instances in the US East (N. Virginia) region

  • aws-codedeploy-us-west-1 for instances in the US West (N. California) region

  • aws-codedeploy-us-west-2 for instances in the US West (Oregon) region

  • aws-codedeploy-ca-central-1 for instances in the Canada (Central) region

  • aws-codedeploy-eu-west-1 for instances in the EU (Ireland) region

  • aws-codedeploy-eu-west-2 for instances in the EU (London) region

  • aws-codedeploy-eu-central-1 for instances in the EU (Frankfurt) region

  • aws-codedeploy-ap-northeast-1 for instances in the Asia Pacific (Tokyo) region

  • aws-codedeploy-ap-northeast-2 for instances in the Asia Pacific (Seoul) region

  • aws-codedeploy-ap-southeast-1 for instances in the Asia Pacific (Singapore) region

  • aws-codedeploy-ap-southeast-2 for instances in the Asia Pacific (Sydney) region

  • aws-codedeploy-ap-south-1 for instances in the Asia Pacific (Mumbai) region

  • aws-codedeploy-sa-east-1 for instances in the South America (São Paulo) region

If the AWS CodeDeploy agent is installed and running, after the Get-Service command call, you should see output similar to the following:

Copy
Status Name DisplayName ------ ---- ----------- Running codedeployagent CodeDeploy Host Agent Service