Skip to content

Instantly share code, notes, and snippets.

@angrychimp angrychimp/parse-images.sh
Last active Mar 21, 2018

Embed
What would you like to do?
An example of how to use a `bash` script to perform actions on AMI records
#!/bin/bash
IFS=$'\n'
for image in $(aws ec2 describe-images --filter "Name=description,Values=Auto backed up on *" --query 'Images[].{Description:Description,Image_ID:ImageId,DateCreated:CreationDate}')
creationDate=$(echo $image | awk -F'\t' '{print $1}')
description=$(echo $image | awk -F'\t' '{print $2}')
imageId=$(echo $image | awk -F'\t' '{print $3}')
echo "$imageId | $creationDate | $description"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.