Last active
March 21, 2018 18:15
-
-
Save angrychimp/1b1a33bb13bf4943a178b045870cd003 to your computer and use it in GitHub Desktop.
An example of how to use a `bash` script to perform actions on AMI records
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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