mirror of https://github.com/OpenVidu/openvidu.git
openvidu-deployment: delete_amis.sh: Process AMI_LIST
parent
5e652c19a4
commit
2e0332f405
|
@ -1,13 +1,16 @@
|
||||||
#!/bin/bash -x
|
#!/bin/bash -x
|
||||||
set -eu -o pipefail
|
set -eu -o pipefail
|
||||||
|
|
||||||
|
# Process AMI_LIST
|
||||||
|
AMI_LIST=($(echo "$AMI_LIST" | tr ',' '\n'))
|
||||||
|
|
||||||
# Remove the list of AMIs in each region
|
# Remove the list of AMIs in each region
|
||||||
for line in ${AMI_LIST}
|
for line in "${AMI_LIST[@]}"
|
||||||
do
|
do
|
||||||
REGION=$(echo "${line}" | cut -d":" -f1)
|
REGION=$(echo "${line}" | cut -d":" -f1)
|
||||||
AMI_ID=$(echo "${line}" | cut -d":" -f2)
|
AMI_ID=$(echo "${line}" | cut -d":" -f2)
|
||||||
export AWS_DEFAULT_REGION=${REGION}
|
export AWS_DEFAULT_REGION=${REGION}
|
||||||
|
|
||||||
mapfile -t SNAPSHOTS < <(aws ec2 describe-images --image-ids "$AMI_ID" --output text --query 'Images[*].BlockDeviceMappings[*].Ebs.SnapshotId')
|
mapfile -t SNAPSHOTS < <(aws ec2 describe-images --image-ids "$AMI_ID" --output text --query 'Images[*].BlockDeviceMappings[*].Ebs.SnapshotId')
|
||||||
echo "Deregistering $AMI_ID"
|
echo "Deregistering $AMI_ID"
|
||||||
aws ec2 deregister-image --image-id "${AMI_ID}"
|
aws ec2 deregister-image --image-id "${AMI_ID}"
|
||||||
|
|
Loading…
Reference in New Issue