Category Archives: Ubuntu Cloud Images

Ubuntu cloud images and how to find the most recent cloud image – part 2/3

TLDR;

sudo snap install image-status

This will install a snap of the very useful `image-status` utility.

image-status cloud-release bionic

This will show you the serial for the most recent Ubuntu 18.04 Bionic cloud image in QCOW format.

image-status ec2-release bionic

This will show you the AWS EC2 AMIs for the most recent Ubuntu 18.04 Bionic AWS EC2 cloud images.


Part two of a three part series.

Following on from part 1 where I detailed simplestreams and sstream-query I present to you the `image-status` utility which is a very neat and useful wrapper around sstream-query.

image-status is hosted on github as part of Scott Moser‘s talk-simplestreams repo.

I recently submitted a pull request which added the ability to package image-status as a snap. This was merged and you can now install image-status on any linux distribution supporting snaps using the following command.

sudo snap install image-status

Once installed you can start querying the simplestreams feeds for details on the most recent Ubuntu cloud images.

Usage:

image-status --help # to see all available options

image-status cloud-release bionic # to see most recent Ubuntu Bionic release images on http://cloud-images.ubuntu.com/
image-status cloud-daily bionic # to see most recent Ubuntu Bionic daily images on http://cloud-images.ubuntu.com/

image-status gce-release bionic # to see most recent Ubuntu Bionic release images on GCE
image-status gce-dailybionic # to see most recent UbuntuBionic daily images on GCE

image-status ec2-release bionic # to see most recent Ubuntu Bionic release AMIs on EC2
image-status ec2-daily bionic # to see most recent UbuntuBionic daily AMIs on EC2

image-status azure-release bionic # to see most recent Ubuntu Bionic release images on Azure
image-status azure-daily bionic # to see most recent UbuntuBionic daily images on Azure

image-status maas-release bionic # to see most recent Ubuntu Bionic release images for maas V2
image-status maas-daily bionic # to see most recent UbuntuBionic daily images for maas V2

image-status maas3-release bionic # to see most recent Ubuntu Bionic release images for maas V3
image-status maas3-daily bionic # to see most recent Ubuntu Bionic daily images for maas V3

I find this very useful when trying to quickly see what is the most recent Ubuntu release on any particular public cloud. eg:

image-status ec2-release bionic | grep eu-west-1 | grep hvm | grep ssd | awk '{split($0,a," "); print a[6]}'

This will return the ID for the most recent HVM EBS Ubuntu 18.04 (Bionic) in the eu-west-1 AWS EC2 region. This can be achieved using sstream-query too but I find filtering using grep to be easier to understand and iterate with.

I hope the above is helpful with your automation.

Share this...
Tweet about this on Twitter
Twitter
Share on Google+
Google+
Email this to someone
email

Ubuntu cloud images and how to find the most recent cloud image – part 1/3

TLDR;

sstream-query --json --max=1 --keyring=/usr/share/keyrings/ubuntu-cloudimage-keyring.gpg http://cloud-images.ubuntu.com/releases/streams/v1/com.ubuntu.cloud:released:download.sjson arch=amd64 release_codename='Xenial Xerus' ftype='disk1.img' | jq -r '.[].item_url'

This will show you the URL for the most recent Ubuntu 16.04 Xenial cloud image in QCOW format.


Part one of a three part series.

There are a few ways to find the most recent Ubuntu cloud image an the simplest method is to view the release page which lists the most recent release.

Another method is to use the cloud image simple streams data which we also update every time we (I work on the Certified Public Cloud team @ Canonical) publish an image.

We publish simple streams data for major public clouds too but this post deals with the base Ubuntu cloud image. I will follow up this post with details on how to use the cloud specific streams data.

Simple streams

Simple streams is a structured format describing the Ubuntu cloud image releases.

You can parse the Ubuntu’s release cloud image stream json yourself or you can use a combination of sstream-query and jq (install packages “ubuntu-cloudimage-keyring“, “simplestreams” and “jq“) to get all or specific data about the most recent release.

Query all data from most recent release

sstream-query --json --max=1 --keyring=/usr/share/keyrings/ubuntu-cloudimage-keyring.gpg http://cloud-images.ubuntu.com/releases/ arch=amd64 release='xenial' ftype='disk1.img'

This will return all data on the release including date released and also the checksums of the file.

[
 {
 "aliases": "16.04,default,lts,x,xenial",
 "arch": "amd64",
 "content_id": "com.ubuntu.cloud:released:download",
 "datatype": "image-downloads",
 "format": "products:1.0",
 "ftype": "disk1.img",
 "item_name": "disk1.img",
 "item_url": "http://cloud-images.ubuntu.com/releases/server/releases/xenial/release-20180126/ubuntu-16.04-server-cloudimg-amd64-disk1.img",
 "label": "release",
 "license": "http://www.canonical.com/intellectual-property-policy",
 "md5": "9cb8ed487ad8fbc8b7d082968915c4fd",
 "os": "ubuntu",
 "path": "server/releases/xenial/release-20180126/ubuntu-16.04-server-cloudimg-amd64-disk1.img",
 "product_name": "com.ubuntu.cloud:server:16.04:amd64",
 "pubname": "ubuntu-xenial-16.04-amd64-server-20180126",
 "release": "xenial",
 "release_codename": "Xenial Xerus",
 "release_title": "16.04 LTS",
 "sha256": "da7a59cbaf43eaaa83ded0b0588bdcee4e722d9355bd6b9bfddd01b2e7e372e2",
 "size": "289603584",
 "support_eol": "2021-04-21",
 "supported": "True",
 "updated": "Wed, 07 Feb 2018 03:58:59 +0000",
 "version": "16.04",
 "version_name": "20180126"
 }
 ]

Query only the url to the most recent release

sstream-query --json --max=1 --keyring=/usr/share/keyrings/ubuntu-cloudimage-keyring.gpg http://cloud-images.ubuntu.com/releases/streams/v1/com.ubuntu.cloud:released:download.sjson arch=amd64 release_codename='Xenial Xerus' ftype='disk1.img' | jq -r '.[].item_url'

This will show you the URL for the most recent Ubuntu 16.04 Xenial cloud image in QCOW format.

"http://cloud-images.ubuntu.com/releases/server/releases/xenial/release-20180126/ubuntu-16.04-server-cloudimg-amd64-disk1.img"

Query only the serial of the most recent release

sstream-query --json --max=1 --keyring=/usr/share/keyrings/ubuntu-cloudimage-keyring.gpg http://cloud-images.ubuntu.com/releases/ arch=amd64 release_codename='Xenial Xerus' ftype='disk1.img' | jq ".[].version_name"

This will show you the serial of the most recent Ubuntu 16.04 Xenial cloud image.

"20180126"

The above streams are signed using keys in the ubuntu-cloudimage-keyring keyring but you can replace the –keyring option with –no-verify to bypass any signing checks. Another way to bypass the checks is to to use the unsigned streams.

It is also worth noting that OpenStack can be configured to use streams too.

I hope the above is helpful with your automation.

Share this...
Tweet about this on Twitter
Twitter
Share on Google+
Google+
Email this to someone
email