Skip to content

Commit daa8c21

Browse files
committed
create-ami remove previous image after 300s
1 parent 1e1982a commit daa8c21

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

script/create-ami.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ aws ec2 create-image --region $REGION --instance-id $instanceId --no-reboot --na
122122

123123
sleep 120
124124

125-
#기존의 ami 삭제
126-
aws ec2 deregister-image --region $REGION --image-id $latestAMI
125+
127126

128127
#Terminate the EC2 Instance
129128
#Finally we can terminate the EC2 instance weused to build the AMI.
@@ -155,3 +154,7 @@ echo $AMI_NAME_TARGET
155154
#https://datawookie.dev/blog/2021/07/creating-an-ami-using-the-aws-cli/
156155

157156
python3 ./script/update-ami.py "${instanceId}" "${AMI_ID_TARGET}" "${updateKey}"
157+
158+
#기존의 ami 삭제
159+
sleep 300
160+
aws ec2 deregister-image --region $REGION --image-id $latestAMI

0 commit comments

Comments
 (0)