Apply tags to registered AMI

Adding the tag called `Name` to the AMI ensures that the name appears in
the *Name* column inside AWS' web console.

Fixes #1171.

Signed-off-by: Major Hayden <major@redhat.com>
This commit is contained in:
Major Hayden 2021-01-22 07:06:25 -06:00 committed by Ondřej Budai
parent 15969e0adc
commit 2618e11bfe
2 changed files with 23 additions and 0 deletions

View file

@ -263,6 +263,12 @@ for LOOP_COUNTER in {0..10}; do
sleep 5
done
# Ensure the image was properly tagged.
IMAGE_TAG=$($AWS_CMD ec2 describe-images --image-ids "${AMI_IMAGE_ID}" | jq -r '.Images[0].Tags[] | select(.Key=="Name") | .Value')
if [[ ! $IMAGE_TAG == "${IMAGE_KEY}" ]]; then
RESULTS=0
fi
# Clean up our mess.
greenprint "🧼 Cleaning up"
SNAPSHOT_ID=$(jq -r '.Images[].BlockDeviceMappings[].Ebs.SnapshotId' "$AMI_DATA")