class LookupMachineImage
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.EC2.LookupMachineImage |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsec2#LookupMachineImage |
![]() | software.amazon.awscdk.services.ec2.LookupMachineImage |
![]() | aws_cdk.aws_ec2.LookupMachineImage |
![]() | aws-cdk-lib » aws_ec2 » LookupMachineImage |
Implements
IMachine
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.
If props.additionalCacheKey
is set, the context key uses that value as a discriminator
rather than the cached value being global across all lookups.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ec2 as ec2 } from 'aws-cdk-lib';
declare const userData: ec2.UserData;
const lookupMachineImage = new ec2.LookupMachineImage({
name: 'name',
// the properties below are optional
additionalCacheKey: 'additionalCacheKey',
filters: {
filtersKey: ['filters'],
},
owners: ['owners'],
userData: userData,
windows: false,
});
Initializer
new LookupMachineImage(props: LookupMachineImageProps)
Parameters
- props
Lookup
Machine Image Props
Methods
Name | Description |
---|---|
get | Return the correct image. |
getImage(scope)
public getImage(scope: Construct): MachineImageConfig
Parameters
- scope
Construct
Returns
Return the correct image.