Class WindowsImage

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.ec2.GenericSSMParameterImage
software.amazon.awscdk.services.ec2.WindowsImage
All Implemented Interfaces:
IMachineImage, software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-22T02:24:00.799Z") @Stability(Stable) public class WindowsImage extends GenericSSMParameterImage
Select the latest version of the indicated Windows version.

This Machine Image automatically updates to the latest version on every deployment. Be aware this will cause your instances to be replaced when a new version of the image becomes available. Do not store stateful information on the instance if you are using this image.

The AMI ID is selected using the values published to the SSM parameter store.

https://aws.amazon.com/blogs/mt/query-for-the-latest-windows-ami-using-systems-manager-parameter-store/

Example:

 // Pick a Windows edition to use
 WindowsImage windows = new WindowsImage(WindowsVersion.WINDOWS_SERVER_2019_ENGLISH_FULL_BASE);
 // Pick the right Amazon Linux edition. All arguments shown are optional
 // and will default to these values when omitted.
 AmazonLinuxImage amznLinux = AmazonLinuxImage.Builder.create()
         .generation(AmazonLinuxGeneration.AMAZON_LINUX)
         .edition(AmazonLinuxEdition.STANDARD)
         .virtualization(AmazonLinuxVirt.HVM)
         .storage(AmazonLinuxStorage.GENERAL_PURPOSE)
         .build();
 // For other custom (Linux) images, instantiate a `GenericLinuxImage` with
 // a map giving the AMI to in for each region:
 GenericLinuxImage linux = new GenericLinuxImage(Map.of(
         "us-east-1", "ami-97785bed",
         "eu-west-1", "ami-12345678"));
 
  • Constructor Details

    • WindowsImage

      protected WindowsImage(software.amazon.jsii.JsiiObjectRef objRef)
    • WindowsImage

      protected WindowsImage(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • WindowsImage

      @Stability(Stable) public WindowsImage(@NotNull WindowsVersion version, @Nullable WindowsImageProps props)
      Parameters:
      version - This parameter is required.
      props -
    • WindowsImage

      @Stability(Stable) public WindowsImage(@NotNull WindowsVersion version)
      Parameters:
      version - This parameter is required.