You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Amazon Linux 2安装AWS CodeDeploy Agent失败求助

Fix: "./install: missing destination file operand after ‘auto’" When Installing AWS CodeDeploy Agent on Amazon Linux 2

Looks like you ran into a classic "wrong executable" issue here—your ./install command is calling the system's GNU coreutils install tool instead of the actual AWS CodeDeploy installation script. That's why you're getting that "missing destination file operand" error, since the system install expects completely different arguments.

Why this happens

Most likely, your initial wget command failed to download the correct CodeDeploy script. If you used ${AWS::Region} outside of a CloudFormation template (like directly in an EC2 shell), that variable won't resolve to your actual AWS region. This means wget probably created an empty or corrupted install file, and when you tried to run it, the shell fell back to the system's install command in your PATH.

Step-by-Step Fix

Let's fix this by re-downloading the correct script and ensuring we're running the right one:

  1. Clean up the broken/corrupted file first

    rm -f ./install
    
  2. Re-download the CodeDeploy installation script with your actual AWS region
    Replace <your-region> with your EC2 instance's region (e.g., us-east-1, ap-southeast-1, eu-west-1):

    wget https://aws-codedeploy-<your-region>.s3.<your-region>.amazonaws.com/latest/install
    

    Example for N. Virginia region:

    wget https://aws-codedeploy-us-east-1.s3.us-east-1.amazonaws.com/latest/install
    
  3. Make the script executable

    chmod +x ./install
    
  4. Verify you have the right script (optional but recommended)
    Check the first few lines of the file to confirm it's the CodeDeploy Ruby script:

    head ./install
    

    You should see something like #!/usr/bin/env ruby at the top—this confirms it's not the system install tool.

  5. Run the installation again

    sudo ./install auto
    
  6. Check if the agent is running

    sudo service codedeploy-agent status
    

Quick Automation Tip

If you're running these commands in a script or automation, you can fetch the region dynamically from the EC2 instance metadata to avoid hardcoding:

REGION=$(curl -s http://169.254.169.254/latest/dynamic/instance-identity/document | grep region | cut -d'"' -f4)
wget https://aws-codedeploy-${REGION}.s3.${REGION}.amazonaws.com/latest/install

This ensures you always download the correct script for your instance's region without manual input.

内容的提问来源于stack exchange,提问作者Christian Bongiorno

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.07 14:32:48