runway.cfngin.lookups.handlers.ami module¶
AMI lookup.
-
exception
runway.cfngin.lookups.handlers.ami.
ImageNotFound
(search_string)[source]¶ Bases:
Exception
Image not found.
Instantiate class.
-
class
runway.cfngin.lookups.handlers.ami.
AmiLookup
[source]¶ Bases:
runway.lookups.handlers.base.LookupHandler
AMI lookup.
-
classmethod
handle
(value, context=None, provider=None, **kwargs)[source]¶ Fetch the most recent AMI Id using a filter.
- Parameters
value (str) – Parameter(s) given to this lookup.
context (
runway.cfngin.context.Context
) – Context instance.provider (
runway.cfngin.providers.base.BaseProvider
) – Provider instance.
- Returns
Looked up value.
- Return type
Example
The above fetches the most recent AMI where owner is self account or amazon and the ami name matches the regex described, the architecture will be either x64 or i386
You can also optionally specify the region in which to perform the AMI lookup.
Valid arguments:
- owners (comma delimited) REQUIRED ONCE:
aws_account_id | amazon | self
- name_regex (a regex) REQUIRED ONCE:
e.g.
my-ubuntu-server-[0-9]+
- executable_users (comma delimited) OPTIONAL ONCE:
aws_account_id | amazon | self
Any other arguments specified are sent as filters to the aws api For example,
architecture:x86_64
will add a filter
-
classmethod