ec2_ami_search - Retrieve AWS AMI for a given operating system.

Author:Lorin Hochstein

Synopsis

New in version 1.6.

Look up the most recent AMI on AWS for a given operating system. Returns ami, aki, ari, serial, tag If there is no AKI or ARI associated with an image, these will be null. Only supports images from cloud-images.ubuntu.com Example output: {"ami": "ami-69f5a900", "changed": false, "aki": "aki-88aa75e1", "tag": "release", "ari": null, "serial": "20131024"}

Options

parameter required default choices comments
arch no amd64
  • i386
  • amd64
CPU architecture
distro yes
  • ubuntu
Linux distribution (e.g., C(ubuntu))
region no us-east-1
  • ap-northeast-1
  • ap-southeast-1
  • ap-southeast-2
  • eu-west-1
  • sa-east-1
  • us-east-1
  • us-west-1
  • us-west-2
EC2 region
release yes
    short name of the release (e.g., C(precise))
    store no ebs
    • ebs
    • instance-store
    Back-end store for instance
    stream no server
    • server
    • desktop
    Type of release.
    virt no paravirtual
    • paravirtual
    • hvm
    virutalization type

    Examples


    - name: Launch an Ubuntu 12.04 (Precise Pangolin) EC2 instance
      hosts: 127.0.0.1
      connection: local
      tasks:
      - name: Get the Ubuntu precise AMI
        ec2_ami_search: distro=ubuntu release=precise region=us-west-1 store=instance-store
        register: ubuntu_image
      - name: Start the EC2 instance
        ec2: image={{ ubuntu_image.ami }} instance_type=m1.small key_name=mykey