Browse Source

Filter commas from AMI names

makes copypasta from AWS console a little easier
Duane Waddle 4 năm trước cách đây
mục cha
commit
ebd792af8d
1 tập tin đã thay đổi với 3 bổ sung2 xóa
  1. 3 2
      bin/delete-ami.sh

+ 3 - 2
bin/delete-ami.sh

@@ -1,9 +1,10 @@
 #!/bin/sh
 
 while [[ "$1" != "" ]]; do
-	SNAPS=$( aws ec2 describe-images --image-ids $1 | jq -r '.Images[].BlockDeviceMappings[].Ebs.SnapshotId' )
+	AMI=$( echo $1 | tr -d ',' )
+	SNAPS=$( aws ec2 describe-images --image-ids $AMI | jq -r '.Images[].BlockDeviceMappings[].Ebs.SnapshotId' )
 
-	aws ec2 deregister-image --image-id $1
+	aws ec2 deregister-image --image-id $AMI
 
 	for SNAP in $SNAPS; do
 		aws ec2 delete-snapshot --snapshot-id $SNAP