Failed to Install the CodeDeploy Agent Using AWS Systems Manager

0

I set up my Application and Development Group on CodeDeploy EC2 platform where the setup procedure helped me create a State Manager to install the CodeDeploy agent on my EC2 instance for the upcoming developments, but the Run Command history showed a failure of the installation and the CodeDeploy agent is NOT installed and running on my instance.

The instance is assumed right role (incluing AmazonEC2RoleforAWSCodeDeploy, AmazonS3ReadOnlyAccess, and AmazonSSMManagedInstanceCore) for SSM, CodeDeploy and S3 bucket, and CodeDeploy has the sufficent permissions from the role (including AWSCodeDeployRole) to work on EC2 platform. No any issues for SSM and EC2, verified the SSM agent is running on my EC2 instance. However, got error output from Run Command at step 2 - "configurePackage":

failed to download manifest - failed to retrieve package document description: InvalidDocument: Document with name AWSCodeDeployAgent does not exist.

And here's some metadata of the command:

"Command document": "AWS-ConfigureAWSPackage",
"Command parameters": {
    "action": "Install",
    "additionalArguments": "{}",
    "installationType": "Uninstall and reinstall",
    "name": "AWSCodeDeployAgent",
    "version": ""
}

I can install CodeDeploy agent using the command line, but I want to figure out how it comes to this error, please help me if you have any ideas or encoutered the same situation before.

asked 2 months ago164 views
1 Answer
0

Not being able to see exactly how you might have tried to do this here is a solution below that should successfully install the CodeDeploy agent

{
  "schemaVersion": "2.2",
  "description": "Install CodeDeploy Agent",
  "parameters": {},
  "mainSteps": [
    {
      "action": "aws:runShellScript",
      "name": "installCodeDeployAgent",
      "inputs": {
        "runCommand": [
          "#!/bin/bash",
          "sudo yum update -y",
          "sudo yum install ruby -y",
          "sudo yum install wget -y",
          "cd /home/ec2-user",
          "wget https://aws-codedeploy-eu-west-2.s3.amazonaws.com/latest/install",
          "chmod +x ./install",
          "sudo ./install auto > /tmp/logfile",
          "sudo service codedeploy-agent start"
        ]
      }
    }
  ]
}

Save the document and use the AWS Console, CLI, or a SDK to execute this.

AWS
Barry M
answered 2 months ago
profile picture
EXPERT
reviewed 25 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions