Interface ILookupMachineImageProps
Properties for looking up an image.
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.AWS.EC2.dll
Syntax (csharp)
public interface ILookupMachineImageProps
Syntax (vb)
Public Interface ILookupMachineImageProps
Remarks
ExampleMetadata: lit=test/example.images.lit.ts infused
Examples
// Pick the right Amazon Linux edition. All arguments shown are optional
// and will default to these values when omitted.
var amznLinux = MachineImage.LatestAmazonLinux(new AmazonLinuxImageProps {
Generation = AmazonLinuxGeneration.AMAZON_LINUX,
Edition = AmazonLinuxEdition.STANDARD,
Virtualization = AmazonLinuxVirt.HVM,
Storage = AmazonLinuxStorage.GENERAL_PURPOSE,
CpuType = AmazonLinuxCpuType.X86_64
});
// Pick a Windows edition to use
var windows = MachineImage.LatestWindows(WindowsVersion.WINDOWS_SERVER_2019_ENGLISH_FULL_BASE);
// Read AMI id from SSM parameter store
var ssm = MachineImage.FromSsmParameter("/my/ami", new SsmParameterImageOptions { Os = 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:
var natAmi = MachineImage.Lookup(new LookupMachineImageProps {
Name = "amzn-ami-vpc-nat-*",
Owners = new [] { "amazon" }
});
// For other custom (Linux) images, instantiate a `GenericLinuxImage` with
// a map giving the AMI to in for each region:
var linux = MachineImage.GenericLinux(new Dictionary<string, string> {
{ "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:
var genericWindows = MachineImage.GenericWindows(new Dictionary<string, string> {
{ "us-east-1", "ami-97785bed" },
{ "eu-west-1", "ami-12345678" }
});
Synopsis
Properties
Filters | Additional filters on the AMI. |
Name | Name of the image (may contain wildcards). |
Owners | Owner account IDs or aliases. |
UserData | Custom userdata for this image. |
Windows | Look for Windows images. |
Properties
Filters
Additional filters on the AMI.
virtual IDictionary<string, string[]> Filters { get; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.String[]>
Remarks
Default: - No additional filters
See: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeImages.html
Name
Name of the image (may contain wildcards).
string Name { get; }
Property Value
System.String
Owners
Owner account IDs or aliases.
virtual string[] Owners { get; }
Property Value
System.String[]
Remarks
Default: - All owners
UserData
Custom userdata for this image.
virtual UserData UserData { get; }
Property Value
Remarks
Default: - Empty user data appropriate for the platform type
Windows
Look for Windows images.
virtual Nullable<bool> Windows { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: false