LookupMachineImage

class aws_cdk.aws_ec2.LookupMachineImage(*, name, filters=None, owners=None, user_data=None, windows=None)

Bases: object

A machine image whose AMI ID will be searched using DescribeImages.

The most recent, available, launchable image matching the given filter criteria will be used. Looking up AMIs may take a long time; specify as many filter criteria as possible to narrow down the search.

The AMI selected will be cached in cdk.context.json and the same value will be used on future runs. To refresh the AMI lookup, you will have to evict the value from the cache using the cdk context command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for more information.

__init__(*, name, filters=None, owners=None, user_data=None, windows=None)
Parameters
  • props

  • name (str) – Name of the image (may contain wildcards).

  • filters (Optional[Mapping[str, List[str]]]) – Additional filters on the AMI. Default: - No additional filters

  • owners (Optional[List[str]]) – Owner account IDs or aliases. Default: - All owners

  • user_data (Optional[UserData]) – Custom userdata for this image. Default: - Empty user data appropriate for the platform type

  • windows (Optional[bool]) – Look for Windows images. Default: false

Return type

None

Methods

get_image(scope)

Return the image to use in the given context.

Parameters

scope (Construct) –

Return type

MachineImageConfig