有没有办法自动创建下一个asgard自动缩放组?我有我要部署的AMI映像ID。我探讨了他们的API,我觉得这怎么可能不行。有没有人有任何建议?
答案 0 :(得分:0)
对于任何来到这里的人,我已经使用一些简单的shell脚本解决了这个问题。你可以用你想要的任何REST api或语言包装它,但要点是
function asgard(){
verb=$1
url="https://my.asgard.com/us-east-1/$2"
shift
http ${VERB} --verify=no "$url" -b
}
function next-ami(){
cluster=$1
prepare-ami $cluster true | \
jq ".environment.images | reverse | .[0]"
}
function prepare-ami(){
cluster=$1
includeEnv=$2
asgard GET "deployment/prepare/${cluster}?deploymentTemplateName=CreateAndCleanUpPreviousAsg&includeEnvironment=${includeEnv}"
}
function get-next-ami(){
cluster=$1
next=`next-ami ${cluster} | jq ".id"`
prepare-ami ${cluster} "false" | jq ".lcOptions.imageId |= ${next}"
}
function start-deployment(){
cluster=$1
payload=$2
echo $payload | asgard POST "deployment/start/${cluster}"
}
来源帖子:http://onoffswitch.net/scripting-deployment-clusters-asgard/