Report the details about an Amazon EC2 AMI.
Syntax: aws-image AMI
I found the AMI of an Ubuntu image I was interested in by:
- Going to Amazon EC2 AMI Locator
- Sorting the table by Version, most recent first
- Copying the AMI for version 21.1 for region us-east1
$ aws-image ami-0a4b1fdc2301bf1f1
{
"Architecture": "arm64",
"BlockDeviceMappings": [
{
"DeviceName": "/dev/sda1",
"Ebs": {
"DeleteOnTermination": true,
"Encrypted": false,
"SnapshotId": "snap-03487b50d3f5a0b68",
"VolumeSize": 8,
"VolumeType": "gp2"
}
},
{
"DeviceName": "/dev/sdb",
"VirtualName": "ephemeral0"
},
{
"DeviceName": "/dev/sdc",
"VirtualName": "ephemeral1"
}
],
"CreationDate": "2022-03-09T18:35:39.000Z",
"Description": "Canonical, Ubuntu, 21.10, arm64 impish image build on 2022-03-09",
"EnaSupport": true,
"Hypervisor": "xen",
"ImageId": "ami-0a4b1fdc2301bf1f1",
"ImageLocation": "099720109477/ubuntu/images/hvm-ssd/ubuntu-impish-21.10-arm64-server-20220309",
"ImageType": "machine",
"Name": "ubuntu/images/hvm-ssd/ubuntu-impish-21.10-arm64-server-20220309",
"OwnerId": "099720109477",
"PlatformDetails": "Linux/UNIX",
"Public": true,
"RootDeviceName": "/dev/sda1",
"RootDeviceType": "ebs",
"SriovNetSupport": "simple",
"State": "available",
"UsageOperation": "RunInstances",
"VirtualizationType": "hvm"
}
$
- This script uses the aws CLI and requires that you have installed it and set it up.
- Yes, you could use the
aws
CLI directly to do the same thing but I find it easier to use the script and not have to worry about the syntax of theaws
command. Thefilter
parameter is especially cumbersome IMHO. The underlying command for the above example is:Do you want to remember that syntax? I don't! That's why I created the script!aws ec2 describe-images --filter Name=image-id,Values=ami-0a4b1fdc2301bf1f1 --region us-east-1
aws-images
is related script that's very useful.