mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-26 16:11:56 +02:00
ami: wait for new volume to become available before attaching
Today EC2's volume creation is a bit less instant than usual.
This commit is contained in:
parent
c4fb64a948
commit
51df57bb0b
@ -122,6 +122,8 @@ echo "Building AMI in zone $zone, region id $akiid"
|
||||
# Create and mount temporary EBS volume with file system to hold new AMI image
|
||||
volumeid=$(ec2-create-volume --size $size --availability-zone $zone |
|
||||
cut -f2)
|
||||
while ! ec2-describe-volumes "$volumeid" | grep -q available
|
||||
do sleep 1; done
|
||||
instanceid=$(curl --fail -s http://instance-data/latest/meta-data/instance-id)
|
||||
echo "Attaching new volume $volumeid locally (instance $instanceid)"
|
||||
ec2-attach-volume --device /dev/sdi --instance "$instanceid" "$volumeid"
|
||||
|
Loading…
x
Reference in New Issue
Block a user