Skip to content

Commit b4de7d1

Browse files
committed
update asg tag
1 parent 890bebb commit b4de7d1

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

buildspec.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ phases:
99
commands:
1010
# 환경 변수 설정
1111
- export SERVICE_NAME=my-service
12-
- export BLUE_ASG_NAME_BASE=blue-asg
13-
- export GREEN_ASG_NAME_BASE=green-asg
1412
- export NEW_LAUNCH_CONFIG_NAME=new-launch-config-$(date +%s)
1513
- export SECURITY_GROUP_ID=sg-09ccb1d3815b1e817 # 미리 생성된 Security Group ID
1614
- export VPC_ID=vpc-08519e90b0081bea2 # VPC ID를 환경 변수로 설정
@@ -20,7 +18,7 @@ phases:
2018
- export SUBNETS=$(aws ec2 describe-subnets --filters "Name=vpc-id,Values=$VPC_ID" "Name=tag:Name,Values=private*" --query "Subnets[*].SubnetId" --output text | tr '\t' ',' | sed 's/,$//')
2119
# 버전 정보 설정
2220
- echo "Determining current ASG version..."
23-
- export VERSION=$(aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names $(aws autoscaling describe-auto-scaling-groups --query "AutoScalingGroups[?AutoScalingGroupName.starts_with(@, '$BLUE_ASG_NAME_BASE') || AutoScalingGroupName.starts_with(@, '$GREEN_ASG_NAME_BASE')].AutoScalingGroupName" --output text) --query "AutoScalingGroups[*].AutoScalingGroupName" --output text | awk -F'-' '{print $NF}' | sort -n | tail -n 1)
21+
- export VERSION=$(aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names $(aws autoscaling describe-auto-scaling-groups --query "AutoScalingGroups[?AutoScalingGroupName.starts_with(@, '$SERVICE_NAME')].AutoScalingGroupName" --output text) --query "AutoScalingGroups[*].AutoScalingGroupName" --output text | awk -F'-' '{print $NF}' | sort -n | tail -n 1)
2422
- |
2523
if [ -z "$VERSION" ]; then
2624
export VERSION=0000;
@@ -97,7 +95,7 @@ phases:
9795
# 최초 배포인 경우 ASG 생성, 그렇지 않으면 기존 ASG 업데이트
9896
- |
9997
echo "Creating Auto Scaling Group: $TARGET_ASG_NAME";
100-
aws autoscaling create-auto-scaling-group --auto-scaling-group-name $TARGET_ASG_NAME --launch-configuration-name $NEW_LAUNCH_CONFIG_NAME --min-size 1 --max-size 3 --desired-capacity 1 --target-group-arns $TARGET_GROUP_ARN --vpc-zone-identifier $SUBNETS --tags Key=Name,Value=$SERVICE_NAME;
98+
aws autoscaling create-auto-scaling-group --auto-scaling-group-name $TARGET_ASG_NAME --launch-configuration-name $NEW_LAUNCH_CONFIG_NAME --min-size 1 --max-size 3 --desired-capacity 1 --target-group-arns $TARGET_GROUP_ARN --vpc-zone-identifier $SUBNETS --tags Key=Name,Value=$TARGET_ASG_NAME;
10199
sleep 30;
102100
103101
echo "Getting instance IDs for ASG: $TARGET_ASG_NAME";

0 commit comments

Comments
 (0)