LookupMachineImage
- class aws_cdk.aws_ec2.LookupMachineImage(*, name, additional_cache_key=None, 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 thecdk context
command. See https://docs.aws.amazon.com/cdk/latest/guide/context.html for more information. Ifprops.additionalCacheKey
is set, the context key uses that value as a discriminator rather than the cached value being global across all lookups.- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_ec2 as ec2 # user_data: ec2.UserData lookup_machine_image = ec2.LookupMachineImage( name="name", # the properties below are optional additional_cache_key="additionalCacheKey", filters={ "filters_key": ["filters"] }, owners=["owners"], user_data=user_data, windows=False )
- Parameters:
name (
str
) – Name of the image (may contain wildcards).additional_cache_key (
Optional
[str
]) – Adds an additional discriminator to thecdk.context.json
cache key. Default: - no additional cache keyfilters (
Optional
[Mapping
[str
,Sequence
[str
]]]) – Additional filters on the AMI. Default: - No additional filtersowners (
Optional
[Sequence
[str
]]) – Owner account IDs or aliases. Default: - All ownersuser_data (
Optional
[UserData
]) – Custom userdata for this image. Default: - Empty user data appropriate for the platform typewindows (
Optional
[bool
]) – Look for Windows images. Default: false
Methods