ec2_ami_search - Retrieve AWS AMI information for a given operating system.

New in version 1.6.

DEPRECATED

Removed in Ansible:
version: 2.2
Why: Various AWS modules have been combined and replaced with ec2_ami_facts.
Alternative: Use ec2_ami_find instead.

Synopsis

  • 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"}

Parameters

Parameter Choices/Defaults Comments
arch
    Choices:
  • i386
  • amd64
CPU architecture
distro
required
    Choices:
  • ubuntu
Linux distribution (e.g., ubuntu)
region
    Choices:
  • ap-northeast-1
  • ap-southeast-1
  • ap-northeast-2
  • ap-southeast-2
  • ca-central-1
  • eu-central-1
  • eu-west-1
  • eu-west-2
  • sa-east-1
  • us-east-1
  • us-east-2
  • us-west-1
  • us-west-2
  • us-gov-west-1
EC2 region
release
required
short name of the release (e.g., precise)
store
    Choices:
  • ebs
  • ebs-io1
  • ebs-ssd
  • instance-store
Back-end store for instance
stream
    Choices:
  • server
  • desktop
Type of release.
virt
    Choices:
  • 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

Status

This module is flagged as deprecated and will be removed in version 2.2. For more information see DEPRECATED.

Author

  • Ansible Core Team (deprecated)

Hint

If you notice any issues in this documentation you can edit this document to improve it.

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.5/modules/ec2_ami_search_module.html