小编use*_*371的帖子

Bash 脚本中的 AWS 问题

考虑脚本文件中的 AWS CLI 命令

#!/bin/bash
msgClr='\033[1;35m'
errClr='\033[1;31m'
cynClr='\033[1;36m'
NC='\033[0m'
#Read CLuster from command Args
cluster="MyCluster"

#Update Service
echo -e "${msgClr}Initiate: ${NC}Updating Service..."
serviceName=$(aws ecs list-services --cluster $cluster | jq '.serviceArns[0]')
allTaskDefs=$(aws ecs list-task-definitions | jq '.taskDefinitionArns')
taskDefLength=$(echo $allTaskDefs | jq '. | length')
latestTaskDefArn=$(echo $allTaskDefs | jq '.['`expr $taskDefLength - 1`']')
#latestTaskDef=$(echo $latestTaskDefArn | awk 'BEGIN{FS="/"}{print substr($2, 1, length($2)-1)}')
#echo -e "${msgClr}Using Task Definition: ${cynClr}"$latestTaskDef"${NC}"
echo "aws ecs update-service --cluster $cluster --task-definition $latestTaskDefArn --service $serviceName" 
$(aws ecs update-service --cluster $cluster …
Run Code Online (Sandbox Code Playgroud)

bash shell amazon-web-services aws-cli

6
推荐指数
2
解决办法
3053
查看次数

标签 统计

amazon-web-services ×1

aws-cli ×1

bash ×1

shell ×1