From 876fe3023056101e61eab4ae3c702dc81a1775df Mon Sep 17 00:00:00 2001 From: cruizba Date: Mon, 11 Jan 2021 16:04:25 +0100 Subject: [PATCH] openvidu-deployment: getUbuntuAmiId updated to get non aws-marketplace images --- openvidu-server/deployments/ce/aws/createAMI.sh | 8 ++++---- openvidu-server/deployments/pro/aws/createAMIs.sh | 7 +++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/openvidu-server/deployments/ce/aws/createAMI.sh b/openvidu-server/deployments/ce/aws/createAMI.sh index 84d9d000..c65f4af8 100755 --- a/openvidu-server/deployments/ce/aws/createAMI.sh +++ b/openvidu-server/deployments/ce/aws/createAMI.sh @@ -17,13 +17,13 @@ TEMPJSON=$(mktemp -t cloudformation-XXX --suffix .json) # Get Latest Ubuntu AMI id from specified region # Parameters # $1 Aws region + getUbuntuAmiId() { local AMI_ID=$( aws --region ${1} ec2 describe-images \ - --filters Name=name,Values=ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64* \ - --query 'Images[*].[ImageId,CreationDate]' \ - --output text \ - | sort -k2 -r | head -n1 | cut -d$'\t' -f1 + --filters "Name=name,Values=*ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-*" \ + --query "sort_by(Images, &CreationDate)" \ + | jq -r 'del(.[] | select(.ImageOwnerAlias != null)) | .[-1].ImageId' ) echo $AMI_ID } diff --git a/openvidu-server/deployments/pro/aws/createAMIs.sh b/openvidu-server/deployments/pro/aws/createAMIs.sh index 0209601f..81e06087 100755 --- a/openvidu-server/deployments/pro/aws/createAMIs.sh +++ b/openvidu-server/deployments/pro/aws/createAMIs.sh @@ -19,10 +19,9 @@ TEMPJSON=$(mktemp -t cloudformation-XXX --suffix .json) getUbuntuAmiId() { local AMI_ID=$( aws --region ${1} ec2 describe-images \ - --filters Name=name,Values=ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64* \ - --query 'Images[*].[ImageId,CreationDate]' \ - --output text \ - | sort -k2 -r | head -n1 | cut -d$'\t' -f1 + --filters "Name=name,Values=*ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-*" \ + --query "sort_by(Images, &CreationDate)" \ + | jq -r 'del(.[] | select(.ImageOwnerAlias != null)) | .[-1].ImageId' ) echo $AMI_ID }