interface LookupMachineImageProps
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.EC2.LookupMachineImageProps |
Java | software.amazon.awscdk.services.ec2.LookupMachineImageProps |
Python | aws_cdk.aws_ec2.LookupMachineImageProps |
TypeScript (source) | @aws-cdk/aws-ec2 » LookupMachineImageProps |
Properties for looking up an image.
Example
// Pick the right Amazon Linux edition. All arguments shown are optional
// and will default to these values when omitted.
const amznLinux = ec2.MachineImage.latestAmazonLinux({
generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX,
edition: ec2.AmazonLinuxEdition.STANDARD,
virtualization: ec2.AmazonLinuxVirt.HVM,
storage: ec2.AmazonLinuxStorage.GENERAL_PURPOSE,
cpuType: ec2.AmazonLinuxCpuType.X86_64,
});
// Pick a Windows edition to use
const windows = ec2.MachineImage.latestWindows(ec2.WindowsVersion.WINDOWS_SERVER_2019_ENGLISH_FULL_BASE);
// Read AMI id from SSM parameter store
const ssm = ec2.MachineImage.fromSsmParameter('/my/ami', { os: ec2.OperatingSystemType.LINUX });
// Look up the most recent image matching a set of AMI filters.
// In this case, look up the NAT instance AMI, by using a wildcard
// in the 'name' field:
const natAmi = ec2.MachineImage.lookup({
name: 'amzn-ami-vpc-nat-*',
owners: ['amazon'],
});
// For other custom (Linux) images, instantiate a `GenericLinuxImage` with
// a map giving the AMI to in for each region:
const linux = ec2.MachineImage.genericLinux({
'us-east-1': 'ami-97785bed',
'eu-west-1': 'ami-12345678',
// ...
});
// For other custom (Windows) images, instantiate a `GenericWindowsImage` with
// a map giving the AMI to in for each region:
const genericWindows = ec2.MachineImage.genericWindows({
'us-east-1': 'ami-97785bed',
'eu-west-1': 'ami-12345678',
// ...
});
Properties
Name | Type | Description |
---|---|---|
name | string | Name of the image (may contain wildcards). |
filters? | { [string]: string[] } | Additional filters on the AMI. |
owners? | string[] | Owner account IDs or aliases. |
user | User | Custom userdata for this image. |
windows? | boolean | Look for Windows images. |
name
Type:
string
Name of the image (may contain wildcards).
filters?
Type:
{ [string]: string[] }
(optional, default: No additional filters)
Additional filters on the AMI.
See also: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeImages.html
owners?
Type:
string[]
(optional, default: All owners)
Owner account IDs or aliases.
userData?
Type:
User
(optional, default: Empty user data appropriate for the platform type)
Custom userdata for this image.
windows?
Type:
boolean
(optional, default: false)
Look for Windows images.