Amazon Lightsail の blueprints/bundles をAWS CLIで参照してみた

eyecatch_lightsail

こんにちは、菊池です。

AWS re:Invent 2016で発表されたAmazon Lightsailはシンプルで簡単に扱えることが最大の特徴ですが、本日の AWS Black Belt Online Seminar で、AWS CLI を使うことでさらに利用の幅が広がることが紹介されていました。

早速、AWS CLIを使ってblueprintsとbundlesを参照し、コンソールだけではわからないイメージやインスタンスの仕様を見てみました。

やってみた

blueprints

blueprintはインスタンスイメージの仕様を記述したもので、get-blueprintsで利用可能なイメージを取得できます。

$ aws lightsail --region us-east-1 get-blueprints
{
    "blueprints": [
        {
            "group": "amazon-linux",
            "description": "Amazon Linux AMI (HVM / 64-bit). The Amazon Linux AMI is a supported and maintained Linux image provided by Amazon Web Services for use on Amazon Elastic Compute Cloud (Amazon EC2). It is designed to provide a stable, secure, and high performance execution environment for applications running on Amazon EC2. It also includes packages that enable easy integration with AWS, including launch configuration tools and many popular AWS libraries and tools. Amazon Web Services provides ongoing security and maintenance updates to all instances running the Amazon Linux AMI. The Amazon Linux AMI is provided at no additional charge to Amazon EC2 users.",
            "productUrl": "https://aws.amazon.com/marketplace/pp/B00CIYTQTC",
            "version": "2016.09.0",
            "licenseUrl": "https://d7umqicpi7263.cloudfront.net/eula/product/f37c8255-1ff9-48bd-b5da-b5046f4fee68/17864b80-f5b6-4f0a-aa26-7346ef135ebc.txt",
            "versionCode": "1",
            "blueprintId": "amazon_linux_2016_09_0",
            "minPower": 0,
            "type": "os",
            "isActive": true,
            "name": "Amazon Linux"
        },
        {
            "group": "ubuntu",
            "description": "Ubuntu 16.04 LTS - Xenial (HVM). Lean, fast and powerful, Ubuntu Server delivers services reliably, predictably and economically. It is the perfect base on which to build your instances. Ubuntu is free and will always be, and you have the option to get support and Landscape from Canonical.",
            "productUrl": "https://aws.amazon.com/marketplace/pp/B01JBL2M0O",
            "version": "16.04 LTS",
            "licenseUrl": "https://d7umqicpi7263.cloudfront.net/eula/product/d83d0782-cb94-46d7-8993-f4ce15d1a484/6b096ad5-0ca9-48bd-9229-f4148f8e3e58.txt",
            "versionCode": "1",
            "blueprintId": "ubuntu_16_04",
            "minPower": 0,
            "type": "os",
            "isActive": true,
            "name": "Ubuntu"
        },
        {
            "group": "wordpress",
            "description": "WordPress powered by Bitnami and sold by BitRock Inc. is a pre-configured, ready to run image for running WordPress on Amazon EC2. WordPress is one of the world's most popular web publishing platforms for building blogs and websites. It can be customized via a wide selection of themes, extensions and plug-ins.",
            "productUrl": "https://aws.amazon.com/marketplace/pp/B00NN8Y43U",
            "version": "4.6.1",
            "licenseUrl": "https://d7umqicpi7263.cloudfront.net/eula/product/7d426cb7-9522-4dd7-a56b-55dd8cc1c8d0/588fd495-6492-4610-b3e8-d15ce864454c.txt",
            "versionCode": "1",
            "blueprintId": "wordpress_4_6_1",
            "minPower": 0,
            "type": "app",
            "isActive": true,
            "name": "WordPress"
        },
        {
            "group": "lamp",
            "description": "LAMP powered by Bitnami and sold by BitRock Inc. greatly simplifies the development and deployment of PHP applications. It includes ready-to-run versions of Apache, MySQL, PHP and phpMyAdmin and all of the other software required to run each of those components. Bitnami LAMPStack is completely integrated and configured, so you'll be ready to start developing your application as soon as the AMI is launched onto Amazon EC2. Bitnami LAMPStack is regularly updated to make sure that you always have access to the latest stable releases of each of the bundled components.",
            "productUrl": "https://aws.amazon.com/marketplace/pp/B00NNZUY96",
            "version": "5.6.27",
            "licenseUrl": "https://d7umqicpi7263.cloudfront.net/eula/product/963e08a0-1e5f-40b3-9a1d-72ae322da2ac/a4d04b7f-6702-4b42-ac08-be48114cd6e8.txt",
            "versionCode": "1",
            "blueprintId": "lamp_5_6_27",
            "minPower": 0,
            "type": "app",
            "isActive": true,
            "name": "LAMP Stack"
        },
        {
            "group": "node",
            "description": "Node.js powered by Bitnami and sold by BitRock Inc. is a pre-configured, ready to run image for running Node.js on Amazon EC2. Node.js is a platform built on Chromes JavaScript runtime for easily building fast, scalable network applications. It uses an event-driven, non-blocking I/O model that makes it lightweight and efficient.",
            "productUrl": "https://aws.amazon.com/marketplace/pp/B00NNZUAKO",
            "version": "6.9.1",
            "licenseUrl": "https://d7umqicpi7263.cloudfront.net/eula/product/033793fe-951d-47d0-aa94-5fbd0afb3582/25f8fa66-c868-4d80-adf8-4a2b602064ae.txt",
            "versionCode": "1",
            "blueprintId": "nodejs_6_9_1",
            "minPower": 0,
            "type": "app",
            "isActive": true,
            "name": "Node.js"
        },
        {
            "group": "joomla",
            "description": "Joomla! powered by Bitnami and sold by BitRock Inc. is a pre-configured, ready to run image for running Joomla! on Amazon EC2. Joomla! is an award-winning content management system that can be used to build personal/corporate websites or portals, small business websites, non-profit and organizational websites.",
            "productUrl": "https://aws.amazon.com/marketplace/pp/B00NNZUP54",
            "version": "3.6.3",
            "licenseUrl": "https://d7umqicpi7263.cloudfront.net/eula/product/b91c0e2b-c5bc-4c86-b5ad-7513770d4fc3/c08a40f3-db2a-4105-b764-46726a0633eb.txt",
            "versionCode": "1",
            "blueprintId": "joomla_3_6_3",
            "minPower": 0,
            "type": "app",
            "isActive": true,
            "name": "Joomla"
        },
        {
            "group": "magento",
            "description": "Magento powered by Bitnami and sold by BitRock Inc. is a pre-configured, ready to run image for running Magento on Amazon EC2. Magento is a feature-rich flexible e-commerce solution. It includes transaction options, multi-store functionality, loyalty programs, product categorization, shopper filtering, promotion rules, and more.",
            "productUrl": "https://aws.amazon.com/marketplace/pp/B00NNZTA6Y",
            "version": "2.1.2",
            "licenseUrl": "https://d7umqicpi7263.cloudfront.net/eula/product/16023473-10a0-433b-a56a-8d0a014a0a53/03677067-b51a-4092-bc6b-b958e5f10d69.txt",
            "versionCode": "1",
            "blueprintId": "magento_2_1_2",
            "minPower": 0,
            "type": "app",
            "isActive": true,
            "name": "Magento"
        },
        {
            "group": "mean",
            "description": "MEAN powered by Bitnami and sold by BitRock Inc. provides a complete development environment for mongoDB and Node.js that can be deployed in one click. It includes the latest stable release of mongoDB, Express, Angular, Node.js, Git, PHP and RockMongo.",
            "productUrl": "https://aws.amazon.com/marketplace/pp/B00NO1HJ56",
            "version": "3.2.10",
            "licenseUrl": "https://d7umqicpi7263.cloudfront.net/eula/product/963e08a0-1e5f-40b3-9a1d-72ae322da2ac/a4d04b7f-6702-4b42-ac08-be48114cd6e8.txt",
            "versionCode": "1",
            "blueprintId": "mean_3_2_10",
            "minPower": 0,
            "type": "app",
            "isActive": true,
            "name": "MEAN"
        },
        {
            "group": "drupal",
            "description": "Drupal powered by Bitnami and sold by BitRock Inc. is a pre-configured, ready to run image for running Drupal on Amazon EC2. Drupal is a content management platform that allows users to easily publish, manage and organize content. It is used for community web portals, discussion sites, corporate web sites and more. It is easy to extend by plugging in modules. After installation, please follow the Bitnami Drupal User Guide documentation to successfully install the SMTP module and configure outbound email settings.",
            "productUrl": "https://aws.amazon.com/marketplace/pp/B00NNZSUMO",
            "version": "8.2.1",
            "licenseUrl": "https://d7umqicpi7263.cloudfront.net/eula/product/92c77297-cef5-4be2-8ed3-98e2fe309d5c/daf83560-7db1-4cd5-97d9-a8cb8348fabf.txt",
            "versionCode": "1",
            "blueprintId": "drupal_8_2_1",
            "minPower": 0,
            "type": "app",
            "isActive": true,
            "name": "Drupal"
        },
        {
            "group": "gitlab",
            "description": "GitLab powered by Bitnami and sold by BitRock Inc. is a pre-configured, ready to run image for running GitLab on Amazon EC2. GitLab is self-hosted Git management software thats fast, secure, and based on Ruby on Rails. GitLab CI (also included) is an open-source Continuous Integration (CI) server closely integrated with Git and GitLab.",
            "productUrl": "https://aws.amazon.com/marketplace/pp/B00NNZU5PO",
            "version": "8.12.6",
            "licenseUrl": "https://d7umqicpi7263.cloudfront.net/eula/product/b7dabc33-bcd2-4a72-80fb-d3d83894831d/def0581a-4fbd-4a5a-8315-66bcc08307b9.txt",
            "versionCode": "1",
            "blueprintId": "gitlab_8_12_6",
            "minPower": 0,
            "type": "app",
            "isActive": true,
            "name": "GitLab"
        },
        {
            "group": "redmine",
            "description": "Redmine powered by Bitnami and sold by BitRock Inc. is a pre-configured, ready to run image for running Redmine on Amazon EC2. Redmine is a flexible project management web application. It includes support for multiple projects, role-based access control, Gantt chart and calendar, management of news, documents and files, per-project wikis and forums, SCM integration and more.",
            "productUrl": "https://aws.amazon.com/marketplace/pp/B00NNZUVHQ",
            "version": "3.3.1",
            "licenseUrl": "https://d7umqicpi7263.cloudfront.net/eula/product/ee6977a6-d6da-4671-885e-dd9c02ec5def/e46b414e-6323-4647-952f-d456846302da.txt",
            "versionCode": "1",
            "blueprintId": "redmine_3_3_1",
            "minPower": 0,
            "type": "app",
            "isActive": true,
            "name": "Redmine"
        },
        {
            "group": "nginx",
            "description": "Nginx powered by Bitnami and sold by BitRock Inc. provides a complete PHP, MySQL and Nginx development environment that can be launched in one click. It also bundles phpMyAdmin, SQLite, ImageMagick, FastCGI, Memcache, GD, CURL, PEAR, PECL and other components.",
            "productUrl": "https://aws.amazon.com/marketplace/pp/B00NPHKI3Y",
            "version": "1.10.2",
            "licenseUrl": "https://d7umqicpi7263.cloudfront.net/eula/product/f5774628-e459-457a-b058-3b513caefdee/ccab4d3c-7d26-47ba-b9de-8025c46eebe5.txt",
            "versionCode": "1",
            "blueprintId": "nginx_1_10_2",
            "minPower": 0,
            "type": "app",
            "isActive": true,
            "name": "Nginx"
        }
    ]
}

バージョンやmarketplaceのURLはコンソールからでも参照できますが、IsActiveやminPowerといった項目があるのが確認できます。

ドキュメントによると、--include-inactiveのオプションをつけることで、Activeでないイメージも出力されるようですが、現時点では全てActiveの状態でした。

また、minPowerはそのイメージを起動するのに必要な最小のスペックで、後述するbundleで出力される、スペックごとに定義されたpowerに対応するようです。現時点では全て"minPower": 0となっていおり、これは全てのスペックで起動可能ということです。

bundles

bundleはイメージを起動するインスタンスのスペック/プランが記述され、get-bundlesで利用可能なスペック/プランを取得できます。

$ aws lightsail --region us-east-1 get-bundles
{
    "bundles": [
        {
            "name": "Nano",
            "power": 300,
            "price": 5.0,
            "ramSizeInGb": 0.5,
            "diskSizeInGb": 20,
            "transferPerMonthInGb": 1000,
            "cpuCount": 1,
            "instanceType": "t2.nano",
            "isActive": true,
            "bundleId": "nano_1_0"
        },
        {
            "name": "Micro",
            "power": 500,
            "price": 10.0,
            "ramSizeInGb": 1.0,
            "diskSizeInGb": 30,
            "transferPerMonthInGb": 2000,
            "cpuCount": 1,
            "instanceType": "t2.micro",
            "isActive": true,
            "bundleId": "micro_1_0"
        },
        {
            "name": "Small",
            "power": 1000,
            "price": 20.0,
            "ramSizeInGb": 2.0,
            "diskSizeInGb": 40,
            "transferPerMonthInGb": 3000,
            "cpuCount": 1,
            "instanceType": "t2.small",
            "isActive": true,
            "bundleId": "small_1_0"
        },
        {
            "name": "Medium",
            "power": 2000,
            "price": 40.0,
            "ramSizeInGb": 4.0,
            "diskSizeInGb": 60,
            "transferPerMonthInGb": 4000,
            "cpuCount": 2,
            "instanceType": "t2.medium",
            "isActive": true,
            "bundleId": "medium_1_0"
        },
        {
            "name": "Large",
            "power": 3000,
            "price": 80.0,
            "ramSizeInGb": 8.0,
            "diskSizeInGb": 80,
            "transferPerMonthInGb": 5000,
            "cpuCount": 2,
            "instanceType": "t2.large",
            "isActive": true,
            "bundleId": "large_1_0"
        }
    ]
}

各インスタンスの具体的なスペックが記述されています。名前にNano/Micro/Small/Medium/Largeとつけられており、それぞれインスタンスタイプがt2.nano/t2.micro/t2.small/t2.medium/t2.largeと設定されており、対応するT2ファミリーのEC2インスタンスが割り当てられているのがわかります。

また、データ転送量はそれぞれ1TB/2TB/3TB/4TB/5TBと設定されており、これはかなりの転送量がバンドルされているといえるでしょう。

まとめ

いかがでしょうか。

Amazon Lightsailは、シンプルさが売りとなっているだけあって、そのコンソール画面もかなりシンプルにできています。そのためか、コンソールではできないが、CLIなどを使ったAPIでのみ操作できる機能もあります。

今後も、そのような機能を試して紹介していきたいと思います。