Menu
AWS CodeDeploy
User Guide (API Version 2014-10-06)

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.

  1. Copy to clipboard
    sudo yum update
    Copy to clipboard
    sudo yum install ruby
    Copy to clipboard
    sudo yum install wget
    Copy to clipboard
    cd /home/ec2-user
    Copy to clipboard
    wget https://bucket-name.s3.amazonaws.com/latest/install
    Copy to clipboard
    chmod +x ./install
    Copy to clipboard
    sudo ./install auto

    Type y if prompted.

    bucket-name represents one of the following:

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

    • aws-codedeploy-us-east-2 for instances in the US East (Ohio) 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

  2. Copy to clipboard
    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 to clipboard
    sudo service codedeploy-agent start
    Copy to clipboard
    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.

  1. Copy to clipboard
    sudo apt-get update
    Copy to clipboard
    sudo apt-get install python-pip
    Copy to clipboard
    sudo apt-get install ruby
    Copy to clipboard
    sudo apt-get install wget
    Copy to clipboard
    cd /home/ubuntu
    Copy to clipboard
    wget https://bucket-name.s3.amazonaws.com/latest/install
    Copy to clipboard
    chmod +x ./install
    Copy to clipboard
    sudo ./install auto

    Type y if prompted.

    bucket-name represents one of the following:

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

    • aws-codedeploy-us-east-2 for instances in the US East (Ohio) 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

    region-name represents one of the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  2. Copy to clipboard
    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 to clipboard
    sudo service codedeploy-agent start
    Copy to clipboard
    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 to clipboard
Set-ExecutionPolicy RemoteSigned
Copy to clipboard
Import-Module AWSPowerShell
Copy to clipboard
New-Item –Path "c:\temp" –ItemType "directory" -Force
Copy to clipboard
powershell.exe -Command Read-S3Object -BucketName bucket-name -Key latest/codedeploy-agent.msi -File c:\temp\codedeploy-agent.msi
Copy to clipboard
c:\temp\codedeploy-agent.msi /quiet /l c:\temp\host-agent-install-log.txt
Copy to clipboard
powershell.exe -Command Get-Service -Name codedeployagent

bucket-name represents one of the following:

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

  • aws-codedeploy-us-east-2 for instances in the US East (Ohio) 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 to clipboard
Status Name DisplayName ------ ---- ----------- Running codedeployagent CodeDeploy Host Agent Service