AWS CodeDeploy 无故失败
AWS CodeDeploy failed without a reason
我正在尝试使用 AWS CodeDeploy 将 Java war 文件部署到 EC2 实例。
我已经在这个 war 的根目录中添加了一个 appspec.yml,内容如下:
version: 0.0
os: linux
files:
- source: /
destination: /var/scwcd/scwcd
我还创建了一个 EC2 实例,codeDeploy 应用程序可以看到这个 Ec2 实例。
我手动将此 war 文件上传到我的 S3 存储桶并将 codeDeploy 源设置为 S3 文件。
我还为 CodeDeploy 添加了足够的权限来访问 S3 和 EC2 实例。
但部署总是失败并显示此消息:
The overall deployment failed because too many individual instances failed deployment,
too few healthy instances are available for deployment,
or some instances in your deployment group are experiencing problems
我检查了部署事件列表,发现每个操作都被跳过,没有错误代码:
我也检查了 EC2 实例,发现目标文件夹 /var/scwcd 不存在。
有人知道我错过了什么吗?
谢谢!
您是否在 EC2 实例上安装了 CodeDeploy 代理 [1]?跳过所有事件通常意味着代理未调用 CodeDeploy 服务端点 [2]。
实例首次启动时,您可以在 EC2 UserData 中使用以下内容安装代理:
亚马逊Linux/RHEL
#!/bin/bash
sudo yum update -y
sudo yum install -y ruby wget
cd /home/ec2-user
wget https://aws-codedeploy-us-east-1.s3.amazonaws.com/latest/install
chmod +x ./install
sudo ./install auto
sudo service codedeploy-agent start
Ubuntu
#!/bin/bash
apt-get -y update
apt-get -y install ruby
apt-get -y install wget
cd /home/ubuntu
wget https://aws-codedeploy-us-east-1.s3.amazonaws.com/latest/install
chmod +x ./install
./install auto
[1] https://docs.aws.amazon.com/codedeploy/latest/userguide/codedeploy-agent-operations-install.html
我正在尝试使用 AWS CodeDeploy 将 Java war 文件部署到 EC2 实例。
我已经在这个 war 的根目录中添加了一个 appspec.yml,内容如下:
version: 0.0
os: linux
files:
- source: /
destination: /var/scwcd/scwcd
我还创建了一个 EC2 实例,codeDeploy 应用程序可以看到这个 Ec2 实例。 我手动将此 war 文件上传到我的 S3 存储桶并将 codeDeploy 源设置为 S3 文件。 我还为 CodeDeploy 添加了足够的权限来访问 S3 和 EC2 实例。
但部署总是失败并显示此消息:
The overall deployment failed because too many individual instances failed deployment,
too few healthy instances are available for deployment,
or some instances in your deployment group are experiencing problems
我检查了部署事件列表,发现每个操作都被跳过,没有错误代码:
我也检查了 EC2 实例,发现目标文件夹 /var/scwcd 不存在。
有人知道我错过了什么吗?
谢谢!
您是否在 EC2 实例上安装了 CodeDeploy 代理 [1]?跳过所有事件通常意味着代理未调用 CodeDeploy 服务端点 [2]。
实例首次启动时,您可以在 EC2 UserData 中使用以下内容安装代理:
亚马逊Linux/RHEL
#!/bin/bash
sudo yum update -y
sudo yum install -y ruby wget
cd /home/ec2-user
wget https://aws-codedeploy-us-east-1.s3.amazonaws.com/latest/install
chmod +x ./install
sudo ./install auto
sudo service codedeploy-agent start
Ubuntu
#!/bin/bash
apt-get -y update
apt-get -y install ruby
apt-get -y install wget
cd /home/ubuntu
wget https://aws-codedeploy-us-east-1.s3.amazonaws.com/latest/install
chmod +x ./install
./install auto
[1] https://docs.aws.amazon.com/codedeploy/latest/userguide/codedeploy-agent-operations-install.html