openvidu-deployment: getUbuntuAmiId updated to get non aws-marketplace images

pull/577/head
cruizba 2021-01-11 16:04:25 +01:00
parent dd8dc43653
commit 876fe30230
2 changed files with 7 additions and 8 deletions

View File

@ -17,13 +17,13 @@ TEMPJSON=$(mktemp -t cloudformation-XXX --suffix .json)
# Get Latest Ubuntu AMI id from specified region # Get Latest Ubuntu AMI id from specified region
# Parameters # Parameters
# $1 Aws region # $1 Aws region
getUbuntuAmiId() { getUbuntuAmiId() {
local AMI_ID=$( local AMI_ID=$(
aws --region ${1} ec2 describe-images \ aws --region ${1} ec2 describe-images \
--filters Name=name,Values=ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64* \ --filters "Name=name,Values=*ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-*" \
--query 'Images[*].[ImageId,CreationDate]' \ --query "sort_by(Images, &CreationDate)" \
--output text \ | jq -r 'del(.[] | select(.ImageOwnerAlias != null)) | .[-1].ImageId'
| sort -k2 -r | head -n1 | cut -d$'\t' -f1
) )
echo $AMI_ID echo $AMI_ID
} }

View File

@ -19,10 +19,9 @@ TEMPJSON=$(mktemp -t cloudformation-XXX --suffix .json)
getUbuntuAmiId() { getUbuntuAmiId() {
local AMI_ID=$( local AMI_ID=$(
aws --region ${1} ec2 describe-images \ aws --region ${1} ec2 describe-images \
--filters Name=name,Values=ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64* \ --filters "Name=name,Values=*ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-*" \
--query 'Images[*].[ImageId,CreationDate]' \ --query "sort_by(Images, &CreationDate)" \
--output text \ | jq -r 'del(.[] | select(.ImageOwnerAlias != null)) | .[-1].ImageId'
| sort -k2 -r | head -n1 | cut -d$'\t' -f1
) )
echo $AMI_ID echo $AMI_ID
} }