# WindowsImage

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/

Extends: GenericSSMParameterImage › WindowsImage
Implements: IMachineImage

- Source: [`aws-ec2/lib/machine-image/machine-image.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-ec2/lib/machine-image/machine-image.ts#L378)

## Example

```ts
// Pick a Windows edition to use
const windows = new ec2.WindowsImage(ec2.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.
const amznLinux = new ec2.AmazonLinuxImage({
  generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX,
  edition: ec2.AmazonLinuxEdition.STANDARD,
  virtualization: ec2.AmazonLinuxVirt.HVM,
  storage: ec2.AmazonLinuxStorage.GENERAL_PURPOSE,
});

// For other custom (Linux) images, instantiate a `GenericLinuxImage` with
// a map giving the AMI to in for each region:

const linux = new ec2.GenericLinuxImage({
  'us-east-1': 'ami-97785bed',
  'eu-west-1': 'ami-12345678',
  // ...
});
```

## Initializer

```ts
new WindowsImage(version: WindowsVersion, props?: WindowsImageProps)
```

## Properties

- `parameterName`: string (required) — Name of the SSM parameter we're looking up.

## Methods

- `getImage(scope: Construct): MachineImageConfig` — Return the image to use in the given context.
