AWS CodeDeploy 在 Auto Scaling 用户数据脚本完成之前执行 [英] AWS CodeDeploy executes before Auto Scaling userdata scripts finishes

查看:50
本文介绍了AWS CodeDeploy 在 Auto Scaling 用户数据脚本完成之前执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试结合 CodeDeploy 设置 Auto Scaling 组.一切正常,除了在创建新实例时 CodeDeploy 在用户数据脚本(在启动配置中定义)完成之前启动.

I'm trying to setup an Auto Scaling Group in combination with CodeDeploy. Everything works fine except for the fact that when a new instance is created CodeDeploy starts before the user data script (defined in the Launch Configuration) finishes.

此用户数据脚本的默认值下载并安装代码部署代理,我通过安装几个 Windows 功能、IIS 重写模块和 msdeploy 对其进行了扩展.

The default value of this user data script downloads and install the code deploy agent and i've extended it with installation of a couple of windows features, IIS rewrite module and msdeploy.

在我的 appspec.yml 中,我使用钩子 AfterInstall 来部署我的 IIS 网站,当 msdeploy 尚未安装时,这显然会失败.

In my appspec.yml i'm using the hook AfterInstall to deploy my IIS website and this obviously fails when msdeploy is not installed (yet).

我是否以错误的方式处理这个问题,还是有办法让 CodeDeploy 等待用户数据脚本完成?

Am i going about this the wrong way or is there a way to make CodeDeploy wait for the user data script to finish?

推荐答案

不幸的是,除了实例加载了它的操作系统之外,CodeDeploy 无法了解更多信息.好消息是 CodeDeploy 给了主机代理 1 小时的时间来开始轮询自动部署的命令.最简单的方法是在安装所有必需的依赖项后安装主机代理.将创建自动部署,但必须在主机代理启动后才能继续.

Unfortunately, there's no was for CodeDeploy to know anything more than the instance has loaded it's OS. The good thing is that CodeDeploy give the host agent 1 hour to start polling for commands with automatic deployments. The easiest thing to do is install the host agent after all the required dependencies are installed. The automatic deployment will be created, but can't proceed until after the host agent is started.

这篇关于AWS CodeDeploy 在 Auto Scaling 用户数据脚本完成之前执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆